From 38a67ad64cb969cbc5c3777877f82066aa099ae3 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Mon, 18 Mar 2024 01:11:23 +0100 Subject: [PATCH] Small improvements --- custom_components/hon/climate.py | 17 ++++++++++------- custom_components/hon/light.py | 7 +++++++ custom_components/hon/manifest.json | 4 ++-- custom_components/hon/number.py | 6 ++++++ custom_components/hon/switch.py | 12 +++++++++--- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/custom_components/hon/climate.py b/custom_components/hon/climate.py index ff44d92..01e2c30 100644 --- a/custom_components/hon/climate.py +++ b/custom_components/hon/climate.py @@ -153,7 +153,9 @@ class HonACClimateEntity(HonEntity, ClimateEntity): SWING_BOTH, ] self._attr_supported_features = ( - ClimateEntityFeature.TARGET_TEMPERATURE + ClimateEntityFeature.TURN_ON + | ClimateEntityFeature.TURN_OFF + | ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.SWING_MODE | ClimateEntityFeature.PRESET_MODE @@ -295,11 +297,17 @@ class HonClimateEntity(HonEntity, ClimateEntity): ) -> None: super().__init__(hass, entry, device, description) + self._attr_supported_features = ( + ClimateEntityFeature.TURN_ON + | ClimateEntityFeature.TARGET_TEMPERATURE + ) + self._attr_temperature_unit = UnitOfTemperature.CELSIUS self._set_temperature_bound() self._attr_hvac_modes = [description.mode] if "stopProgram" in device.commands: + self._attr_supported_features |= ClimateEntityFeature.TURN_OFF self._attr_hvac_modes += [HVACMode.OFF] modes = [] else: @@ -317,13 +325,8 @@ class HonClimateEntity(HonEntity, ClimateEntity): modes.append(mode) if modes: - self._attr_supported_features = ( - ClimateEntityFeature.TARGET_TEMPERATURE - | ClimateEntityFeature.PRESET_MODE - ) + self._attr_supported_features |= ClimateEntityFeature.PRESET_MODE self._attr_preset_modes = modes - else: - self._attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE self._handle_coordinator_update(update=False) diff --git a/custom_components/hon/light.py b/custom_components/hon/light.py index f7aa870..ef64a98 100644 --- a/custom_components/hon/light.py +++ b/custom_components/hon/light.py @@ -42,6 +42,13 @@ LIGHTS: dict[str, tuple[LightEntityDescription, ...]] = { translation_key="light", ), ), + "DW": ( + LightEntityDescription( + key="settings.lightStatus", + name="Light status", + translation_key="light", + ), + ), } diff --git a/custom_components/hon/manifest.json b/custom_components/hon/manifest.json index d977eb1..01c9138 100644 --- a/custom_components/hon/manifest.json +++ b/custom_components/hon/manifest.json @@ -9,7 +9,7 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/Andre0512/hon/issues", "requirements": [ - "pyhOn==0.16.0" + "pyhOn==0.16.1" ], - "version": "0.13.0" + "version": "0.13.1" } diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index b9ae6cd..9d92184 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -139,6 +139,12 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = { icon="mdi:water", translation_key="water_hard", ), + HonNumberEntityDescription( + key="settings.waterHard", + name="Water hard", + icon="mdi:water", + translation_key="water_hard", + ), ), "AC": ( HonNumberEntityDescription( diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index 54931a3..f742b56 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -269,6 +269,12 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { icon="mdi:volume-off", translation_key="buzzer", ), + HonConfigSwitchEntityDescription( + key="startProgram.tabStatus", + name="Tab Status", + icon="mdi:silverware-clean", + # translation_key="buzzer", + ), ), "AC": ( HonSwitchEntityDescription( @@ -408,9 +414,9 @@ async def async_setup_entry( entity = HonConfigSwitchEntity(hass, entry, device, description) elif isinstance(description, HonControlSwitchEntityDescription): if not ( - device.get(description.key) is not None - or description.turn_on_key in list(device.commands) - or description.turn_off_key in list(device.commands) + device.get(description.key) is not None + or description.turn_on_key in list(device.commands) + or description.turn_off_key in list(device.commands) ): continue entity = HonControlSwitchEntity(hass, entry, device, description)