Skip to content

Commit

Permalink
Bump pyweatherflowudp to 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
natekspencer committed Dec 22, 2021
1 parent 0b5cae7 commit 90c7602
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# List of Changes

## Version 2021.12.5

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

## Version 2021.12.4

- Bump pyweatherflowudp to 1.1.2 - [Changelog](https://github.com/briis/pyweatherflowudp/blob/main/CHANGELOG.md)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/smartweatherudp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"name": "WeatherFlow - Local",
"config_flow": true,
"documentation": "https://github.com/briis/smartweatherudp",
"version": "2021.12.4",
"version": "2021.12.5",
"codeowners": [
"@briis",
"@natekspencer"
],
"requirements": [
"pyweatherflowudp==1.1.2"
"pyweatherflowudp==1.2.0"
]
}
13 changes: 7 additions & 6 deletions custom_components/smartweatherudp/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,10 @@ def async_add_sensor(device: WeatherFlowDevice) -> None:
async_add_entities(
WeatherFlowSensorEntity(device, description, hass.config.units.is_metric)
for description in SENSORS
if getattr(
if hasattr(
device,
description.key if description.attr is None else description.attr,
None,
)
is not None
)

config_entry.async_on_unload(
Expand Down Expand Up @@ -420,16 +418,19 @@ def native_value(self) -> datetime | StateType:
else self.entity_description.attr,
)

if attr is None:
return attr

if (
not self.hass.config.units.is_metric
and (fn := self.entity_description.conversion_fn) is not None
) or (fn := self.entity_description.value_fn) is not None:
attr = fn(attr)

value = attr.m if isinstance(attr, Quantity) else attr
attr = attr.m if isinstance(attr, Quantity) else attr
if (decimals := self.entity_description.decimals) is not None:
value = round(value, decimals)
return value
attr = round(attr, decimals)
return attr

async def async_added_to_hass(self) -> None:
"""Subscribe to events."""
Expand Down

0 comments on commit 90c7602

Please sign in to comment.