Skip to content

Commit

Permalink
Change negative gust values to 0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
astrandb committed Oct 10, 2024
1 parent 78700ef commit 6b7f9e7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion custom_components/weatherlink/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,22 @@ def generate_model(self):
def native_value(self):
"""Return the state of the sensor."""
# _LOGGER.debug("Key: %s", self.entity_description.key)
if self.entity_description.key not in ["WindDir", "BarTrend"]:
if self.entity_description.key not in ["WindDir", "BarTrend", "WindGust"]:
return self.coordinator.data[self.tx_id].get(self.entity_description.tag)

if self.entity_description.tag in [DataKey.WIND_GUST_MPH]:
if (
self.coordinator.data[self.tx_id].get(self.entity_description.tag)
is None
):
return None
if (
float(
self.coordinator.data[self.tx_id].get(self.entity_description.tag)
)
< 0
):
return 0.0
return self.coordinator.data[self.tx_id].get(self.entity_description.tag)

if self.entity_description.tag in [DataKey.WIND_DIR]:
Expand Down

0 comments on commit 6b7f9e7

Please sign in to comment.