diff --git a/homeassistant/components/meteoalarm/binary_sensor.py b/homeassistant/components/meteoalarm/binary_sensor.py index c4b6e49a636..246074ce585 100644 --- a/homeassistant/components/meteoalarm/binary_sensor.py +++ b/homeassistant/components/meteoalarm/binary_sensor.py @@ -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