Adjust type hint in meteoalarm (#77818)

pull/77825/head
epenet 2022-09-05 10:47:01 +02:00 committed by GitHub
parent bbf77ed46f
commit 5739712a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -74,15 +74,14 @@ class MeteoAlertBinarySensor(BinarySensorEntity):
self._attr_name = name
self._api = api
def update(self):
def update(self) -> None:
"""Update device state."""
self._attr_extra_state_attributes = None
self._attr_extra_state_attributes = {}
self._attr_is_on = False
if alert := self._api.get_alert():
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_is_on = True