mirror of
https://github.com/Andre0512/hon.git
synced 2024-12-22 18:55:31 +00:00
Merge branch 'main' into oven
This commit is contained in:
parent
116f9d5470
commit
6093b57f76
|
@ -59,7 +59,43 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
|
||||||
on_value="1",
|
on_value="1",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
"WD": (
|
||||||
|
HonBinarySensorEntityDescription(
|
||||||
|
key="attributes.lastConnEvent.category",
|
||||||
|
name="Remote Control",
|
||||||
|
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
||||||
|
on_value="CONNECTED",
|
||||||
|
icon="mdi:remote"
|
||||||
|
),
|
||||||
|
HonBinarySensorEntityDescription(
|
||||||
|
key="startProgram.prewash",
|
||||||
|
name="Pre Wash",
|
||||||
|
),
|
||||||
|
HonBinarySensorEntityDescription(
|
||||||
|
key="extraRinse1",
|
||||||
|
name="Extra Rinse 1",
|
||||||
|
),
|
||||||
|
HonBinarySensorEntityDescription(
|
||||||
|
key="extraRinse2",
|
||||||
|
name="Extra Rinse 2",
|
||||||
|
),
|
||||||
|
HonBinarySensorEntityDescription(
|
||||||
|
key="extraRinse3",
|
||||||
|
name="Extra Rinse 3",
|
||||||
|
),
|
||||||
|
HonBinarySensorEntityDescription(
|
||||||
|
key="goodNight",
|
||||||
|
name="Good Night Mode",
|
||||||
|
),
|
||||||
|
HonBinarySensorEntityDescription(
|
||||||
|
key="acquaplus",
|
||||||
|
name="Acqua Plus",
|
||||||
|
),
|
||||||
|
HonBinarySensorEntityDescription(
|
||||||
|
key="anticrease",
|
||||||
|
name="Anti-Crease",
|
||||||
|
),
|
||||||
|
),
|
||||||
"OV": (
|
"OV": (
|
||||||
HonBinarySensorEntityDescription(
|
HonBinarySensorEntityDescription(
|
||||||
key="attributes.lastConnEvent.category",
|
key="attributes.lastConnEvent.category",
|
||||||
|
@ -68,7 +104,6 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
|
||||||
on_value="CONNECTED",
|
on_value="CONNECTED",
|
||||||
icon="mdi:wifi"
|
icon="mdi:wifi"
|
||||||
),
|
),
|
||||||
|
|
||||||
HonBinarySensorEntityDescription(
|
HonBinarySensorEntityDescription(
|
||||||
key="attributes.parameters.remoteCtrValid",
|
key="attributes.parameters.remoteCtrValid",
|
||||||
name="On",
|
name="On",
|
||||||
|
@ -83,8 +118,7 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
|
||||||
on_value="1",
|
on_value="1",
|
||||||
icon="mdi:power-cycle"
|
icon="mdi:power-cycle"
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +137,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
||||||
if descriptions := BINARY_SENSORS.get(device.appliance_type):
|
if descriptions := BINARY_SENSORS.get(device.appliance_type):
|
||||||
for description in descriptions:
|
for description in descriptions:
|
||||||
if not device.get(description.key):
|
if not device.get(description.key):
|
||||||
_LOGGER.info("Can't setup %s", description.key)
|
_LOGGER.warning("[%s] Can't setup %s", device.appliance_type, description.key)
|
||||||
continue
|
continue
|
||||||
appliances.extend([
|
appliances.extend([
|
||||||
HonBinarySensorEntity(hass, coordinator, entry, device, description)]
|
HonBinarySensorEntity(hass, coordinator, entry, device, description)]
|
||||||
|
|
|
@ -74,7 +74,15 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
entity_category=EntityCategory.CONFIG
|
entity_category=EntityCategory.CONFIG
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
"WD": (
|
||||||
|
NumberEntityDescription(
|
||||||
|
key="startProgram.delayTime",
|
||||||
|
name="Delay Time",
|
||||||
|
icon="mdi:timer-plus",
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
native_unit_of_measurement=UnitOfTime.MINUTES
|
||||||
|
),
|
||||||
|
),
|
||||||
"OV": (
|
"OV": (
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key="startProgram.delayTime",
|
key="startProgram.delayTime",
|
||||||
|
@ -98,7 +106,7 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||||
icon="mdi:timelapse",
|
icon="mdi:timelapse",
|
||||||
native_unit_of_measurement=UnitOfTime.MINUTES
|
native_unit_of_measurement=UnitOfTime.MINUTES
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from pyhon import HonConnection
|
from pyhon import HonConnection
|
||||||
from pyhon.device import HonDevice
|
from pyhon.device import HonDevice
|
||||||
from pyhon.parameter import HonParameterFixed
|
from pyhon.parameter import HonParameterFixed
|
||||||
|
@ -13,6 +15,8 @@ from homeassistant.helpers.entity import EntityCategory
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .hon import HonEntity, HonCoordinator
|
from .hon import HonEntity, HonCoordinator
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SELECTS = {
|
SELECTS = {
|
||||||
"WM": (
|
"WM": (
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
|
@ -51,20 +55,26 @@ SELECTS = {
|
||||||
unit_of_measurement=UnitOfTime.MINUTES
|
unit_of_measurement=UnitOfTime.MINUTES
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
"WD": (
|
||||||
|
SelectEntityDescription(
|
||||||
|
key="startProgram.program",
|
||||||
|
name="Program",
|
||||||
|
entity_category=EntityCategory.CONFIG,
|
||||||
|
translation_key="programs"
|
||||||
|
),
|
||||||
|
),
|
||||||
"OV": (
|
"OV": (
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key="startProgram.program",
|
key="startProgram.program",
|
||||||
name="Program",
|
name="Program",
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
|
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key="startProgram.preheatStatus",
|
key="startProgram.preheatStatus",
|
||||||
name="Preheat",
|
name="Preheat",
|
||||||
entity_category=EntityCategory.CONFIG
|
entity_category=EntityCategory.CONFIG
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,6 +93,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
||||||
if descriptions := SELECTS.get(device.appliance_type):
|
if descriptions := SELECTS.get(device.appliance_type):
|
||||||
for description in descriptions:
|
for description in descriptions:
|
||||||
if not device.get(description.key):
|
if not device.get(description.key):
|
||||||
|
_LOGGER.warning("[%s] Can't setup %s", device.appliance_type, description.key)
|
||||||
continue
|
continue
|
||||||
appliances.extend([
|
appliances.extend([
|
||||||
HonSelectEntity(hass, coordinator, entry, device, description)]
|
HonSelectEntity(hass, coordinator, entry, device, description)]
|
||||||
|
|
|
@ -9,7 +9,15 @@ from homeassistant.components.sensor import (
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import UnitOfEnergy, UnitOfVolume, UnitOfMass, UnitOfPower, UnitOfTime
|
from homeassistant.const import (
|
||||||
|
REVOLUTIONS_PER_MINUTE,
|
||||||
|
UnitOfEnergy,
|
||||||
|
UnitOfVolume,
|
||||||
|
UnitOfMass,
|
||||||
|
UnitOfPower,
|
||||||
|
UnitOfTime,
|
||||||
|
UnitOfTemperature
|
||||||
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
|
@ -142,7 +150,60 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
|
||||||
translation_key="tumbledryertemplevel"
|
translation_key="tumbledryertemplevel"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
"WD": (
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="machMode",
|
||||||
|
name="Machine Status",
|
||||||
|
icon="mdi:information",
|
||||||
|
translation_key="mode"
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="spinSpeed",
|
||||||
|
name="Spin Speed",
|
||||||
|
icon="mdi:fast-forward-outline",
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
native_unit_of_measurement=REVOLUTIONS_PER_MINUTE,
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="remainingTimeMM",
|
||||||
|
name="Remaining Time",
|
||||||
|
icon="mdi:timer",
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="prCode",
|
||||||
|
name="Current Program",
|
||||||
|
icon="mdi:tumble-dryer",
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="prPhase",
|
||||||
|
name="Program Phase",
|
||||||
|
icon="mdi:tumble-dryer",
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="dryLevel",
|
||||||
|
name="Dry level",
|
||||||
|
icon="mdi:hair-dryer",
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="dirtyLevel",
|
||||||
|
name="Dirt level",
|
||||||
|
icon="mdi:liquid-spot",
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="steamLevel",
|
||||||
|
name="Steam level",
|
||||||
|
icon="mdi:smoke",
|
||||||
|
),
|
||||||
|
SensorEntityDescription(
|
||||||
|
key="temp",
|
||||||
|
name="Current Temperature",
|
||||||
|
icon="mdi:thermometer",
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
|
),
|
||||||
|
),
|
||||||
"OV": (
|
"OV": (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="remainingTimeMM",
|
key="remainingTimeMM",
|
||||||
|
@ -154,22 +215,18 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
|
||||||
key="delayTime",
|
key="delayTime",
|
||||||
name="Start Time",
|
name="Start Time",
|
||||||
icon="mdi:clock-start",
|
icon="mdi:clock-start",
|
||||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
|
||||||
),
|
),
|
||||||
|
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="temp",
|
key="temp",
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
),
|
),
|
||||||
|
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="tempSel",
|
key="tempSel",
|
||||||
name="Temperature Selected",
|
name="Temperature Selected",
|
||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,6 +245,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
||||||
if descriptions := SENSORS.get(device.appliance_type):
|
if descriptions := SENSORS.get(device.appliance_type):
|
||||||
for description in descriptions:
|
for description in descriptions:
|
||||||
if not device.get(description.key):
|
if not device.get(description.key):
|
||||||
|
_LOGGER.warning("[%s] Can't setup %s", device.appliance_type, description.key)
|
||||||
continue
|
continue
|
||||||
appliances.extend([
|
appliances.extend([
|
||||||
HonSensorEntity(hass, coordinator, entry, device, description)]
|
HonSensorEntity(hass, coordinator, entry, device, description)]
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import logging
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
@ -10,6 +12,7 @@ from pyhon.device import HonDevice
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .hon import HonCoordinator, HonEntity
|
from .hon import HonCoordinator, HonEntity
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class HonSwitchEntityDescriptionMixin:
|
class HonSwitchEntityDescriptionMixin:
|
||||||
|
@ -69,6 +72,22 @@ SWITCHES: dict[str, tuple[HonSwitchEntityDescription, ...]] = {
|
||||||
turn_off_key="resumeProgram",
|
turn_off_key="resumeProgram",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
"WD": (
|
||||||
|
HonSwitchEntityDescription(
|
||||||
|
key="active",
|
||||||
|
name="Washing Machine",
|
||||||
|
icon="mdi:washing-machine",
|
||||||
|
turn_on_key="startProgram",
|
||||||
|
turn_off_key="stopProgram",
|
||||||
|
),
|
||||||
|
HonSwitchEntityDescription(
|
||||||
|
key="pause",
|
||||||
|
name="Pause Washing Machine",
|
||||||
|
icon="mdi:pause",
|
||||||
|
turn_on_key="pauseProgram",
|
||||||
|
turn_off_key="resumeProgram",
|
||||||
|
),
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,6 +109,8 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
||||||
appliances.extend([
|
appliances.extend([
|
||||||
HonSwitchEntity(hass, coordinator, entry, device, description)]
|
HonSwitchEntity(hass, coordinator, entry, device, description)]
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
_LOGGER.warning("[%s] Can't setup %s", device.appliance_type, description.key)
|
||||||
|
|
||||||
async_add_entities(appliances)
|
async_add_entities(appliances)
|
||||||
|
|
||||||
|
|
|
@ -377,6 +377,7 @@
|
||||||
"single_item_steam": "Single Item + Steam",
|
"single_item_steam": "Single Item + Steam",
|
||||||
"smart_wash": "Smart Wash",
|
"smart_wash": "Smart Wash",
|
||||||
"soft_care": "Soft Care",
|
"soft_care": "Soft Care",
|
||||||
|
"soft_care_steam": "Soft Care + Steam",
|
||||||
"soft_care_steam_title": "Soft Care + Steam",
|
"soft_care_steam_title": "Soft Care + Steam",
|
||||||
"special_39": "Special 39'",
|
"special_39": "Special 39'",
|
||||||
"special_39_full_load": "Special 39'",
|
"special_39_full_load": "Special 39'",
|
||||||
|
|
|
@ -377,6 +377,7 @@
|
||||||
"single_item_steam": "Single Item + Steam",
|
"single_item_steam": "Single Item + Steam",
|
||||||
"smart_wash": "Smart Wash",
|
"smart_wash": "Smart Wash",
|
||||||
"soft_care": "Soft Care",
|
"soft_care": "Soft Care",
|
||||||
|
"soft_care_steam": "Soft Care + Steam",
|
||||||
"soft_care_steam_title": "Soft Care + Steam",
|
"soft_care_steam_title": "Soft Care + Steam",
|
||||||
"special_39": "Special 39'",
|
"special_39": "Special 39'",
|
||||||
"special_39_full_load": "Special 39'",
|
"special_39_full_load": "Special 39'",
|
||||||
|
|
Loading…
Reference in a new issue