Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make the integration compatible with HA 2024.1 #92

Merged
merged 2 commits into from
Jan 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions custom_components/yandex_weather/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down
Loading