From 616f7babdba31f590c3b55befa914e53a0047278 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 23 Apr 2023 20:04:19 +0200 Subject: [PATCH] Faster refresh when changing configs --- custom_components/hon/number.py | 2 +- custom_components/hon/select.py | 2 +- custom_components/hon/switch.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index 11d5868..ee14e91 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -180,7 +180,7 @@ class HonNumberEntity(HonEntity, NumberEntity): async def async_set_native_value(self, value: float) -> None: self._device.settings[self.entity_description.key].value = value - await self.coordinator.async_request_refresh() + await self.coordinator.async_refresh() @callback def _handle_coordinator_update(self): diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py index cf6e903..8d614e1 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py @@ -147,7 +147,7 @@ class HonSelectEntity(HonEntity, SelectEntity): async def async_select_option(self, option: str) -> None: self._device.settings[self.entity_description.key].value = option - await self.coordinator.async_request_refresh() + await self.coordinator.async_refresh() @callback def _handle_coordinator_update(self): diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index 1647998..277e5ab 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -253,6 +253,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity): setting.max if isinstance(setting, HonParameterRange) else "1" ) self.async_write_ha_state() + await self.coordinator.async_refresh() else: await self._device.commands[self.entity_description.turn_on_key].send() @@ -263,5 +264,6 @@ class HonSwitchEntity(HonEntity, SwitchEntity): setting.min if isinstance(setting, HonParameterRange) else "0" ) self.async_write_ha_state() + await self.coordinator.async_refresh() else: await self._device.commands[self.entity_description.turn_off_key].send()