Skip to content

Commit

Permalink
split wind max speed sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
siku2 committed May 17, 2021
1 parent 66d85af commit 44aaad7
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions custom_components/weatherlink/sensor_iss.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,31 @@ def state(self):
def device_state_attributes(self):
c = self._iss_condition
return {
"high": round_optional(c.wind_speed_hi_last_2_min, DECIMALS_SPEED),
"10_min": round(c.wind_speed_avg_last_10_min, DECIMALS_SPEED),
"10_min_high": round(c.wind_speed_hi_last_10_min, DECIMALS_SPEED),
}


class WindMaxSpeed(
IssSensor,
sensor_name="Wind max speed",
unit_of_measurement="km/h",
device_class=None,
):
@property
def icon(self):
return "mdi:weather-windy"

@property
def state(self):
return round_optional(
self._iss_condition.wind_speed_hi_last_2_min, DECIMALS_SPEED
)

@property
def device_state_attributes(self):
c = self._iss_condition
return {
"10_min": round(c.wind_speed_hi_last_10_min, DECIMALS_SPEED),
}


Expand Down

0 comments on commit 44aaad7

Please sign in to comment.