diff --git a/custom_components/yandex_weather/weather.py b/custom_components/yandex_weather/weather.py index 4401b4d..8f4e54e 100644 --- a/custom_components/yandex_weather/weather.py +++ b/custom_components/yandex_weather/weather.py @@ -198,7 +198,9 @@ async def async_added_to_hass(self) -> None: def _handle_coordinator_update(self) -> None: self._attr_available = True - self.condition = self.coordinator.data.get(ATTR_API_CONDITION) + self.update_condition_and_fire_event( + new_condition=self.coordinator.data.get(ATTR_API_CONDITION) + ) self._attr_entity_picture = get_image( image_source=self._image_source, condition=self.coordinator.data.get(ATTR_API_ORIGINAL_CONDITION), @@ -227,8 +229,7 @@ def _handle_coordinator_update(self) -> None: self.async_write_ha_state() - @WeatherEntity.condition.setter - def condition(self, new_condition: str): + def update_condition_and_fire_event(self, new_condition: str): """Set new condition and fire event on change.""" if ( new_condition != self._attr_condition