Compare commits

...

6 Commits

Author SHA1 Message Date
Andre Basche 72c83527d5 Bump version to v0.6.0 2023-04-19 17:47:05 +02:00
Andre Basche 75622e18a2 Bump version, update readme 2023-04-18 23:50:27 +02:00
Andre Basche a2d0257410 Add more sensors for #22 2023-04-18 23:50:14 +02:00
Andre Basche e2c7ca36db Merge pull request #23 from cylonbrain/main
Added WashingMachine sonsors to WashDryer as well
2023-04-18 12:52:54 +02:00
Andy Breuhan b33b6a40b2 Added WashingMachine sonsors to WashDryer as well
In addition to that the currentElectricityUsed is measured in kWh because it just counts the kWh for the current cycle
2023-04-18 12:47:25 +02:00
Andre Basche 75859543aa Improve entity documentation 2023-04-17 23:18:27 +02:00
6 changed files with 111 additions and 22 deletions
+26 -9
View File
@@ -1,8 +1,8 @@
# Haier hOn # Haier hOn
[![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg)](https://hacs.xyz) [![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg)](https://hacs.xyz)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/Andre0512/hon?color=green)](https://github.com/Andre0512/hon/releases/latest) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/Andre0512/hon?color=green)](https://github.com/Andre0512/hon/releases/latest)
![GitHub](https://img.shields.io/github/license/Andre0512/hon?color=red) [![GitHub](https://img.shields.io/github/license/Andre0512/hon?color=red)](https://github.com/Andre0512/hon/blob/main/LICENSE)
[![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/) [![GitHub all releases](https://img.shields.io/github/downloads/Andre0512/hon/total?color=blue)](https://tooomm.github.io/github-release-stats/?username=Andre0512&repository=hon)
Home Assistant integration for Haier hOn: support for Haier/Candy/Hoover home appliances like washing machines. Home Assistant integration for Haier hOn: support for Haier/Candy/Hoover home appliances like washing machines.
## Supported Appliances ## Supported Appliances
@@ -98,6 +98,9 @@ For every device exists a hidden button which can be used to log all info of you
- Haier HD80-A3959 - Haier HD80-A3959
- Haier HWO60SM2F3XH - Haier HWO60SM2F3XH
- Hoover H-WASH 500 - Hoover H-WASH 500
- Candy CIS633SCTTWIFI
- Haier XIB 3B2SFS-80
- Haier XIB 6B2D3FB
## About this Repo ## About this Repo
The existing integrations missed some features from the app I liked to have in HomeAssistant. The existing integrations missed some features from the app I liked to have in HomeAssistant.
@@ -105,11 +108,12 @@ I tried to create a pull request, but in the structures of these existing repos,
I moved the api related stuff into the package [pyhOn](https://github.com/Andre0512/pyhOn). I moved the api related stuff into the package [pyhOn](https://github.com/Andre0512/pyhOn).
## Appliance Features ## Appliance Features
### Dish washer ### Dish washer
#### Controls #### Controls
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Dish Washer | `mdi:dishwasher` | `switch` | `active` | | Dish Washer | `mdi:dishwasher` | `switch` | `startProgram` / `stopProgram` |
#### Configs #### Configs
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@@ -138,6 +142,7 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
| Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` | | Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` |
| Rinse Aid | `mdi:spray-bottle` | `binary_sensor` | `rinseAidStatus` | | Rinse Aid | `mdi:spray-bottle` | `binary_sensor` | `rinseAidStatus` |
| Salt | `mdi:shaker-outline` | `binary_sensor` | `saltStatus` | | Salt | `mdi:shaker-outline` | `binary_sensor` | `saltStatus` |
### Hob ### Hob
#### Controls #### Controls
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
@@ -157,9 +162,12 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
| Hob Lock | | `binary_sensor` | `hobLockStatus` | | Hob Lock | | `binary_sensor` | `hobLockStatus` |
| Hot Status | | `binary_sensor` | `hotStatus` | | Hot Status | | `binary_sensor` | `hotStatus` |
| On | `mdi:power-cycle` | `binary_sensor` | `attributes.parameters.onOffStatus` | | On | `mdi:power-cycle` | `binary_sensor` | `attributes.parameters.onOffStatus` |
| Pan Status | `mdi:pot-mix` | `binary_sensor` | `panStatus` |
| Power | `mdi:lightning-bolt` | `sensor` | `power` |
| Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` | | Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` |
| Remote Control | `mdi:remote` | `binary_sensor` | `attributes.parameters.remoteCtrValid` | | Remote Control | `mdi:remote` | `binary_sensor` | `attributes.parameters.remoteCtrValid` |
| Temperature | `mdi:thermometer` | `sensor` | `temp` | | Temperature | `mdi:thermometer` | `sensor` | `temp` |
### Oven ### Oven
#### Controls #### Controls
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
@@ -184,12 +192,13 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
| Start Time | `mdi:clock-start` | `sensor` | `delayTime` | | Start Time | `mdi:clock-start` | `sensor` | `delayTime` |
| Temperature | `mdi:thermometer` | `sensor` | `temp` | | Temperature | `mdi:thermometer` | `sensor` | `temp` |
| Temperature Selected | `mdi:thermometer` | `sensor` | `tempSel` | | Temperature Selected | `mdi:thermometer` | `sensor` | `tempSel` |
### Tumble dryer ### Tumble dryer
#### Controls #### Controls
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Pause Tumble Dryer | `mdi:pause` | `switch` | `pause` | | Pause Tumble Dryer | `mdi:pause` | `switch` | `pauseProgram` / `resumeProgram` |
| Tumble Dryer | `mdi:tumble-dryer` | `switch` | `active` | | Tumble Dryer | `mdi:tumble-dryer` | `switch` | `startProgram` / `stopProgram` |
#### Configs #### Configs
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
@@ -213,24 +222,28 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
| Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` | | Remaining Time | `mdi:timer` | `sensor` | `remainingTimeMM` |
| Start Time | `mdi:clock-start` | `sensor` | `delayTime` | | Start Time | `mdi:clock-start` | `sensor` | `delayTime` |
| Temperature level | `mdi:thermometer` | `sensor` | `tempLevel` | | Temperature level | `mdi:thermometer` | `sensor` | `tempLevel` |
### Washer dryer ### Washer dryer
#### Controls #### Controls
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Pause Washing Machine | `mdi:pause` | `switch` | `pause` | | Pause Washing Machine | `mdi:pause` | `switch` | `pauseProgram` / `resumeProgram` |
| Washing Machine | `mdi:washing-machine` | `switch` | `active` | | Washing Machine | `mdi:washing-machine` | `switch` | `startProgram` / `stopProgram` |
#### Configs #### Configs
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Delay Time | `mdi:timer-plus` | `number` | `startProgram.delayTime` | | Delay Time | `mdi:timer-plus` | `number` | `startProgram.delayTime` |
| Program | | `select` | `startProgram.program` | | Program | | `select` | `startProgram.program` |
| Suggested weight | `mdi:weight-kilogram` | `sensor` | `startProgram.weight` |
#### Sensors #### Sensors
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Acqua Plus | | `binary_sensor` | `acquaplus` | | Acqua Plus | | `binary_sensor` | `acquaplus` |
| Anti-Crease | | `binary_sensor` | `anticrease` | | Anti-Crease | | `binary_sensor` | `anticrease` |
| Current Electricity Used | `mdi:lightning-bolt` | `sensor` | `currentElectricityUsed` |
| Current Program | `mdi:tumble-dryer` | `sensor` | `prCode` | | Current Program | `mdi:tumble-dryer` | `sensor` | `prCode` |
| Current Temperature | `mdi:thermometer` | `sensor` | `temp` | | Current Temperature | `mdi:thermometer` | `sensor` | `temp` |
| Current Water Used | `mdi:water` | `sensor` | `currentWaterUsed` |
| Dirt level | `mdi:liquid-spot` | `sensor` | `dirtyLevel` | | Dirt level | `mdi:liquid-spot` | `sensor` | `dirtyLevel` |
| Dry level | `mdi:hair-dryer` | `sensor` | `dryLevel` | | Dry level | `mdi:hair-dryer` | `sensor` | `dryLevel` |
| Extra Rinse 1 | | `binary_sensor` | `extraRinse1` | | Extra Rinse 1 | | `binary_sensor` | `extraRinse1` |
@@ -244,12 +257,16 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
| Remote Control | `mdi:remote` | `binary_sensor` | `attributes.lastConnEvent.category` | | Remote Control | `mdi:remote` | `binary_sensor` | `attributes.lastConnEvent.category` |
| Spin Speed | `mdi:fast-forward-outline` | `sensor` | `spinSpeed` | | Spin Speed | `mdi:fast-forward-outline` | `sensor` | `spinSpeed` |
| Steam level | `mdi:smoke` | `sensor` | `steamLevel` | | Steam level | `mdi:smoke` | `sensor` | `steamLevel` |
| Total Power | | `sensor` | `totalElectricityUsed` |
| Total Wash Cycle | `mdi:counter` | `sensor` | `totalWashCycle` |
| Total Water | | `sensor` | `totalWaterUsed` |
### Washing machine ### Washing machine
#### Controls #### Controls
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Pause Washing Machine | `mdi:pause` | `switch` | `pause` | | Pause Washing Machine | `mdi:pause` | `switch` | `pauseProgram` / `resumeProgram` |
| Washing Machine | `mdi:washing-machine` | `switch` | `active` | | Washing Machine | `mdi:washing-machine` | `switch` | `startProgram` / `stopProgram` |
#### Configs #### Configs
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
+3
View File
@@ -152,6 +152,9 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
device_class=BinarySensorDeviceClass.HEAT, device_class=BinarySensorDeviceClass.HEAT,
on_value="1", on_value="1",
), ),
HonBinarySensorEntityDescription(
key="panStatus", name="Pan Status", on_value="1", icon="mdi:pot-mix"
),
HonBinarySensorEntityDescription( HonBinarySensorEntityDescription(
key="hobLockStatus", key="hobLockStatus",
name="Hob Lock", name="Hob Lock",
+2 -2
View File
@@ -6,6 +6,6 @@
"documentation": "https://github.com/Andre0512/hon/", "documentation": "https://github.com/Andre0512/hon/",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Andre0512/hon/issues", "issue_tracker": "https://github.com/Andre0512/hon/issues",
"requirements": ["pyhOn==0.8.0b7"], "requirements": ["pyhOn==0.8.0"],
"version": "0.6.0-beta.7" "version": "0.6.0"
} }
+49 -1
View File
@@ -55,7 +55,7 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
name="Current Electricity Used", name="Current Electricity Used",
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.POWER, device_class=SensorDeviceClass.POWER,
native_unit_of_measurement=UnitOfPower.KILO_WATT, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
icon="mdi:lightning-bolt", icon="mdi:lightning-bolt",
), ),
SensorEntityDescription( SensorEntityDescription(
@@ -146,6 +146,48 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
), ),
), ),
"WD": ( "WD": (
SensorEntityDescription(
key="totalElectricityUsed",
name="Total Power",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
),
SensorEntityDescription(
key="totalWaterUsed",
name="Total Water",
device_class=SensorDeviceClass.WATER,
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=UnitOfVolume.LITERS,
),
SensorEntityDescription(
key="totalWashCycle",
name="Total Wash Cycle",
state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:counter",
),
SensorEntityDescription(
key="currentElectricityUsed",
name="Current Electricity Used",
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.POWER,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
icon="mdi:lightning-bolt",
),
SensorEntityDescription(
key="currentWaterUsed",
name="Current Water Used",
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:water",
),
SensorEntityDescription(
key="startProgram.weight",
name="Suggested weight",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.CONFIG,
native_unit_of_measurement=UnitOfMass.KILOGRAMS,
icon="mdi:weight-kilogram",
),
SensorEntityDescription( SensorEntityDescription(
key="machMode", key="machMode",
name="Machine Status", name="Machine Status",
@@ -237,6 +279,12 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
), ),
SensorEntityDescription(key="errors", name="Error", icon="mdi:math-log"), SensorEntityDescription(key="errors", name="Error", icon="mdi:math-log"),
SensorEntityDescription(
key="power",
name="Power",
icon="mdi:lightning-bolt",
state_class=SensorStateClass.MEASUREMENT,
),
), ),
"DW": ( "DW": (
SensorEntityDescription( SensorEntityDescription(
+2 -2
View File
@@ -1,7 +1,7 @@
# Haier hOn # Haier hOn
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/Andre0512/hon?color=green)](https://github.com/Andre0512/hon/releases/latest) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/Andre0512/hon?color=green)](https://github.com/Andre0512/hon/releases/latest)
![GitHub](https://img.shields.io/github/license/Andre0512/hon?color=red) [![GitHub](https://img.shields.io/github/license/Andre0512/hon?color=red)](https://github.com/Andre0512/hon/blob/main/LICENSE)
[![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/) [![GitHub all releases](https://img.shields.io/github/downloads/Andre0512/hon/total?color=blue)](https://tooomm.github.io/github-release-stats/?username=Andre0512&repository=hon)
Support for home appliances of Haier's mobile app hOn. Support for home appliances of Haier's mobile app hOn.
## Supported Appliances ## Supported Appliances
Regular → Executable
+29 -8
View File
@@ -1,9 +1,12 @@
import re
from pathlib import Path
from custom_components.hon.binary_sensor import BINARY_SENSORS from custom_components.hon.binary_sensor import BINARY_SENSORS
from custom_components.hon.button import BUTTONS from custom_components.hon.button import BUTTONS
from custom_components.hon.number import NUMBERS from custom_components.hon.number import NUMBERS
from custom_components.hon.select import SELECTS from custom_components.hon.select import SELECTS
from custom_components.hon.sensor import SENSORS from custom_components.hon.sensor import SENSORS
from custom_components.hon.switch import SWITCHES from custom_components.hon.switch import SWITCHES, HonSwitchEntityDescription
APPLIANCES = { APPLIANCES = {
"AC": "Air conditioner", "AC": "Air conditioner",
@@ -38,19 +41,37 @@ result = {}
for entity_type, appliances in entities.items(): for entity_type, appliances in entities.items():
for appliance, data in appliances.items(): for appliance, data in appliances.items():
for entity in data: for entity in data:
attributes = (entity.key, entity.name, entity.icon, entity_type) if (
isinstance(entity, HonSwitchEntityDescription)
and entity.entity_category != "config"
):
key = f"{entity.turn_on_key}` / `{entity.turn_off_key}"
else:
key = entity.key
attributes = (key, entity.name, entity.icon, entity_type)
category = "control" if entity_type in ["switch", "button"] else "sensor" category = "control" if entity_type in ["switch", "button"] else "sensor"
result.setdefault(appliance, {}).setdefault( result.setdefault(appliance, {}).setdefault(
entity.entity_category or category, [] entity.entity_category or category, []
).append(attributes) ).append(attributes)
text = ""
for appliance, categories in sorted(result.items()): for appliance, categories in sorted(result.items()):
print(f"### {APPLIANCES[appliance]}") text += f"\n### {APPLIANCES[appliance]}\n"
categories = {k: categories[k] for k in ENTITY_CATEGORY_SORT if k in categories} categories = {k: categories[k] for k in ENTITY_CATEGORY_SORT if k in categories}
for category, data in categories.items(): for category, data in categories.items():
print(f"#### {str(category).capitalize()}s") text += f"#### {str(category).capitalize()}s\n"
print("| Name | Icon | Entity | Key |") text += "| Name | Icon | Entity | Key |\n"
print("| --- | --- | --- | --- |") text += "| --- | --- | --- | --- |\n"
for key, name, icon, entity_type in sorted(data, key=lambda d: d[1]): for key, name, icon, entity_type in sorted(data, key=lambda d: d[1]):
icon = f"`{icon}`" if icon else "" icon = f"`{icon}`" if icon else ""
print(f"| {name} | {icon} | `{entity_type}` | `{key}` |") text += f"| {name} | {icon} | `{entity_type}` | `{key}` |\n"
with open(Path(__file__).parent.parent / "README.md", "r") as file:
readme = file.read()
readme = re.sub(
"(## Appliance Features\n)(?:.|\\s)+?([^#]## |\\Z)",
f"\\1{text}\\2",
readme,
re.DOTALL,
)
with open(Path(__file__).parent.parent / "README.md", "w") as file:
file.write(readme)