Adjust type hint in meteoalarm (#77818)
parent
bbf77ed46f
commit
5739712a0d
|
@ -74,15 +74,14 @@ class MeteoAlertBinarySensor(BinarySensorEntity):
|
||||||
self._attr_name = name
|
self._attr_name = name
|
||||||
self._api = api
|
self._api = api
|
||||||
|
|
||||||
def update(self):
|
def update(self) -> None:
|
||||||
"""Update device state."""
|
"""Update device state."""
|
||||||
self._attr_extra_state_attributes = None
|
self._attr_extra_state_attributes = {}
|
||||||
self._attr_is_on = False
|
self._attr_is_on = False
|
||||||
|
|
||||||
if alert := self._api.get_alert():
|
if alert := self._api.get_alert():
|
||||||
expiration_date = dt_util.parse_datetime(alert["expires"])
|
expiration_date = dt_util.parse_datetime(alert["expires"])
|
||||||
now = dt_util.utcnow()
|
|
||||||
|
|
||||||
if expiration_date > now:
|
if expiration_date is not None and expiration_date > dt_util.utcnow():
|
||||||
self._attr_extra_state_attributes = alert
|
self._attr_extra_state_attributes = alert
|
||||||
self._attr_is_on = True
|
self._attr_is_on = True
|
||||||
|
|
Loading…
Reference in New Issue