From 116f9d5470638e2158d81abc2e3b0909d3640c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Fri, 7 Apr 2023 13:52:55 +0200 Subject: [PATCH] Add oven support --- custom_components/hon/binary_sensor.py | 26 ++++++++++++++++++++++++ custom_components/hon/button.py | 13 ++++++++++++ custom_components/hon/number.py | 27 ++++++++++++++++++++++++- custom_components/hon/select.py | 14 +++++++++++++ custom_components/hon/sensor.py | 28 ++++++++++++++++++++++++++ 5 files changed, 107 insertions(+), 1 deletion(-) diff --git a/custom_components/hon/binary_sensor.py b/custom_components/hon/binary_sensor.py index 5efd147..178fc91 100644 --- a/custom_components/hon/binary_sensor.py +++ b/custom_components/hon/binary_sensor.py @@ -58,6 +58,32 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = { device_class=BinarySensorDeviceClass.DOOR, on_value="1", ), + ), + + "OV": ( + HonBinarySensorEntityDescription( + key="attributes.lastConnEvent.category", + name="Online", + device_class=BinarySensorDeviceClass.CONNECTIVITY, + on_value="CONNECTED", + icon="mdi:wifi" + ), + + HonBinarySensorEntityDescription( + key="attributes.parameters.remoteCtrValid", + name="On", + device_class=BinarySensorDeviceClass.CONNECTIVITY, + on_value="1", + icon="mdi:remote" + ), + HonBinarySensorEntityDescription( + key="attributes.parameters.onOffStatus", + name="On", + device_class=BinarySensorDeviceClass.RUNNING, + on_value="1", + icon="mdi:power-cycle" + ), + ) } diff --git a/custom_components/hon/button.py b/custom_components/hon/button.py index 5178257..940791d 100644 --- a/custom_components/hon/button.py +++ b/custom_components/hon/button.py @@ -20,6 +20,19 @@ BUTTONS: dict[str, tuple[ButtonEntityDescription, ...]] = { # icon="mdi:play-pause", # ), ), + + "OV":( + ButtonEntityDescription( + key="startProgram", + name="Start Program", + icon="mdi:power-cycle", + ), + ButtonEntityDescription( + key="stopProgram", + name="Stop Program", + icon="mdi:power-off", + ), + ) } diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index 060b2a7..e486655 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -8,7 +8,7 @@ from homeassistant.components.number import ( NumberEntityDescription, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import UnitOfTime +from homeassistant.const import UnitOfTime, UnitOfTemperature from homeassistant.core import callback from homeassistant.helpers.entity import EntityCategory @@ -74,6 +74,31 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = { entity_category=EntityCategory.CONFIG ), ), + + "OV": ( + NumberEntityDescription( + key="startProgram.delayTime", + name="Delay time", + icon="mdi:timer-plus", + entity_category=EntityCategory.CONFIG, + native_unit_of_measurement=UnitOfTime.MINUTES + ), + NumberEntityDescription( + key="startProgram.tempSel", + name="Target Temperature", + entity_category=EntityCategory.CONFIG, + icon="mdi:thermometer", + native_unit_of_measurement=UnitOfTemperature.CELSIUS + ), + + NumberEntityDescription( + key="startProgram.prTime", + name="Program Duration", + entity_category=EntityCategory.CONFIG, + icon="mdi:timelapse", + native_unit_of_measurement=UnitOfTime.MINUTES + ), + ) } diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py index 494f2bb..a602d8c 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py @@ -50,6 +50,20 @@ SELECTS = { icon="mdi:timer", unit_of_measurement=UnitOfTime.MINUTES ), + ), + "OV": ( + SelectEntityDescription( + key="startProgram.program", + name="Program", + entity_category=EntityCategory.CONFIG, + ), + + SelectEntityDescription( + key="startProgram.preheatStatus", + name="Preheat", + entity_category=EntityCategory.CONFIG + ), + ) } diff --git a/custom_components/hon/sensor.py b/custom_components/hon/sensor.py index f948d09..65e26d6 100644 --- a/custom_components/hon/sensor.py +++ b/custom_components/hon/sensor.py @@ -141,7 +141,35 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { icon="mdi:thermometer", translation_key="tumbledryertemplevel" ), + ), + + "OV": ( + SensorEntityDescription( + key="remainingTimeMM", + name="Remaining Time", + icon="mdi:timer", + native_unit_of_measurement=UnitOfTime.MINUTES, + ), + 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", + ), ) + }