From 380cde5a71a0f2917b371c55d0c512fa2cde4b17 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 16 Apr 2023 23:35:43 +0200 Subject: [PATCH] List Appliance Features --- .gitignore | 2 +- README.md | 189 +++++++++++++++++++++++++++++++++++++++-- info.md | 14 ++- scripts/sensor_docs.py | 56 ++++++++++++ 4 files changed, 244 insertions(+), 17 deletions(-) create mode 100644 scripts/sensor_docs.py diff --git a/.gitignore b/.gitignore index 6024b17..1dcccdc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ __pycache__/ -test.py +scripts/test.py .idea/ diff --git a/README.md b/README.md index 5b19aee..c95b0b5 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,14 @@ ![GitHub](https://img.shields.io/github/license/Andre0512/hon?color=red) [![Home Assistant installs](https://img.shields.io/badge/dynamic/json?color=blue&label=usage&suffix=%20installs&cacheSeconds=15600&url=https://analytics.home-assistant.io/custom_integrations.json&query=$.hon.total)](https://analytics.home-assistant.io/) Home Assistant integration for Haier hOn: support for Haier/Candy/Hoover home appliances like washing machines. + ## Supported Appliances -- Washing Machine -- Tumble Dryer -- Washer Dryer -- Oven -- Hob -- Dish Washer +- [Washing Machine](https://github.com/Andre0512/hon#washing-machine) +- [Tumble Dryer](https://github.com/Andre0512/hon#tumble-dryer) +- [Washer Dryer](https://github.com/Andre0512/hon#washer-dryer) +- [Oven](https://github.com/Andre0512/hon#oven) +- [Hob](https://github.com/Andre0512/hon#hob) +- [Dish Washer](https://github.com/Andre0512/hon#dish-washer) ## Installation **Method 1:** [![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=Andre0512&repository=hon&category=integration) @@ -28,8 +29,6 @@ _Restart Home Assistant_ **Method 2**: Settings > Devices & Services > Add Integration > **Haier hOn** _If the integration is not in the list, you need to clear the browser cache._ - - ## Contribute Any kind of contribution is welcome! ### Read out device data @@ -104,3 +103,177 @@ For every device exists a hidden button which can be used to log all info of you The existing integrations missed some features from the app I liked to have in HomeAssistant. I tried to create a pull request, but in the structures of these existing repos, I find it hard to fit in my needs, so I basically rewrote everything. I moved the api related stuff into the package [pyhOn](https://github.com/Andre0512/pyhOn). + +## Appliance Features +### Dish washer +#### Controls +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Dish Washer | `mdi:dishwasher` | `switch` | `active` | +#### Configs +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Add Dish | `mdi:silverware-fork-knife` | `switch` | `startProgram.addDish` | +| Delay time | `mdi:timer-plus` | `number` | `startProgram.delayTime` | +| Eco Express | `mdi:sprout` | `switch` | `startProgram.ecoExpress` | +| Eco Index | `mdi:sprout` | `sensor` | `startProgram.ecoIndex` | +| Energy Label | `mdi:lightning-bolt-circle` | `sensor` | `startProgram.energyLabel` | +| Extra Dry | `mdi:hair-dryer` | `switch` | `startProgram.extraDry` | +| Half Load | `mdi:fraction-one-half` | `switch` | `startProgram.halfLoad` | +| Open Door | `mdi:door-open` | `switch` | `startProgram.openDoor` | +| Program | | `select` | `startProgram.program` | +| Temperature | `mdi:thermometer` | `sensor` | `startProgram.temp` | +| Three in One | `mdi:numeric-3-box-outline` | `switch` | `startProgram.threeInOne` | +| Time | `mdi:timer` | `sensor` | `startProgram.remainingTime` | +| Water Efficiency | `mdi:water` | `sensor` | `startProgram.waterEfficiency` | +| Water Saving | `mdi:water-percent` | `sensor` | `startProgram.waterSaving` | +| Water hard | `mdi:water` | `number` | `startProgram.waterHard` | +#### Sensors +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Connection | | `binary_sensor` | `attributes.lastConnEvent.category` | +| Door | | `binary_sensor` | `doorStatus` | +| Error | `mdi:math-log` | `sensor` | `errors` | +| Machine Status | `mdi:information` | `sensor` | `machMode` | +| Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` | +| Rinse Aid | `mdi:spray-bottle` | `binary_sensor` | `rinseAidStatus` | +| Salt | `mdi:shaker-outline` | `binary_sensor` | `saltStatus` | +### Hob +#### Controls +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Start Program | `mdi:pot-steam` | `button` | `startProgram` | +#### Configs +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Power Management | `mdi:timelapse` | `number` | `startProgram.powerManagement` | +| Program | | `select` | `startProgram.program` | +| Temperature | `mdi:thermometer` | `number` | `startProgram.temp` | +#### Sensors +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Connection | `mdi:wifi` | `binary_sensor` | `attributes.lastConnEvent.category` | +| Error | `mdi:math-log` | `sensor` | `errors` | +| Hob Lock | | `binary_sensor` | `hobLockStatus` | +| Hot Status | | `binary_sensor` | `hotStatus` | +| On | `mdi:power-cycle` | `binary_sensor` | `attributes.parameters.onOffStatus` | +| Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` | +| Remote Control | `mdi:remote` | `binary_sensor` | `attributes.parameters.remoteCtrValid` | +| Temperature | `mdi:thermometer` | `sensor` | `temp` | +### Oven +#### Controls +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Start Program | `mdi:power-cycle` | `button` | `startProgram` | +| Stop Program | `mdi:power-off` | `button` | `stopProgram` | +#### Configs +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Delay time | `mdi:timer-plus` | `number` | `startProgram.delayTime` | +| Preheat | | `select` | `startProgram.preheatStatus` | +| Program | | `select` | `startProgram.program` | +| Program Duration | `mdi:timelapse` | `number` | `startProgram.prTime` | +| Target Temperature | `mdi:thermometer` | `number` | `startProgram.tempSel` | +#### Sensors +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Connection | `mdi:wifi` | `binary_sensor` | `attributes.lastConnEvent.category` | +| On | `mdi:power-cycle` | `binary_sensor` | `attributes.parameters.onOffStatus` | +| Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` | +| Remote Control | `mdi:remote` | `binary_sensor` | `attributes.parameters.remoteCtrValid` | +| Start Time | `mdi:clock-start` | `sensor` | `delayTime` | +| Temperature | `mdi:thermometer` | `sensor` | `temp` | +| Temperature Selected | `mdi:thermometer` | `sensor` | `tempSel` | +### Tumble dryer +#### Controls +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Pause Tumble Dryer | `mdi:pause` | `switch` | `pause` | +| Tumble Dryer | `mdi:tumble-dryer` | `switch` | `active` | +#### Configs +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Anti-Crease time | `mdi:timer` | `number` | `startProgram.antiCreaseTime` | +| Delay time | `mdi:timer-plus` | `number` | `startProgram.delayTime` | +| Dry level | `mdi:hair-dryer` | `number` | `startProgram.dryLevel` | +| Program | | `select` | `startProgram.program` | +| Sterilization status | `mdi:clock-start` | `number` | `startProgram.sterilizationStatus` | +| Temperature level | `mdi:thermometer` | `number` | `startProgram.tempLevel` | +| Time | `mdi:timer` | `select` | `startProgram.dryTimeMM` | +#### Sensors +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Connection | | `binary_sensor` | `attributes.lastConnEvent.category` | +| Door | | `binary_sensor` | `doorStatus` | +| Dry level | `mdi:hair-dryer` | `sensor` | `dryLevel` | +| Error | `mdi:math-log` | `sensor` | `errors` | +| Machine Status | `mdi:information` | `sensor` | `machMode` | +| Program | `mdi:tumble-dryer` | `sensor` | `prCode` | +| Program Phase | `mdi:tumble-dryer` | `sensor` | `prPhase` | +| Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` | +| Start Time | `mdi:clock-start` | `sensor` | `delayTime` | +| Temperature level | `mdi:thermometer` | `sensor` | `tempLevel` | +### Washer dryer +#### Controls +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Pause Washing Machine | `mdi:pause` | `switch` | `pause` | +| Washing Machine | `mdi:washing-machine` | `switch` | `active` | +#### Configs +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Delay Time | `mdi:timer-plus` | `number` | `startProgram.delayTime` | +| Program | | `select` | `startProgram.program` | +#### Sensors +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Acqua Plus | | `binary_sensor` | `acquaplus` | +| Anti-Crease | | `binary_sensor` | `anticrease` | +| Current Program | `mdi:tumble-dryer` | `sensor` | `prCode` | +| Current Temperature | `mdi:thermometer` | `sensor` | `temp` | +| Dirt level | `mdi:liquid-spot` | `sensor` | `dirtyLevel` | +| Dry level | `mdi:hair-dryer` | `sensor` | `dryLevel` | +| Extra Rinse 1 | | `binary_sensor` | `extraRinse1` | +| Extra Rinse 2 | | `binary_sensor` | `extraRinse2` | +| Extra Rinse 3 | | `binary_sensor` | `extraRinse3` | +| Good Night Mode | | `binary_sensor` | `goodNight` | +| Machine Status | `mdi:information` | `sensor` | `machMode` | +| Pre Wash | | `binary_sensor` | `startProgram.prewash` | +| Program Phase | `mdi:tumble-dryer` | `sensor` | `prPhase` | +| Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` | +| Remote Control | `mdi:remote` | `binary_sensor` | `attributes.lastConnEvent.category` | +| Spin Speed | `mdi:fast-forward-outline` | `sensor` | `spinSpeed` | +| Steam level | `mdi:smoke` | `sensor` | `steamLevel` | +### Washing machine +#### Controls +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Pause Washing Machine | `mdi:pause` | `switch` | `pause` | +| Washing Machine | `mdi:washing-machine` | `switch` | `active` | +#### Configs +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Delay Status | `mdi:timer-check` | `switch` | `startProgram.delayStatus` | +| Delay Time | `mdi:timer-plus` | `number` | `startProgram.delayTime` | +| Main Wash Time | `mdi:clock-start` | `number` | `startProgram.mainWashTime` | +| Program | | `select` | `startProgram.program` | +| Rinse Iterations | `mdi:rotate-right` | `number` | `startProgram.rinseIterations` | +| Soak Prewash Selection | `mdi:tshirt-crew` | `switch` | `startProgram.haier_SoakPrewashSelection` | +| Spin speed | `mdi:numeric` | `select` | `startProgram.spinSpeed` | +| Suggested weight | `mdi:weight-kilogram` | `sensor` | `startProgram.weight` | +| Temperature | `mdi:thermometer` | `select` | `startProgram.temp` | +#### Sensors +| Name | Icon | Entity | Key | +| --- | --- | --- | --- | +| Current Electricity Used | `mdi:lightning-bolt` | `sensor` | `currentElectricityUsed` | +| Current Water Used | `mdi:water` | `sensor` | `currentWaterUsed` | +| Door | | `binary_sensor` | `doorStatus` | +| Door Lock | | `binary_sensor` | `doorLockStatus` | +| Error | `mdi:math-log` | `sensor` | `errors` | +| Machine Status | `mdi:information` | `sensor` | `machMode` | +| Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` | +| Remote Control | `mdi:remote` | `binary_sensor` | `attributes.lastConnEvent.category` | +| Spin Speed | `mdi:speedometer` | `sensor` | `spinSpeed` | +| Total Power | | `sensor` | `totalElectricityUsed` | +| Total Wash Cycle | `mdi:counter` | `sensor` | `totalWashCycle` | +| Total Water | | `sensor` | `totalWaterUsed` | diff --git a/info.md b/info.md index a35b040..d6073f1 100644 --- a/info.md +++ b/info.md @@ -5,11 +5,12 @@ Support for home appliances of Haier's mobile app hOn. ## Supported Appliances -- Tumble Dryer -- Washer Dryer -- Washing Machine -- Oven -- Hob +- [Washing Machine](https://github.com/Andre0512/hon#washing-machine) +- [Tumble Dryer](https://github.com/Andre0512/hon#tumble-dryer) +- [Washer Dryer](https://github.com/Andre0512/hon#washer-dryer) +- [Oven](https://github.com/Andre0512/hon#oven) +- [Hob](https://github.com/Andre0512/hon#hob) +- [Dish Washer](https://github.com/Andre0512/hon#dish-washer) ## Tested Appliances - Haier WD90-B14TEAM5 @@ -17,7 +18,6 @@ Support for home appliances of Haier's mobile app hOn. - Haier HWO60SM2F3XH - Hoover H-WASH 500 - ## Configuration **Method 1**: [![Open your Home Assistant instance and start setting up a new integration.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=hon) @@ -25,13 +25,11 @@ Support for home appliances of Haier's mobile app hOn. **Method 2**: Settings > Devices & Services > Add Integration > **Haier hOn** _If the integration is not in the list, you need to clear the browser cache._ - ## Contribute Want to help us to support more appliances? Or add more sensors? Or help with translating? Or beautify some icons or captions? Check out the [project on GitHub](https://github.com/Andre0512/hon), every contribution is welcome! ## Useful Links - * [GitHub repository](https://github.com/Andre0512/hon) (please add a star if you like this integration!) * [pyhOn library](https://github.com/Andre0512/pyhOn) * [Release notes](https://github.com/Andre0512/hon/releases) diff --git a/scripts/sensor_docs.py b/scripts/sensor_docs.py new file mode 100644 index 0000000..ab54f2d --- /dev/null +++ b/scripts/sensor_docs.py @@ -0,0 +1,56 @@ +from custom_components.hon.binary_sensor import BINARY_SENSORS +from custom_components.hon.button import BUTTONS +from custom_components.hon.number import NUMBERS +from custom_components.hon.select import SELECTS +from custom_components.hon.sensor import SENSORS +from custom_components.hon.switch import SWITCHES + +APPLIANCES = { + "AC": "Air conditioner", + "AP": "Air purifier", + "AS": "Air scanner", + "DW": "Dish washer", + "HO": "Hood", + "IH": "Hob", + "MW": "Microwave", + "OV": "Oven", + "REF": "Fridge", + "RVC": "Robot vacuum cleaner", + "TD": "Tumble dryer", + "WC": "Wine Cellar", + "WD": "Washer dryer", + "WH": "Water Heater", + "WM": "Washing machine", +} + +ENTITY_CATEGORY_SORT = ["control", "config", "sensor"] + +entities = { + "binary_sensor": BINARY_SENSORS, + "button": BUTTONS, + "number": NUMBERS, + "select": SELECTS, + "sensor": SENSORS, + "switch": SWITCHES, +} + +result = {} +for entity_type, appliances in entities.items(): + for appliance, data in appliances.items(): + for entity in data: + attributes = (entity.key, entity.name, entity.icon, entity_type) + category = "control" if entity_type in ["switch", "button"] else "sensor" + result.setdefault(appliance, {}).setdefault( + entity.entity_category or category, [] + ).append(attributes) + +for appliance, categories in sorted(result.items()): + print(f"### {APPLIANCES[appliance]}") + categories = {k: categories[k] for k in ENTITY_CATEGORY_SORT if k in categories} + for category, data in categories.items(): + print(f"#### {str(category).capitalize()}s") + print("| Name | Icon | Entity | Key |") + print("| --- | --- | --- | --- |") + for key, name, icon, entity_type in sorted(data, key=lambda d: d[1]): + icon = f"`{icon}`" if icon else "" + print(f"| {name} | {icon} | `{entity_type}` | `{key}` |")