Skip to content

Commit b50414c

Browse files
authored
Merge pull request #46 from briis/2022.4.0
Fix sensors
2 parents 9802b9f + fc4ead6 commit b50414c

5 files changed

Lines changed: 16 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# List of Changes
22

3+
## Version 2022.4.0
4+
5+
- Update sensors to use EntityCategory enums
6+
- Update minimum HA version to 2022.3
7+
38
## Version 2022.3.0
49

510
- Bump pyweatherflowudp to 1.3.0 - [Changelog](https://github.com/briis/pyweatherflowudp/blob/main/CHANGELOG.md)

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
![Release](https://img.shields.io/github/v/release/briis/smartweatherudp?style=for-the-badge)
2+
[![Buy Me A Coffee/Beer](https://img.shields.io/badge/Buy_Me_A_☕/🍺-F16061?style=for-the-badge&logo=ko-fi&logoColor=white&labelColor=grey)](https://ko-fi.com/natekspencer)
3+
[![HACS Badge](https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge)](https://github.com/custom-components/hacs)
4+
[![Discord Server](https://img.shields.io/discord/918948431714738257?style=for-the-badge)](https://discord.gg/rWzPjQegRy)
5+
16
![WeatherFlow Logo](logo.png)
27

38
# WeatherFlow Local for Home Assistant
49

5-
[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg)](https://github.com/custom-components/hacs) [![](https://img.shields.io/discord/918948431714738257)](https://discord.gg/rWzPjQegRy)
6-
710
This a _custom component_ for [Home Assistant](https://www.home-assistant.io/). It reads real-time data using the [UDP protocol](https://weatherflow.github.io/Tempest/api/udp/v171/) from a _WeatherFlow_ weather station.
811

912
It will create a device with several `sensor` entities for each weather reading like Temperature, Humidity, Station Pressure, UV, etc that is associated with it.

custom_components/smartweatherudp/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "WeatherFlow - Local",
44
"config_flow": true,
55
"documentation": "https://github.com/briis/smartweatherudp",
6-
"version": "2022.3.0",
6+
"version": "2022.4.0",
77
"codeowners": [
88
"@briis",
99
"@natekspencer"

custom_components/smartweatherudp/sensor.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
CONF_NAME,
3232
DEGREE,
3333
ELECTRIC_POTENTIAL_VOLT,
34-
ENTITY_CATEGORY_DIAGNOSTIC,
3534
IRRADIATION_WATTS_PER_SQUARE_METER,
3635
LENGTH_KILOMETERS,
3736
LENGTH_MILES,
@@ -52,7 +51,7 @@
5251
from homeassistant.core import Callable, HomeAssistant, callback
5352
import homeassistant.helpers.config_validation as cv
5453
from homeassistant.helpers.dispatcher import async_dispatcher_connect
55-
from homeassistant.helpers.entity import DeviceInfo
54+
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
5655
from homeassistant.helpers.entity_platform import AddEntitiesCallback
5756
from homeassistant.helpers.typing import ConfigType, StateType
5857

@@ -158,7 +157,6 @@ def __post_init__(self) -> None:
158157
self.device_class = SensorDeviceClass.TEMPERATURE
159158
self.state_class = SensorStateClass.MEASUREMENT
160159
self.decimals = 1
161-
super().__post_init__()
162160

163161

164162
@dataclass
@@ -173,7 +171,6 @@ def __post_init__(self) -> None:
173171
self.conversion_fn = lambda attr: attr.to(SPEED_MILES_PER_HOUR)
174172
self.decimals = 2
175173
self.value_fn = lambda attr: attr.to(QUANTITY_KILOMETERS_PER_HOUR)
176-
super().__post_init__()
177174

178175

179176
SENSORS: tuple[WeatherFlowSensorEntityDescription, ...] = (
@@ -199,7 +196,7 @@ def __post_init__(self) -> None:
199196
name="Battery Voltage",
200197
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
201198
device_class=SensorDeviceClass.VOLTAGE,
202-
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
199+
entity_category=EntityCategory.DIAGNOSTIC,
203200
state_class=SensorStateClass.MEASUREMENT,
204201
),
205202
WeatherFlowTemperatureSensorEntityDescription(
@@ -260,7 +257,7 @@ def __post_init__(self) -> None:
260257
name="RSSI",
261258
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
262259
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
263-
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
260+
entity_category=EntityCategory.DIAGNOSTIC,
264261
state_class=SensorStateClass.MEASUREMENT,
265262
entity_registry_enabled_default=False,
266263
event_subscriptions=[EVENT_STATUS_UPDATE],
@@ -285,7 +282,7 @@ def __post_init__(self) -> None:
285282
key="up_since",
286283
name="Up Since",
287284
device_class=SensorDeviceClass.TIMESTAMP,
288-
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
285+
entity_category=EntityCategory.DIAGNOSTIC,
289286
entity_registry_enabled_default=False,
290287
event_subscriptions=[EVENT_STATUS_UPDATE],
291288
),

hacs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"domains": [
44
"sensor"
55
],
6-
"homeassistant": "2021.12.0"
6+
"homeassistant": "2022.3.0"
77
}

0 commit comments

Comments
 (0)