mirror of
https://github.com/Andre0512/hon.git
synced 2024-12-22 18:55:31 +00:00
Add all wm and td sensors to wd
This commit is contained in:
parent
7b80acb6b9
commit
155b1ff91a
55
README.md
55
README.md
|
@ -254,13 +254,14 @@ 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` |
|
||||||
|
@ -270,42 +271,78 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
|
||||||
| 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` |
|
||||||
|
@ -346,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` |
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue