Skip to content

Commit

Permalink
Merge pull request #152 from Chupaka/patch-1
Browse files Browse the repository at this point in the history
Use async_write_ha_state() instead of async_update_ha_state()
  • Loading branch information
ScratMan authored May 10, 2023
2 parents 89b6800 + 5f3a6ae commit 1c1b124
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/smart_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ async def clear_integral(self, **kwargs):
"""Clear the integral value."""
self._pid_controller.integral = 0.0
self._i = self._pid_controller.integral
await self.async_update_ha_state()
await self.async_write_ha_state()

@property
def min_temp(self):
Expand Down Expand Up @@ -877,7 +877,7 @@ async def _async_control_heating(self, time_func=None, calc_pid=False):
data = {ATTR_ENTITY_ID: self._heater_entity_id,
ATTR_VALUE: self._control_output}
await self.hass.services.async_call(NUMBER_DOMAIN, SERVICE_SET_VALUE, data)
await self.async_update_ha_state()
await self.async_write_ha_state()
return

if self._sensor_stall != 0 and time.time() - self._last_sensor_update > \
Expand All @@ -887,7 +887,7 @@ async def _async_control_heating(self, time_func=None, calc_pid=False):
elif calc_pid or self._sampling_period != 0:
await self.calc_output()
await self.set_control_value()
await self.async_update_ha_state()
await self.async_write_ha_state()

@property
def _is_device_active(self):
Expand Down

0 comments on commit 1c1b124

Please sign in to comment.