From 6516f87127910055d74d1d198eae2004844038f2 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Fri, 29 Sep 2023 17:24:21 +0200 Subject: [PATCH] Add some sensors --- README.md | 17 ++++++++++++--- custom_components/hon/climate.py | 10 +++++++-- custom_components/hon/number.py | 6 ++++++ custom_components/hon/switch.py | 37 +++++++++++++++++++++++++++----- info.md | 24 ++++++++++----------- requirements_dev.txt | 9 ++++---- 6 files changed, 77 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index c122def..945c27d 100644 --- a/README.md +++ b/README.md @@ -383,9 +383,10 @@ For every device exists a button under diagnostics which can be used to log all | Energy Label | `lightning-bolt-circle` | `sensor` | `startProgram.energyLabel` | | Program | | `select` | `startProgram.program` | | Steam Type | `weather-dust` | `sensor` | `steamType` | -| Sterilization | `clock-start` | `switch` | `startProgram.sterilizationStatus` | +| Sterilization | `lotion-plus` | `switch` | `startProgram.sterilizationStatus` | | Suggested Load | `weight-kilogram` | `sensor` | `startProgram.suggestedLoadD` | | Temperature level | `thermometer` | `number` | `startProgram.tempLevel` | +| Tumbling | `refresh-circle` | `switch` | `startProgram.tumblingStatus` | #### Sensors | Name | Icon | Entity | Key | | --- | --- | --- | --- | @@ -426,14 +427,17 @@ For every device exists a button under diagnostics which can be used to log all #### Controls | Name | Icon | Entity | Key | | --- | --- | --- | --- | +| Auto Dose Detergent | `cup` | `switch` | `autoDetergentStatus` | +| Auto Dose Softener | `teddy-bear` | `switch` | `autoSoftenerStatus` | | Pause Washer Dryer | `pause` | `switch` | `pauseProgram` / `resumeProgram` | | Washer Dryer | `washing-machine` | `switch` | `startProgram` / `stopProgram` | +| Water hard | `water` | `number` | `settings.waterHard` | #### Configs | Name | Icon | Entity | Key | | --- | --- | --- | --- | | Acqua Plus | `water-plus` | `switch` | `startProgram.acquaplus` | -| Anti-Crease | `iron` | `switch` | `startProgram.antiCreaseTime` | | Anti-Crease | `iron` | `switch` | `startProgram.anticrease` | +| Anti-Crease | `iron` | `switch` | `startProgram.antiCreaseTime` | | Auto Dose Detergent | `cup` | `switch` | `startProgram.autoDetergentStatus` | | Auto Dose Softener | `teddy-bear` | `switch` | `startProgram.autoSoftenerStatus` | | Delay Status | `timer-check` | `switch` | `startProgram.delayStatus` | @@ -452,6 +456,7 @@ For every device exists a button under diagnostics which can be used to log all | Liquid Detergent Dose | `cup-water` | `sensor` | `startProgram.liquidDetergentDose` | | Main Wash Time | `clock-start` | `number` | `startProgram.mainWashTime` | | Powder Detergent Dose | `cup` | `sensor` | `startProgram.powderDetergentDose` | +| Prewash | `tshirt-crew` | `switch` | `startProgram.prewash` | | Program | | `select` | `startProgram.program` | | Remaining Time | `timer` | `sensor` | `startProgram.remainingTime` | | Rinse Iterations | `rotate-right` | `number` | `startProgram.rinseIterations` | @@ -459,12 +464,13 @@ For every device exists a button under diagnostics which can be used to log all | Spin speed | `numeric` | `select` | `startProgram.spinSpeed` | | Steam Type | `weather-dust` | `sensor` | `steamType` | | Steam level | `weather-dust` | `select` | `startProgram.steamLevel` | -| Sterilization | `clock-start` | `switch` | `startProgram.sterilizationStatus` | +| Sterilization | `lotion-plus` | `switch` | `startProgram.sterilizationStatus` | | Suggested Load | `weight-kilogram` | `sensor` | `startProgram.suggestedLoadW` | | Suggested Load | `weight-kilogram` | `sensor` | `startProgram.suggestedLoadD` | | Suggested weight | `weight-kilogram` | `sensor` | `startProgram.weight` | | Temperature | `thermometer` | `select` | `startProgram.temp` | | Temperature level | `thermometer` | `number` | `startProgram.tempLevel` | +| Tumbling | `refresh-circle` | `switch` | `startProgram.tumblingStatus` | | Water hard | `water` | `number` | `startProgram.waterHard` | | lang | | `number` | `startProgram.lang` | #### Sensors @@ -502,12 +508,16 @@ For every device exists a button under diagnostics which can be used to log all #### Controls | Name | Icon | Entity | Key | | --- | --- | --- | --- | +| Auto Dose Detergent | `cup` | `switch` | `autoDetergentStatus` | +| Auto Dose Softener | `teddy-bear` | `switch` | `autoSoftenerStatus` | | Pause Washing Machine | `pause` | `switch` | `pauseProgram` / `resumeProgram` | | Washing Machine | `washing-machine` | `switch` | `startProgram` / `stopProgram` | +| Water hard | `water` | `number` | `settings.waterHard` | #### Configs | Name | Icon | Entity | Key | | --- | --- | --- | --- | | Acqua Plus | `water-plus` | `switch` | `startProgram.acquaplus` | +| Anti-Crease | `iron` | `switch` | `startProgram.anticrease` | | Auto Dose Detergent | `cup` | `switch` | `startProgram.autoDetergentStatus` | | Auto Dose Softener | `teddy-bear` | `switch` | `startProgram.autoSoftenerStatus` | | Delay Status | `timer-check` | `switch` | `startProgram.delayStatus` | @@ -523,6 +533,7 @@ For every device exists a button under diagnostics which can be used to log all | Liquid Detergent Dose | `cup-water` | `sensor` | `startProgram.liquidDetergentDose` | | Main Wash Time | `clock-start` | `number` | `startProgram.mainWashTime` | | Powder Detergent Dose | `cup` | `sensor` | `startProgram.powderDetergentDose` | +| Prewash | `tshirt-crew` | `switch` | `startProgram.prewash` | | Program | | `select` | `startProgram.program` | | Remaining Time | `timer` | `sensor` | `startProgram.remainingTime` | | Rinse Iterations | `rotate-right` | `number` | `startProgram.rinseIterations` | diff --git a/custom_components/hon/climate.py b/custom_components/hon/climate.py index 5731462..9b02997 100644 --- a/custom_components/hon/climate.py +++ b/custom_components/hon/climate.py @@ -363,7 +363,13 @@ class HonClimateEntity(HonEntity, ClimateEntity): async def async_set_preset_mode(self, preset_mode: str) -> None: """Set the new preset mode.""" - command = "stopProgram" if preset_mode == "no_mode" else "startProgram" + if preset_mode == "no_mode" and HVACMode.OFF in self.hvac_modes: + command = "stopProgram" + elif preset_mode == "no_mode": + command = "settings" + self._device.commands["settings"].reset() + else: + command = "startProgram" if program := self._device.settings.get(f"{command}.program"): program.value = preset_mode zone = self._device.settings.get(f"{command}.zone") @@ -371,9 +377,9 @@ class HonClimateEntity(HonEntity, ClimateEntity): zone.value = self.entity_description.name.lower() self._device.sync_command(command, "settings") self._set_temperature_bound() + self._attr_preset_mode = preset_mode await self.coordinator.async_refresh() await self._device.commands[command].send() - self._attr_preset_mode = preset_mode self.async_write_ha_state() def _set_temperature_bound(self) -> None: diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index e2d96b7..f357735 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -57,6 +57,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", + ), HonConfigNumberEntityDescription( key="startProgram.lang", name="lang", diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index 37f3693..8c32ccd 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -63,6 +63,12 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { icon="mdi:tshirt-crew", translation_key="prewash", ), + HonConfigSwitchEntityDescription( + key="startProgram.prewash", + name="Prewash", + icon="mdi:tshirt-crew", + translation_key="prewash", + ), HonConfigSwitchEntityDescription( key="startProgram.permanentPressStatus", name="Keep Fresh", @@ -81,6 +87,18 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { icon="mdi:cup", translation_key="auto_dose_detergent", ), + HonSwitchEntityDescription( + key="autoSoftenerStatus", + name="Auto Dose Softener", + icon="mdi:teddy-bear", + translation_key="auto_dose_softener", + ), + HonSwitchEntityDescription( + key="autoDetergentStatus", + name="Auto Dose Detergent", + icon="mdi:cup", + translation_key="auto_dose_detergent", + ), HonConfigSwitchEntityDescription( key="startProgram.acquaplus", name="Acqua Plus", @@ -117,6 +135,12 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { icon="mdi:lotion-plus", translation_key="hygiene", ), + HonConfigSwitchEntityDescription( + key="startProgram.anticrease", + name="Anti-Crease", + icon="mdi:iron", + translation_key="anti_crease", + ), ), "TD": ( HonControlSwitchEntityDescription( @@ -138,7 +162,13 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { HonConfigSwitchEntityDescription( key="startProgram.sterilizationStatus", name="Sterilization", - icon="mdi:clock-start", + icon="mdi:lotion-plus", + ), + HonConfigSwitchEntityDescription( + key="startProgram.tumblingStatus", + name="Tumbling", + icon="mdi:refresh-circle", + translation_key="keep_fresh", ), HonConfigSwitchEntityDescription( key="startProgram.antiCreaseTime", @@ -370,10 +400,7 @@ async def async_setup_entry( continue entity = HonControlSwitchEntity(hass, entry, device, description) elif isinstance(description, HonSwitchEntityDescription): - if ( - f"settings.{description.key}" not in device.available_settings - or device.get(description.key) is None - ): + if f"settings.{description.key}" not in device.available_settings: continue entity = HonSwitchEntity(hass, entry, device, description) else: diff --git a/info.md b/info.md index 469ba83..e6411a4 100644 --- a/info.md +++ b/info.md @@ -28,19 +28,19 @@ _If the integration is not in the list, you need to clear the browser cache._ Support has been confirmed for these models, but many more will work. Please add already supported devices [with this form to complete the list](https://forms.gle/bTSD8qFotdZFytbf8). -| | **Haier** | **Hoover** | **Candy** | -|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| -| **Washing Machine** | HW80-B14959TU1DE
HW80-B14959TU1IT
HW80-B14979TU1
HW90-B14TEAM5
HW90G-BD14979UD
HW100-B14959U1
HW110-14979 | H-WASH 500
H7W4 48MBC-S
HLWPS495TAMBE-11
HW 410AMBCB/1-80
HWE 49AMBS/1-S | CO4 107T1/2-07
CBWO49TWME-S
RO14126DWMST-S
RO441286DWMC4-07
HW 68AMC/1-80
HWPD 69AMBC/1-S | -| **Tumble Dryer** | HD80-A3959
HD90-A3TEAM5
HD90-A2959 | H-DRY 500
H9A3TCBEXS-S
HLE C10DCE-80
H5WPB447AMBC/1-S
NDE H10A2TCE-80
NDE H9A2TSBEXS-S
NDPHY10A2TCBEXSS | BCTDH7A1TE
CSOE C10DE-80
ROE H9A3TCEX-S
ROE H10A2TCE-07 | -| **Washer Dryer** | HWD100-B14979
HWD100-B14978 | HD 485AMBB/1-S
HD 495AMC/1-S
HD 4106AMC/1-80
HDQ 496AMBS/1-S
HWPS4954DAMR-11 | RPW41066BWMR/1-S | -| **Oven** | HWO60SM2F3XH | HSOT3161WG | | -| **Dish Washer** | XIB 3B2SFS-80
XIB 6B2D3FB | HFB 6B2S3FX | | +| | **Haier** | **Hoover** | **Candy** | +|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| +| **Washing Machine** | HW80-B14959TU1DE
HW80-B14959TU1IT
HW80-B14979TU1
HW90-B14TEAM5
HW90G-BD14979UD
HW100-B14959U1
HW110-14979 | H-WASH 500
H7W4 48MBC-S
HLWPS495TAMBE-11
HW 410AMBCB/1-80
HWE 49AMBS/1-S | CO4 107T1/2-07
CBWO49TWME-S
RO14126DWMST-S
RO441286DWMC4-07
HW 68AMC/1-80
HWPD 69AMBC/1-S | +| **Tumble Dryer** | HD80-A3959
HD90-A3TEAM5
HD90-A2959 | H-DRY 500
H9A3TCBEXS-S
HLE C10DCE-80
H5WPB447AMBC/1-S
NDE H10A2TCE-80
NDE H9A2TSBEXS-S
NDPHY10A2TCBEXSS | BCTDH7A1TE
CSOE C10DE-80
ROE H9A3TCEX-S
ROE H10A2TCE-07 | +| **Washer Dryer** | HWD100-B14979
HWD100-B14978 | HD 485AMBB/1-S
HD 495AMC/1-S
HD 4106AMC/1-80
HDQ 496AMBS/1-S
HWPS4954DAMR-11 | RPW41066BWMR/1-S | +| **Oven** | HWO60SM2F3XH | HSOT3161WG | | +| **Dish Washer** | XIB 3B2SFS-80
XIB 6B2D3FB | HFB 6B2S3FX | | | **Air Conditioner** | AD105S2SM3FA
AS09TS4HRA-M
AS20HPL1HRA
AS25PBAHRA
AS25S2SF1FA-WH
AS25TADHRA-2
AS35PBAHRA
AS35S2SF1FA-WH
AS35S2SF2FA-3
AS35TADHRA-2
AS35TAMHRA-C
AS35TEDHRA(M1) | | CY-12TAIN | -| **Fridge** | HFW7720ENMB
HFW7819EWMP | | CCE4T620EWU | -| **Hob** | HA2MTSJ68MC | | CIS633SCTTWIFI | -| **Hood** | HADG6DS46BWIFI | | | -| **Wine Cellar** | HWS247FDU1 | | | -| **Air Purifier** | | HHP30C011
HHP50CA001
HHP50CA011 | | +| **Fridge** | HFW7720ENMB
HFW7819EWMP | | CCE4T620EWU | +| **Hob** | HA2MTSJ68MC | | CIS633SCTTWIFI | +| **Hood** | HADG6DS46BWIFI | | | +| **Wine Cellar** | HWS247FDU1 | | | +| **Air Purifier** | | HHP30C011
HHP50CA001
HHP50CA011 | | | Please add your appliances data to our [hon-test-data collection](https://github.com/Andre0512/hon-test-data).
This helps us to develop new features and not to break compatibility in newer versions. | |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| diff --git a/requirements_dev.txt b/requirements_dev.txt index 6b7cfce..ec208f6 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,5 @@ -black -flake8 -mypy -pylint +homeassistant~=2023.10.0b2 +black~=23.7.0 +flake8~=6.0.0 +mypy~=1.4.1 +pylint~=2.17.4