Use async_write_ha_state in generic hygrostat (#91331)

This commit is contained in:
Franck Nijhof 2023-04-13 09:42:12 +02:00 committed by GitHub
parent 4a0988eb5d
commit 208a44e437
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -270,7 +270,7 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
return
self._state = True
await self._async_operate(force=True)
await self.async_update_ha_state()
self.async_write_ha_state()
async def async_turn_off(self, **kwargs):
"""Turn hygrostat off."""
@ -279,7 +279,7 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
self._state = False
if self._is_device_active:
await self._async_device_turn_off()
await self.async_update_ha_state()
self.async_write_ha_state()
async def async_set_humidity(self, humidity: int) -> None:
"""Set new target humidity."""
@ -288,12 +288,12 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
if self._is_away and self._away_fixed:
self._saved_target_humidity = humidity
await self.async_update_ha_state()
self.async_write_ha_state()
return
self._target_humidity = humidity
await self._async_operate()
await self.async_update_ha_state()
self.async_write_ha_state()
@property
def min_humidity(self):
@ -329,7 +329,7 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
await self._async_update_humidity(new_state.state)
await self._async_operate()
await self.async_update_ha_state()
self.async_write_ha_state()
async def _async_sensor_not_responding(self, now=None):
"""Handle sensor stale event."""
@ -471,4 +471,4 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
)
await self._async_operate(force=True)
await self.async_update_ha_state()
self.async_write_ha_state()