From 845adc75c98337a76bf5e6156964a70d80aa1e35 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 14 May 2023 03:16:21 +0200 Subject: [PATCH] Instant send settings --- custom_components/hon/number.py | 4 +++- custom_components/hon/select.py | 4 +++- custom_components/hon/switch.py | 8 ++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index 2942a53..55890ff 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -206,7 +206,9 @@ class HonNumberEntity(HonEntity, NumberEntity): isinstance(setting, HonParameter) or isinstance(setting, HonParameterFixed) ): setting.value = value - if self._device.appliance_type in ["AC"]: + if "settings." in self.entity_description: + self._device.commands["settings"].send() + elif self._device.appliance_type in ["AC"]: self._device.commands["startProgram"].send() await self.coordinator.async_refresh() diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py index e743760..3a75fea 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py @@ -163,7 +163,9 @@ class HonSelectEntity(HonEntity, SelectEntity): async def async_select_option(self, option: str) -> None: self._device.settings[self.entity_description.key].value = option - if self._device.appliance_type in ["AC"]: + if "settings." in self.entity_description: + self._device.commands["settings"].send() + elif self._device.appliance_type in ["AC"]: self._device.commands["startProgram"].send() await self.coordinator.async_refresh() diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index af554cc..17487f1 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -385,7 +385,9 @@ class HonSwitchEntity(HonEntity, SwitchEntity): setting.max if isinstance(setting, HonParameterRange) else "1" ) self.async_write_ha_state() - if self._device.appliance_type in ["AC"]: + if "settings." in self.entity_description: + self._device.commands["settings"].send() + elif self._device.appliance_type in ["AC"]: self._device.commands["startProgram"].send() await self.coordinator.async_refresh() else: @@ -398,7 +400,9 @@ class HonSwitchEntity(HonEntity, SwitchEntity): setting.min if isinstance(setting, HonParameterRange) else "0" ) self.async_write_ha_state() - if self._device.appliance_type in ["AC"]: + if "settings." in self.entity_description: + self._device.commands["settings"].send() + elif self._device.appliance_type in ["AC"]: self._device.commands["startProgram"].send() await self.coordinator.async_refresh() else: