mirror of
https://github.com/Andre0512/hon.git
synced 2024-12-22 18:55:31 +00:00
Faster refresh when changing configs
This commit is contained in:
parent
1143c47fd3
commit
616f7babdb
|
@ -180,7 +180,7 @@ class HonNumberEntity(HonEntity, NumberEntity):
|
||||||
|
|
||||||
async def async_set_native_value(self, value: float) -> None:
|
async def async_set_native_value(self, value: float) -> None:
|
||||||
self._device.settings[self.entity_description.key].value = value
|
self._device.settings[self.entity_description.key].value = value
|
||||||
await self.coordinator.async_request_refresh()
|
await self.coordinator.async_refresh()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self):
|
def _handle_coordinator_update(self):
|
||||||
|
|
|
@ -147,7 +147,7 @@ class HonSelectEntity(HonEntity, SelectEntity):
|
||||||
|
|
||||||
async def async_select_option(self, option: str) -> None:
|
async def async_select_option(self, option: str) -> None:
|
||||||
self._device.settings[self.entity_description.key].value = option
|
self._device.settings[self.entity_description.key].value = option
|
||||||
await self.coordinator.async_request_refresh()
|
await self.coordinator.async_refresh()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self):
|
def _handle_coordinator_update(self):
|
||||||
|
|
|
@ -253,6 +253,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
|
||||||
setting.max if isinstance(setting, HonParameterRange) else "1"
|
setting.max if isinstance(setting, HonParameterRange) else "1"
|
||||||
)
|
)
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
await self.coordinator.async_refresh()
|
||||||
else:
|
else:
|
||||||
await self._device.commands[self.entity_description.turn_on_key].send()
|
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"
|
setting.min if isinstance(setting, HonParameterRange) else "0"
|
||||||
)
|
)
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
await self.coordinator.async_refresh()
|
||||||
else:
|
else:
|
||||||
await self._device.commands[self.entity_description.turn_off_key].send()
|
await self._device.commands[self.entity_description.turn_off_key].send()
|
||||||
|
|
Loading…
Reference in a new issue