Merge branch 'main' into oven

This commit is contained in:
Andre Basche 2023-04-08 04:33:55 +02:00 committed by GitHub
commit 287e895f4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 150 additions and 17 deletions

View file

@ -59,7 +59,43 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
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": (
HonBinarySensorEntityDescription(
key="attributes.lastConnEvent.category",
@ -68,7 +104,6 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
on_value="CONNECTED",
icon="mdi:wifi"
),
HonBinarySensorEntityDescription(
key="attributes.parameters.remoteCtrValid",
name="On",
@ -83,8 +118,7 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
on_value="1",
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):
for description in descriptions:
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
appliances.extend([
HonBinarySensorEntity(hass, coordinator, entry, device, description)]

View file

@ -74,7 +74,15 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
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": (
NumberEntityDescription(
key="startProgram.delayTime",
@ -98,7 +106,7 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
icon="mdi:timelapse",
native_unit_of_measurement=UnitOfTime.MINUTES
),
)
),
}

View file

@ -1,5 +1,7 @@
from __future__ import annotations
import logging
from pyhon import HonConnection
from pyhon.device import HonDevice
from pyhon.parameter import HonParameterFixed
@ -13,6 +15,8 @@ from homeassistant.helpers.entity import EntityCategory
from .const import DOMAIN
from .hon import HonEntity, HonCoordinator
_LOGGER = logging.getLogger(__name__)
SELECTS = {
"WM": (
SelectEntityDescription(
@ -51,20 +55,25 @@ SELECTS = {
unit_of_measurement=UnitOfTime.MINUTES
),
),
"WD": (
SelectEntityDescription(
key="startProgram.program",
name="Program",
entity_category=EntityCategory.CONFIG,
translation_key="programs"
),
"OV": (
SelectEntityDescription(
key="startProgram.program",
name="Program",
entity_category=EntityCategory.CONFIG,
),
SelectEntityDescription(
key="startProgram.preheatStatus",
name="Preheat",
entity_category=EntityCategory.CONFIG
),
)
),
}
@ -83,6 +92,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
if descriptions := SELECTS.get(device.appliance_type):
for description in descriptions:
if not device.get(description.key):
_LOGGER.warning("[%s] Can't setup %s", device.appliance_type, description.key)
continue
appliances.extend([
HonSelectEntity(hass, coordinator, entry, device, description)]

View file

@ -9,7 +9,15 @@ from homeassistant.components.sensor import (
SensorEntityDescription,
)
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.helpers.entity import EntityCategory
from homeassistant.helpers.typing import StateType
@ -142,7 +150,60 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
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": (
SensorEntityDescription(
key="remainingTimeMM",
@ -154,22 +215,18 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
key="delayTime",
name="Start Time",
icon="mdi:clock-start",
native_unit_of_measurement=UnitOfTime.MINUTES,
),
SensorEntityDescription(
key="temp",
name="Temperature",
icon="mdi:thermometer",
),
SensorEntityDescription(
key="tempSel",
name="Temperature Selected",
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):
for description in descriptions:
if not device.get(description.key):
_LOGGER.warning("[%s] Can't setup %s", device.appliance_type, description.key)
continue
appliances.extend([
HonSensorEntity(hass, coordinator, entry, device, description)]

View file

@ -1,3 +1,5 @@
import logging
from dataclasses import dataclass
from typing import Any
@ -10,6 +12,7 @@ from pyhon.device import HonDevice
from .const import DOMAIN
from .hon import HonCoordinator, HonEntity
_LOGGER = logging.getLogger(__name__)
@dataclass
class HonSwitchEntityDescriptionMixin:
@ -69,6 +72,22 @@ SWITCHES: dict[str, tuple[HonSwitchEntityDescription, ...]] = {
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([
HonSwitchEntity(hass, coordinator, entry, device, description)]
)
else:
_LOGGER.warning("[%s] Can't setup %s", device.appliance_type, description.key)
async_add_entities(appliances)

View file

@ -377,6 +377,7 @@
"single_item_steam": "Single Item + Steam",
"smart_wash": "Smart Wash",
"soft_care": "Soft Care",
"soft_care_steam": "Soft Care + Steam",
"soft_care_steam_title": "Soft Care + Steam",
"special_39": "Special 39'",
"special_39_full_load": "Special 39'",

View file

@ -377,6 +377,7 @@
"single_item_steam": "Single Item + Steam",
"smart_wash": "Smart Wash",
"soft_care": "Soft Care",
"soft_care_steam": "Soft Care + Steam",
"soft_care_steam_title": "Soft Care + Steam",
"special_39": "Special 39'",
"special_39_full_load": "Special 39'",