Compare commits

..

3 Commits

Author SHA1 Message Date
74f5887bb2 Bump pyhon to fix #36 2023-05-07 17:42:28 +02:00
155b1ff91a Add all wm and td sensors to wd 2023-05-07 16:39:45 +02:00
7b80acb6b9 Update readme 2023-05-07 15:10:09 +02:00
10 changed files with 156 additions and 225 deletions

122
README.md
View File

@ -30,6 +30,39 @@ _Restart Home Assistant_
**Method 2**: Settings > Devices & Services > Add Integration > **Haier 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._ _If the integration is not in the list, you need to clear the browser cache._
## Supported Models
Support was confirmed for these models. If a supported model is missing, please [add it with this form](https://forms.gle/bTSD8qFotdZFytbf8).
- Haier WD90-B14TEAM5
- Haier HD80-A3959
- Haier HWO60SM2F3XH
- Hoover H-WASH 500
- Candy CIS633SCTTWIFI
- Haier XIB 3B2SFS-80
- Haier XIB 6B2D3FB
## Supported Languages
Translation of internal names like programs are available for all languages which are official supported by the hOn app:
* 🇨🇳 Chinese
* 🇭🇷 Croatian
* 🇨🇿 Czech
* 🇳🇱 Dutch
* 🇬🇧 English
* 🇫🇷 French
* 🇩🇪 German
* 🇬🇷 Greek
* 🇮🇱 Hebrew
* 🇮🇹 Italian
* 🇵🇱 Polish
* 🇵🇹 Portuguese
* 🇷🇴 Romanian
* 🇷🇺 Russian
* 🇷🇸 Serbian
* 🇸🇰 Slovak
* 🇸🇮 Slovenian
* 🇪🇸 Spanish
* 🇹🇷 Turkish
## Contribute ## Contribute
Any kind of contribution is welcome! Any kind of contribution is welcome!
### Read out device data ### Read out device data
@ -94,38 +127,6 @@ For every device exists a hidden button which can be used to log all info of you
- If you need to implement some more logic, create a pull request to the underlying library. There we collect special requirements in the `appliances` directory. - If you need to implement some more logic, create a pull request to the underlying library. There we collect special requirements in the `appliances` directory.
- Use [pyhOn's translate command](https://github.com/Andre0512/pyhOn#translation) to read out the official translations - Use [pyhOn's translate command](https://github.com/Andre0512/pyhOn#translation) to read out the official translations
## Tested Devices
- Haier WD90-B14TEAM5
- Haier HD80-A3959
- Haier HWO60SM2F3XH
- Hoover H-WASH 500
- Candy CIS633SCTTWIFI
- Haier XIB 3B2SFS-80
- Haier XIB 6B2D3FB
## Supported Languages
Translation of internal names like programs are available for all languages which are official supported by the hOn app:
* 🇨🇳 Chinese
* 🇭🇷 Croatian
* 🇨🇿 Czech
* 🇳🇱 Dutch
* 🇬🇧 English
* 🇫🇷 French
* 🇩🇪 German
* 🇬🇷 Greek
* 🇮🇱 Hebrew
* 🇮🇹 Italian
* 🇵🇱 Polish
* 🇵🇹 Portuguese
* 🇷🇴 Romanian
* 🇷🇺 Russian
* 🇷🇸 Serbian
* 🇸🇰 Slovak
* 🇸🇮 Slovenian
* 🇪🇸 Spanish
* 🇹🇷 Turkish
## 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.
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 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.
@ -253,58 +254,95 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
| Energy Label | `lightning-bolt-circle` | `sensor` | `startProgram.energyLabel` | | Energy Label | `lightning-bolt-circle` | `sensor` | `startProgram.energyLabel` |
| Program | | `select` | `startProgram.program` | | Program | | `select` | `startProgram.program` |
| Steam Type | `weather-dust` | `sensor` | `steamType` | | Steam Type | `weather-dust` | `sensor` | `steamType` |
| Steam level | `smoke` | `sensor` | `steamLevel` | | Steam level | `smoke` | `sensor` | `startProgram.steamLevel` |
| Sterilization | `clock-start` | `switch` | `startProgram.sterilizationStatus` | | Sterilization | `clock-start` | `switch` | `startProgram.sterilizationStatus` |
| Suggested Load | `weight-kilogram` | `sensor` | `startProgram.suggestedLoadD` | | Suggested Load | `weight-kilogram` | `sensor` | `startProgram.suggestedLoadD` |
| Temperature level | `thermometer` | `number` | `startProgram.tempLevel` | | Temperature level | `thermometer` | `number` | `startProgram.tempLevel` |
#### Sensors #### Sensors
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Anti-Crease | | `binary_sensor` | `anticrease` |
| Connection | | `binary_sensor` | `attributes.lastConnEvent.category` | | Connection | | `binary_sensor` | `attributes.lastConnEvent.category` |
| Door | | `binary_sensor` | `doorStatus` | | Door | | `binary_sensor` | `doorStatus` |
| Dry level | `hair-dryer` | `sensor` | `dryLevel` | | Dry level | `hair-dryer` | `sensor` | `dryLevel` |
| Error | `math-log` | `sensor` | `errors` | | Error | `math-log` | `sensor` | `errors` |
| Machine Status | `information` | `sensor` | `machMode` | | Machine Status | `information` | `sensor` | `machMode` |
| Program | `tumble-dryer` | `sensor` | `prCode` | | Program | `tumble-dryer` | `sensor` | `programName` |
| Program Phase | `washing-machine` | `sensor` | `prPhase` | | Program Phase | `washing-machine` | `sensor` | `prPhase` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` | | Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Start Time | `clock-start` | `sensor` | `delayTime` | | Start Time | `clock-start` | `sensor` | `delayTime` |
| Steam level | `smoke` | `sensor` | `steamLevel` |
| Temperature level | `thermometer` | `sensor` | `tempLevel` | | Temperature level | `thermometer` | `sensor` | `tempLevel` |
### Washer dryer ### Washer dryer
#### Controls #### Controls
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Pause Washing Machine | `pause` | `switch` | `pauseProgram` / `resumeProgram` | | Pause Washer Dryer | `pause` | `switch` | `pauseProgram` / `resumeProgram` |
| Washing Machine | `washing-machine` | `switch` | `startProgram` / `stopProgram` | | Washer Dryer | `washing-machine` | `switch` | `startProgram` / `stopProgram` |
#### Configs #### Configs
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Acqua Plus | `water-plus` | `switch` | `startProgram.acquaplus` |
| Anti-Crease | `timer` | `switch` | `startProgram.antiCreaseTime` |
| Anti-Crease | `timer` | `switch` | `startProgram.anticrease` |
| Auto Dose | `cup` | `switch` | `startProgram.autoDetergentStatus` |
| Delay Status | `timer-check` | `switch` | `startProgram.delayStatus` |
| Delay Time | `timer-plus` | `number` | `startProgram.delayTime` | | Delay Time | `timer-plus` | `number` | `startProgram.delayTime` |
| Dry Time | | `number` | `startProgram.dryTime` |
| Dry Time | `timer` | `select` | `startProgram.dryTimeMM` |
| Dry level | `hair-dryer` | `select` | `startProgram.dryLevel` |
| Energy Label | `lightning-bolt-circle` | `sensor` | `startProgram.energyLabel` |
| Extra Rinse 1 | `numeric-1-box-multiple-outline` | `switch` | `extraRinse1` |
| Extra Rinse 2 | `numeric-2-box-multiple-outline` | `switch` | `extraRinse2` |
| Extra Rinse 3 | `numeric-3-box-multiple-outline` | `switch` | `extraRinse3` |
| Good Night | `weather-night` | `switch` | `goodNight` |
| Keep Fresh | `refresh-circle` | `switch` | `startProgram.autoSoftenerStatus` |
| Liquid Detergent Dose | `cup-water` | `sensor` | `startProgram.liquidDetergentDose` |
| Main Wash Time | `clock-start` | `number` | `startProgram.mainWashTime` |
| Powder Detergent Dose | `cup` | `sensor` | `startProgram.powderDetergentDose` |
| Program | | `select` | `startProgram.program` | | Program | | `select` | `startProgram.program` |
| Remaining Time | `timer` | `sensor` | `startProgram.remainingTime` |
| Rinse Iterations | `rotate-right` | `number` | `startProgram.rinseIterations` |
| Soak Prewash Selection | `tshirt-crew` | `switch` | `startProgram.haier_SoakPrewashSelection` |
| Spin speed | `numeric` | `select` | `startProgram.spinSpeed` |
| Steam Level | `weather-dust` | `number` | `startProgram.steamLevel` |
| Steam Type | `weather-dust` | `sensor` | `steamType` |
| Steam level | `smoke` | `sensor` | `startProgram.steamLevel` |
| Sterilization | `clock-start` | `switch` | `startProgram.sterilizationStatus` |
| Suggested Load | `weight-kilogram` | `sensor` | `startProgram.suggestedLoadW` |
| Suggested Load | `weight-kilogram` | `sensor` | `startProgram.suggestedLoadD` |
| Suggested weight | `weight-kilogram` | `sensor` | `startProgram.weight` | | Suggested weight | `weight-kilogram` | `sensor` | `startProgram.weight` |
| Temperature | `thermometer` | `select` | `startProgram.temp` |
| Temperature level | `thermometer` | `number` | `startProgram.tempLevel` |
| Water hard | `water` | `number` | `startProgram.waterHard` |
| lang | | `number` | `startProgram.lang` |
#### 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 | `lightning-bolt` | `sensor` | `currentElectricityUsed` | | Current Electricity Used | `lightning-bolt` | `sensor` | `currentElectricityUsed` |
| Current Program | `tumble-dryer` | `sensor` | `prCode` |
| Current Temperature | `thermometer` | `sensor` | `temp` |
| Current Water Used | `water` | `sensor` | `currentWaterUsed` | | Current Water Used | `water` | `sensor` | `currentWaterUsed` |
| Dirt level | `liquid-spot` | `sensor` | `dirtyLevel` | | Dirt level | `liquid-spot` | `sensor` | `dirtyLevel` |
| Door | | `binary_sensor` | `doorStatus` |
| Door Lock | | `binary_sensor` | `doorLockStatus` |
| Dry level | `hair-dryer` | `sensor` | `dryLevel` | | Dry level | `hair-dryer` | `sensor` | `dryLevel` |
| Error | `math-log` | `sensor` | `errors` |
| Extra Rinse 1 | | `binary_sensor` | `extraRinse1` | | Extra Rinse 1 | | `binary_sensor` | `extraRinse1` |
| Extra Rinse 2 | | `binary_sensor` | `extraRinse2` | | Extra Rinse 2 | | `binary_sensor` | `extraRinse2` |
| Extra Rinse 3 | | `binary_sensor` | `extraRinse3` | | Extra Rinse 3 | | `binary_sensor` | `extraRinse3` |
| Good Night Mode | | `binary_sensor` | `goodNight` | | Good Night Mode | | `binary_sensor` | `goodNight` |
| Machine Status | `information` | `sensor` | `machMode` | | Machine Status | `information` | `sensor` | `machMode` |
| Pre Wash | | `binary_sensor` | `startProgram.prewash` | | Pre Wash | | `binary_sensor` | `startProgram.prewash` |
| Program | `tumble-dryer` | `sensor` | `programName` |
| Program Phase | `washing-machine` | `sensor` | `prPhase` | | Program Phase | `washing-machine` | `sensor` | `prPhase` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` | | Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Remote Control | `remote` | `binary_sensor` | `attributes.lastConnEvent.category` | | Remote Control | `remote` | `binary_sensor` | `attributes.lastConnEvent.category` |
| Spin Speed | `fast-forward-outline` | `sensor` | `spinSpeed` | | Spin Speed | `speedometer` | `sensor` | `spinSpeed` |
| Start Time | `clock-start` | `sensor` | `delayTime` |
| Steam level | `smoke` | `sensor` | `steamLevel` | | Steam level | `smoke` | `sensor` | `steamLevel` |
| Temperature level | `thermometer` | `sensor` | `tempLevel` |
| Total Power | | `sensor` | `totalElectricityUsed` | | Total Power | | `sensor` | `totalElectricityUsed` |
| Total Wash Cycle | `counter` | `sensor` | `totalWashCycle` | | Total Wash Cycle | `counter` | `sensor` | `totalWashCycle` |
| Total Water | | `sensor` | `totalWaterUsed` | | Total Water | | `sensor` | `totalWaterUsed` |
@ -345,13 +383,19 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
#### Sensors #### Sensors
| Name | Icon | Entity | Key | | Name | Icon | Entity | Key |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Acqua Plus | | `binary_sensor` | `acquaplus` |
| Current Electricity Used | `lightning-bolt` | `sensor` | `currentElectricityUsed` | | Current Electricity Used | `lightning-bolt` | `sensor` | `currentElectricityUsed` |
| Current Water Used | `water` | `sensor` | `currentWaterUsed` | | Current Water Used | `water` | `sensor` | `currentWaterUsed` |
| Dirt level | `liquid-spot` | `sensor` | `dirtyLevel` | | Dirt level | `liquid-spot` | `sensor` | `dirtyLevel` |
| Door | | `binary_sensor` | `doorStatus` | | Door | | `binary_sensor` | `doorStatus` |
| Door Lock | | `binary_sensor` | `doorLockStatus` | | Door Lock | | `binary_sensor` | `doorLockStatus` |
| Error | `math-log` | `sensor` | `errors` | | Error | `math-log` | `sensor` | `errors` |
| 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 | `information` | `sensor` | `machMode` | | Machine Status | `information` | `sensor` | `machMode` |
| Pre Wash | | `binary_sensor` | `startProgram.prewash` |
| Program Phase | `washing-machine` | `sensor` | `prPhase` | | Program Phase | `washing-machine` | `sensor` | `prPhase` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` | | Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Remote Control | `remote` | `binary_sensor` | `attributes.lastConnEvent.category` | | Remote Control | `remote` | `binary_sensor` | `attributes.lastConnEvent.category` |

View File

@ -11,7 +11,7 @@ from homeassistant.components.binary_sensor import (
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.core import callback from homeassistant.core import callback
from .const import DOMAIN from .const import DOMAIN
from .hon import HonCoordinator, HonEntity from .hon import HonCoordinator, HonEntity, unique_entities
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -52,32 +52,6 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
on_value="1", on_value="1",
translation_key="door_open", translation_key="door_open",
), ),
),
"TD": (
HonBinarySensorEntityDescription(
key="attributes.lastConnEvent.category",
name="Connection",
device_class=BinarySensorDeviceClass.CONNECTIVITY,
on_value="CONNECTED",
translation_key="connection",
),
HonBinarySensorEntityDescription(
key="doorStatus",
name="Door",
device_class=BinarySensorDeviceClass.DOOR,
on_value="1",
translation_key="door_open",
),
),
"WD": (
HonBinarySensorEntityDescription(
key="attributes.lastConnEvent.category",
name="Remote Control",
device_class=BinarySensorDeviceClass.CONNECTIVITY,
on_value="CONNECTED",
icon="mdi:remote",
translation_key="remote_control",
),
HonBinarySensorEntityDescription( HonBinarySensorEntityDescription(
key="startProgram.prewash", name="Pre Wash", translation_key="prewash" key="startProgram.prewash", name="Pre Wash", translation_key="prewash"
), ),
@ -96,6 +70,22 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
HonBinarySensorEntityDescription( HonBinarySensorEntityDescription(
key="acquaplus", name="Acqua Plus", translation_key="acqua_plus" key="acquaplus", name="Acqua Plus", translation_key="acqua_plus"
), ),
),
"TD": (
HonBinarySensorEntityDescription(
key="attributes.lastConnEvent.category",
name="Connection",
device_class=BinarySensorDeviceClass.CONNECTIVITY,
on_value="CONNECTED",
translation_key="connection",
),
HonBinarySensorEntityDescription(
key="doorStatus",
name="Door",
device_class=BinarySensorDeviceClass.DOOR,
on_value="1",
translation_key="door_open",
),
HonBinarySensorEntityDescription( HonBinarySensorEntityDescription(
key="anticrease", name="Anti-Crease", translation_key="anti_crease" key="anticrease", name="Anti-Crease", translation_key="anti_crease"
), ),
@ -208,6 +198,9 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
} }
BINARY_SENSORS["WD"] = unique_entities(BINARY_SENSORS["WM"], BINARY_SENSORS["TD"])
async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> None: async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> None:
hon: Hon = hass.data[DOMAIN][entry.unique_id] hon: Hon = hass.data[DOMAIN][entry.unique_id]
coordinators = hass.data[DOMAIN]["coordinators"] coordinators = hass.data[DOMAIN]["coordinators"]
@ -224,12 +217,8 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
for description in descriptions: for description in descriptions:
if not device.get(description.key): if not device.get(description.key):
continue continue
appliances.extend( appliances.append(
[ HonBinarySensorEntity(hass, coordinator, entry, device, description)
HonBinarySensorEntity(
hass, coordinator, entry, device, description
)
]
) )
async_add_entities(appliances) async_add_entities(appliances)

View File

@ -50,3 +50,12 @@ class HonCoordinator(DataUpdateCoordinator):
async def _async_update_data(self): async def _async_update_data(self):
await self._device.update() await self._device.update()
def unique_entities(base_entities, new_entities):
result = list(base_entities)
existing_entities = [entity.key for entity in base_entities]
for entity in new_entities:
if entity.key not in existing_entities:
result.append(entity)
return tuple(result)

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.10.3"], "requirements": ["pyhOn==0.10.4"],
"version": "0.7.0" "version": "0.7.1"
} }

View File

@ -15,7 +15,7 @@ from homeassistant.core import callback
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
from .const import DOMAIN from .const import DOMAIN
from .hon import HonEntity, HonCoordinator from .hon import HonEntity, HonCoordinator, unique_entities
NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = { NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
"WM": ( "WM": (
@ -85,16 +85,6 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
translation_key="dry_time", translation_key="dry_time",
), ),
), ),
"WD": (
NumberEntityDescription(
key="startProgram.delayTime",
name="Delay Time",
icon="mdi:timer-plus",
entity_category=EntityCategory.CONFIG,
native_unit_of_measurement=UnitOfTime.MINUTES,
translation_key="delay_time",
),
),
"OV": ( "OV": (
NumberEntityDescription( NumberEntityDescription(
key="startProgram.delayTime", key="startProgram.delayTime",
@ -166,6 +156,8 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
), ),
} }
NUMBERS["WD"] = unique_entities(NUMBERS["WM"], NUMBERS["TD"])
async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> None: async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> None:
hon: Hon = hass.data[DOMAIN][entry.unique_id] hon: Hon = hass.data[DOMAIN][entry.unique_id]

View File

@ -14,7 +14,7 @@ from homeassistant.core import callback
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
from .const import DOMAIN from .const import DOMAIN
from .hon import HonEntity, HonCoordinator from .hon import HonEntity, HonCoordinator, unique_entities
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -66,14 +66,6 @@ SELECTS = {
translation_key="dry_levels", translation_key="dry_levels",
), ),
), ),
"WD": (
SelectEntityDescription(
key="startProgram.program",
name="Program",
entity_category=EntityCategory.CONFIG,
translation_key="programs_wm",
),
),
"OV": ( "OV": (
SelectEntityDescription( SelectEntityDescription(
key="startProgram.program", key="startProgram.program",
@ -114,6 +106,8 @@ SELECTS = {
), ),
} }
SELECTS["WD"] = unique_entities(SELECTS["WM"], SELECTS["TD"])
async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> None: async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> None:
hon: Hon = hass.data[DOMAIN][entry.unique_id] hon: Hon = hass.data[DOMAIN][entry.unique_id]

View File

@ -25,7 +25,7 @@ from homeassistant.const import PERCENTAGE
from . import const from . import const
from .const import DOMAIN from .const import DOMAIN
from .hon import HonCoordinator, HonEntity from .hon import HonCoordinator, HonEntity, unique_entities
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -112,7 +112,7 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
name="Spin Speed", name="Spin Speed",
icon="mdi:speedometer", icon="mdi:speedometer",
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.MINUTES, native_unit_of_measurement=REVOLUTIONS_PER_MINUTE,
translation_key="spin_speed", translation_key="spin_speed",
), ),
SensorEntityDescription( SensorEntityDescription(
@ -238,12 +238,18 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
translation_key="energy_label", translation_key="energy_label",
), ),
SensorEntityDescription( SensorEntityDescription(
key="steamLevel", key="startProgram.steamLevel",
name="Steam level", name="Steam level",
icon="mdi:smoke", icon="mdi:smoke",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
translation_key="steam_level", translation_key="steam_level",
), ),
SensorEntityDescription(
key="steamLevel",
name="Steam level",
icon="mdi:smoke",
translation_key="steam_level",
),
SensorEntityDescription( SensorEntityDescription(
key="steamType", key="steamType",
name="Steam Type", name="Steam Type",
@ -251,120 +257,6 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
), ),
), ),
"WD": (
SensorEntityDescription(
key="totalElectricityUsed",
name="Total Power",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
translation_key="energy_total",
),
SensorEntityDescription(
key="totalWaterUsed",
name="Total Water",
device_class=SensorDeviceClass.WATER,
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=UnitOfVolume.LITERS,
translation_key="water_total",
),
SensorEntityDescription(
key="totalWashCycle",
name="Total Wash Cycle",
state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:counter",
translation_key="cycles_total",
),
SensorEntityDescription(
key="currentElectricityUsed",
name="Current Electricity Used",
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.POWER,
native_unit_of_measurement=UnitOfPower.KILO_WATT,
icon="mdi:lightning-bolt",
translation_key="energy_current",
),
SensorEntityDescription(
key="currentWaterUsed",
name="Current Water Used",
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:water",
translation_key="water_current",
),
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",
translation_key="suggested_load",
),
SensorEntityDescription(
key="machMode",
name="Machine Status",
icon="mdi:information",
device_class=SensorDeviceClass.ENUM,
translation_key="washing_modes",
options=list(const.MACH_MODE),
),
SensorEntityDescription(
key="spinSpeed",
name="Spin Speed",
icon="mdi:fast-forward-outline",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=REVOLUTIONS_PER_MINUTE,
translation_key="spin_speed",
),
SensorEntityDescription(
key="remainingTimeMM",
name="Remaining Time",
icon="mdi:timer",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.MINUTES,
translation_key="remaining_time",
),
SensorEntityDescription(
key="prCode",
name="Current Program",
icon="mdi:tumble-dryer",
translation_key="programs",
),
SensorEntityDescription(
key="prPhase",
name="Program Phase",
icon="mdi:washing-machine",
device_class=SensorDeviceClass.ENUM,
translation_key="program_phases_wm",
options=list(const.WASHING_PR_PHASE),
),
SensorEntityDescription(
key="dryLevel",
name="Dry level",
icon="mdi:hair-dryer",
translation_key="dry_levels",
),
SensorEntityDescription(
key="dirtyLevel",
name="Dirt level",
icon="mdi:liquid-spot",
translation_key="dirt_level",
),
SensorEntityDescription(
key="steamLevel",
name="Steam level",
icon="mdi:smoke",
translation_key="steam_level",
),
SensorEntityDescription(
key="temp",
name="Current Temperature",
icon="mdi:thermometer",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
translation_key="temperature",
),
),
"OV": ( "OV": (
SensorEntityDescription( SensorEntityDescription(
key="remainingTimeMM", key="remainingTimeMM",
@ -501,6 +393,7 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
), ),
), ),
} }
SENSORS["WD"] = unique_entities(SENSORS["WM"], SENSORS["TD"])
async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> None: async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> None:

View File

@ -10,7 +10,7 @@ from pyhon.appliance import HonAppliance
from pyhon.parameter.range import HonParameterRange from pyhon.parameter.range import HonParameterRange
from .const import DOMAIN from .const import DOMAIN
from .hon import HonCoordinator, HonEntity from .hon import HonCoordinator, HonEntity, unique_entities
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -168,7 +168,7 @@ SWITCHES: dict[str, tuple[HonSwitchEntityDescription, ...]] = {
"WD": ( "WD": (
HonSwitchEntityDescription( HonSwitchEntityDescription(
key="active", key="active",
name="Washing Machine", name="Washer Dryer",
icon="mdi:washing-machine", icon="mdi:washing-machine",
turn_on_key="startProgram", turn_on_key="startProgram",
turn_off_key="stopProgram", turn_off_key="stopProgram",
@ -176,7 +176,7 @@ SWITCHES: dict[str, tuple[HonSwitchEntityDescription, ...]] = {
), ),
HonSwitchEntityDescription( HonSwitchEntityDescription(
key="pause", key="pause",
name="Pause Washing Machine", name="Pause Washer Dryer",
icon="mdi:pause", icon="mdi:pause",
turn_on_key="pauseProgram", turn_on_key="pauseProgram",
turn_off_key="resumeProgram", turn_off_key="resumeProgram",
@ -296,6 +296,9 @@ SWITCHES: dict[str, tuple[HonSwitchEntityDescription, ...]] = {
), ),
} }
SWITCHES["WD"] = unique_entities(SWITCHES["WD"], SWITCHES["WM"])
SWITCHES["WD"] = unique_entities(SWITCHES["WD"], SWITCHES["TD"])
async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> None: async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> None:
hon: Hon = hass.data[DOMAIN][entry.unique_id] hon: Hon = hass.data[DOMAIN][entry.unique_id]

23
info.md
View File

@ -13,12 +13,6 @@ Support for home appliances of Haier's mobile app hOn.
- [Dish Washer](https://github.com/Andre0512/hon#dish-washer) - [Dish Washer](https://github.com/Andre0512/hon#dish-washer)
- [Air conditioner](https://github.com/Andre0512/hon#air-conditioner) [BETA] - [Air conditioner](https://github.com/Andre0512/hon#air-conditioner) [BETA]
## Tested Appliances
- Haier WD90-B14TEAM5
- Haier HD80-A3959
- Haier HWO60SM2F3XH
- Hoover H-WASH 500
## Configuration ## 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) **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)
@ -26,9 +20,15 @@ Support for home appliances of Haier's mobile app hOn.
**Method 2**: Settings > Devices & Services > Add Integration > **Haier 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._ _If the integration is not in the list, you need to clear the browser cache._
## Contribute ## Supported Models
Want to help us to support more appliances? Or add more sensors? Or help with translating? Or beautify some icons or captions? Support was confirmed for these models. If a supported model is missing, please [add it with this form](https://forms.gle/bTSD8qFotdZFytbf8).
Check out the [project on GitHub](https://github.com/Andre0512/hon), every contribution is welcome! - Haier WD90-B14TEAM5
- Haier HD80-A3959
- Haier HWO60SM2F3XH
- Hoover H-WASH 500
- Candy CIS633SCTTWIFI
- Haier XIB 3B2SFS-80
- Haier XIB 6B2D3FB
## Supported Languages ## Supported Languages
Translation of internal names like programs are available for all languages which are official supported by the hOn app: Translation of internal names like programs are available for all languages which are official supported by the hOn app:
@ -52,10 +52,13 @@ Translation of internal names like programs are available for all languages whic
* 🇪🇸 Spanish * 🇪🇸 Spanish
* 🇹🇷 Turkish * 🇹🇷 Turkish
## 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 ## Useful Links
* [GitHub repository](https://github.com/Andre0512/hon) (please add a star if you like this integration!) * [GitHub repository](https://github.com/Andre0512/hon) (please add a star if you like this integration!)
* [pyhOn library](https://github.com/Andre0512/pyhOn) * [pyhOn library](https://github.com/Andre0512/pyhOn)
* [Release notes](https://github.com/Andre0512/hon/releases) * [Release notes](https://github.com/Andre0512/hon/releases)
* [Discussion and help](https://github.com/Andre0512/hon/discussions) * [Discussion and help](https://github.com/Andre0512/hon/discussions)
* [Issues](https://github.com/Andre0512/hon/issues) * [Issues](https://github.com/Andre0512/hon/issues)

View File

@ -3,10 +3,14 @@
import asyncio import asyncio
import json import json
import re import re
import sys
from pathlib import Path from pathlib import Path
from pyhon import HonAPI from pyhon import HonAPI
if __name__ == "__main__":
sys.path.insert(0, str(Path(__file__).parent.parent))
from custom_components.hon import const from custom_components.hon import const
SENSOR = { SENSOR = {