Fix automatic updates of entities

This commit is contained in:
Michał Małolepszy 2025-06-26 01:02:47 +02:00
parent 7114a6578d
commit 0823793977
10 changed files with 15 additions and 15 deletions

View file

@ -346,4 +346,4 @@ class HonBinarySensorEntity(HonEntity, BinarySensorEntity):
== self.entity_description.on_value
)
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()

View file

@ -290,7 +290,7 @@ class HonACClimateEntity(HonEntity, ClimateEntity):
@callback
def _handle_coordinator_update(self, update: bool = True) -> None:
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()
class HonClimateEntity(HonEntity, ClimateEntity):
@ -423,4 +423,4 @@ class HonClimateEntity(HonEntity, ClimateEntity):
@callback
def _handle_coordinator_update(self, update: bool = True) -> None:
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()

View file

@ -53,4 +53,4 @@ class HonEntity(CoordinatorEntity[DataUpdateCoordinator[dict[str, Any]]]):
@callback
def _handle_coordinator_update(self, update: bool = True) -> None:
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()

View file

@ -125,7 +125,7 @@ class HonFanEntity(HonEntity, FanEntity):
)
self._attr_percentage = self.percentage
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()
@property
def available(self) -> bool:

View file

@ -136,7 +136,7 @@ class HonLightEntity(HonEntity, LightEntity):
self._attr_is_on = self.is_on
self._attr_brightness = self.brightness
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()
@property
def available(self) -> bool:

View file

@ -83,4 +83,4 @@ class HonLockEntity(HonEntity, LockEntity):
def _handle_coordinator_update(self, update: bool = True) -> None:
self._attr_is_locked = self.is_locked
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()

View file

@ -268,7 +268,7 @@ class HonNumberEntity(HonEntity, NumberEntity):
self._attr_native_step = setting.step
self._attr_native_value = self.native_value
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()
@property
def available(self) -> bool:
@ -324,4 +324,4 @@ class HonConfigNumberEntity(HonEntity, NumberEntity):
self._attr_native_step = setting.step
self._attr_native_value = self.native_value
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()

View file

@ -271,7 +271,7 @@ class HonConfigSelectEntity(HonEntity, SelectEntity):
self._attr_options = self.options
self._attr_current_option = self.current_option
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()
@property
def available(self) -> bool:
@ -334,4 +334,4 @@ class HonSelectEntity(HonEntity, SelectEntity):
self._attr_options = self.options
self._attr_current_option = self.current_option
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()

View file

@ -846,7 +846,7 @@ class HonSensorEntity(HonEntity, SensorEntity):
self._attr_native_value = 0
self._attr_native_value = value
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()
class HonConfigSensorEntity(HonEntity, SensorEntity):
@ -874,4 +874,4 @@ class HonConfigSensorEntity(HonEntity, SensorEntity):
value = get_readable(self.entity_description, value)
self._attr_native_value = value
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()

View file

@ -476,7 +476,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
def _handle_coordinator_update(self, update: bool = True) -> None:
self._attr_is_on = self.is_on
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()
class HonControlSwitchEntity(HonEntity, SwitchEntity):
@ -556,4 +556,4 @@ class HonConfigSwitchEntity(HonEntity, SwitchEntity):
def _handle_coordinator_update(self, update: bool = True) -> None:
self._attr_is_on = self.is_on
if update:
self.async_write_ha_state()
self.schedule_update_ha_state()