Skip to content

Commit

Permalink
fix: add water heater on_off feature
Browse files Browse the repository at this point in the history
  • Loading branch information
SusanPhevos committed Jan 7, 2025
1 parent 56e9f1d commit 84e79c3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions custom_components/xiaomi_home/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def __init__(
super().__init__(miot_device=miot_device, entity_data=entity_data)
self._attr_temperature_unit = None
self._attr_supported_features = WaterHeaterEntityFeature(0)
self._attr_operation_list = None
self._prop_on = None
self._prop_temp = None
self._prop_target_temp = None
Expand All @@ -114,6 +113,8 @@ def __init__(
# on
if prop.name == 'on':
self._prop_on = prop
self._attr_supported_features |= (
WaterHeaterEntityFeature.ON_OFF)
# temperature
if prop.name == 'temperature':
if isinstance(prop.value_range, dict):
Expand Down Expand Up @@ -153,10 +154,8 @@ def __init__(
self._attr_supported_features |= (
WaterHeaterEntityFeature.OPERATION_MODE)
self._prop_mode = prop
if self._attr_operation_list is None:
if not self._attr_operation_list:
self._attr_operation_list = [STATE_ON]
else:
self._attr_operation_list.append(STATE_ON)
self._attr_operation_list.append(STATE_OFF)

async def async_turn_on(self) -> None:
Expand Down

0 comments on commit 84e79c3

Please sign in to comment.