Skip to content

Commit

Permalink
fix senseor "yandex_condition" backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelChertkov committed Oct 8, 2024
1 parent 2496bed commit 57b6086
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions custom_components/yandex_pogoda/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
UPDATER,
WIND_SPEED_CONVERTER,
YA_CONDITION_STATES,
WEATHER_STATES_CONVERSION,
convert_unit_value,
)
from .updater import WeatherUpdater
Expand Down Expand Up @@ -208,9 +209,11 @@ async def async_added_to_hass(self) -> None:
self.native_unit_of_measurement,
)
)
elif self.entity_description.key == ATTR_API_YA_CONDITION:
if state.state in YA_CONDITION_STATES: # for backward compatibility
self._attr_native_value = state.state
elif (
self.entity_description.key == ATTR_API_YA_CONDITION
and state.state not in YA_CONDITION_STATES
): # for backward compatibility
self._attr_native_value = WEATHER_STATES_CONVERSION.get(state.state)
else:
self._attr_native_value = state.state

Expand Down

0 comments on commit 57b6086

Please sign in to comment.