diff --git a/custom_components/hon/binary_sensor.py b/custom_components/hon/binary_sensor.py index f047945..f69876d 100644 --- a/custom_components/hon/binary_sensor.py +++ b/custom_components/hon/binary_sensor.py @@ -37,6 +37,20 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = { device_class=BinarySensorDeviceClass.DOOR, 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", + ), ) } diff --git a/custom_components/hon/button.py b/custom_components/hon/button.py index 5178257..2503328 100644 --- a/custom_components/hon/button.py +++ b/custom_components/hon/button.py @@ -20,6 +20,18 @@ BUTTONS: dict[str, tuple[ButtonEntityDescription, ...]] = { # icon="mdi:play-pause", # ), ), + "WD": ( + # ButtonEntityDescription( + # key="pauseProgram", + # name="Pause Program", + # icon="mdi:pause", + # ), + # ButtonEntityDescription( + # key="resumeProgram", + # name="Resume Program", + # icon="mdi:play-pause", + # ), + ), } diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index cca1468..a3311f9 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -38,6 +38,28 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = { 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 + ), + ), } diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py index bf7d10e..60a588a 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py @@ -35,6 +35,28 @@ SELECTS = { entity_category=EntityCategory.CONFIG, 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" + ), ) } diff --git a/custom_components/hon/sensor.py b/custom_components/hon/sensor.py index a605c9a..7cbd603 100644 --- a/custom_components/hon/sensor.py +++ b/custom_components/hon/sensor.py @@ -9,7 +9,14 @@ 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 +) from homeassistant.core import callback from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.typing import StateType @@ -85,10 +92,80 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { SensorEntityDescription( key="spinSpeed", 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", state_class=SensorStateClass.MEASUREMENT, 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, + ), ) } diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index 695d812..a233f69 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -53,6 +53,34 @@ SWITCHES: dict[str, tuple[HonSwitchEntityDescription, ...]] = { 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 + ), + ), }