Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix #108 use async_write_ha_state() #110

Merged
merged 1 commit into from
May 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions custom_components/tasmota_irhvac/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ async def state_message_received(msg):
setattr(self, '_' + key.lower(), 'off')

# Update HA UI and State
await self.async_update_ha_state()
self.async_write_ha_state()
#self.async_schedule_update_ha_state()

# Check power sensor state
Expand Down Expand Up @@ -1049,17 +1049,17 @@ async def _async_power_sensor_changed(self, entity_id, old_state, new_state):
else:
self._hvac_mode = STATE_ON
self.power_mode = STATE_ON
await self.async_update_ha_state()
self.async_write_ha_state()

elif new_state.state == STATE_OFF:
if self._hvac_mode != HVAC_MODE_OFF or self.power_mode == STATE_ON:
self._hvac_mode = HVAC_MODE_OFF
self.power_mode = STATE_OFF
await self.async_update_ha_state()
self.async_write_ha_state()

async def async_send_cmd(self):
await self.send_ir()
await self.async_update_ha_state()
self.async_write_ha_state()

@property
def min_temp(self):
Expand All @@ -1085,15 +1085,15 @@ async def _async_sensor_changed(self, entity_id, old_state, new_state):
return

self._async_update_temp(new_state)
await self.async_update_ha_state()
self.async_write_ha_state()

async def _async_humidity_sensor_changed(self, entity_id, old_state, new_state):
"""Handle humidity sensor changes."""
if new_state is None:
return

self._async_update_humidity(new_state)
await self.async_update_ha_state()
self.async_write_ha_state()

@callback
def _async_update_temp(self, state):
Expand Down Expand Up @@ -1135,7 +1135,7 @@ async def async_set_preset_mode(self, preset_mode):
self._is_away = False
self._target_temp = self._saved_target_temp
await self.send_ir()
await self.async_update_ha_state()
self.async_write_ha_state()

async def set_mode(self, hvac_mode):
"""Set hvac mode."""
Expand Down