Adding type WD to support

This commit is contained in:
Alexandre Leites 2023-03-18 17:55:35 +01:00
parent db49881b57
commit a62ab1a44d
6 changed files with 176 additions and 1 deletions

View file

@ -37,6 +37,20 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
device_class=BinarySensorDeviceClass.DOOR, device_class=BinarySensorDeviceClass.DOOR,
on_value="0", on_value="0",
), ),
),
"WD": (
HonBinarySensorEntityDescription(
key="attributes.lastConnEvent.category",
name="Connection",
device_class=BinarySensorDeviceClass.CONNECTIVITY,
on_value="CONNECTED",
),
HonBinarySensorEntityDescription(
key="doorLockStatus",
name="Door",
device_class=BinarySensorDeviceClass.DOOR,
on_value="0",
),
) )
} }

View file

@ -20,6 +20,18 @@ BUTTONS: dict[str, tuple[ButtonEntityDescription, ...]] = {
# icon="mdi:play-pause", # icon="mdi:play-pause",
# ), # ),
), ),
"WD": (
# ButtonEntityDescription(
# key="pauseProgram",
# name="Pause Program",
# icon="mdi:pause",
# ),
# ButtonEntityDescription(
# key="resumeProgram",
# name="Resume Program",
# icon="mdi:play-pause",
# ),
),
} }

View file

@ -38,6 +38,28 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
native_unit_of_measurement=UnitOfTime.MINUTES native_unit_of_measurement=UnitOfTime.MINUTES
), ),
), ),
"WD": (
NumberEntityDescription(
key="startProgram.delayTime",
name="Delay Time",
icon="mdi:timer-plus",
entity_category=EntityCategory.CONFIG,
native_unit_of_measurement=UnitOfTime.MINUTES
),
NumberEntityDescription(
key="startProgram.rinseIterations",
name="Rinse Iterations",
icon="mdi:rotate-right",
entity_category=EntityCategory.CONFIG
),
NumberEntityDescription(
key="startProgram.mainWashTime",
name="Main Wash Time",
icon="mdi:clock-start",
entity_category=EntityCategory.CONFIG,
native_unit_of_measurement=UnitOfTime.MINUTES
),
),
} }

View file

@ -35,6 +35,28 @@ SELECTS = {
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
translation_key="programs" translation_key="programs"
), ),
),
"WD": (
SelectEntityDescription(
key="startProgram.spinSpeed",
name="Spin speed",
entity_category=EntityCategory.CONFIG,
icon="mdi:numeric",
unit_of_measurement=REVOLUTIONS_PER_MINUTE
),
SelectEntityDescription(
key="startProgram.temp",
name="Temperature",
entity_category=EntityCategory.CONFIG,
icon="mdi:thermometer",
unit_of_measurement=UnitOfTemperature.CELSIUS
),
SelectEntityDescription(
key="startProgram.program",
name="Program",
entity_category=EntityCategory.CONFIG,
translation_key="programs"
),
) )
} }

View file

@ -9,7 +9,14 @@ 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
)
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
@ -85,10 +92,80 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
SensorEntityDescription( SensorEntityDescription(
key="spinSpeed", key="spinSpeed",
name="Spin Speed", name="Spin Speed",
icon="mdi:fast-forward-outline",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=REVOLUTIONS_PER_MINUTE,
),
),
"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=UnitOfPower.KILO_WATT,
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(
key="machMode",
name="Machine Status",
icon="mdi:information",
translation_key="mode"
),
SensorEntityDescription(
key="errors",
name="Error",
icon="mdi:math-log",
translation_key="errors"
),
SensorEntityDescription(
key="remainingTimeMM",
name="Remaining Time",
icon="mdi:timer", icon="mdi:timer",
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.MINUTES, native_unit_of_measurement=UnitOfTime.MINUTES,
), ),
SensorEntityDescription(
key="spinSpeed",
name="Spin Speed",
icon="mdi:fast-forward-outline",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=REVOLUTIONS_PER_MINUTE,
),
) )
} }

View file

@ -53,6 +53,34 @@ SWITCHES: dict[str, tuple[HonSwitchEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG entity_category=EntityCategory.CONFIG
), ),
), ),
"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",
),
HonSwitchEntityDescription(
key="startProgram.delayStatus",
name="Delay Status",
icon="mdi:timer-check",
entity_category=EntityCategory.CONFIG
),
HonSwitchEntityDescription(
key="startProgram.haier_SoakPrewashSelection",
name="Soak Prewash Selection",
icon="mdi:tshirt-crew",
entity_category=EntityCategory.CONFIG
),
),
} }