Closed Chupaka closed 1 year ago
@ScratMan okay, now I tested this change and it fails :(
Jun 05 16:08:22 home-assistant hass[428768]: 2023-06-05 16:08:22.975 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Jun 05 16:08:22 home-assistant hass[428768]: Traceback (most recent call last):
Jun 05 16:08:22 home-assistant hass[428768]: File "/home/homeassistant/.homeassistant/custom_components/smart_thermostat/climate.py", line 823, in _async_sensor_changed
Jun 05 16:08:22 home-assistant hass[428768]: await self._async_control_heating(calc_pid=True)
Jun 05 16:08:22 home-assistant hass[428768]: File "/home/homeassistant/.homeassistant/custom_components/smart_thermostat/climate.py", line 893, in _async_control_heating
Jun 05 16:08:22 home-assistant hass[428768]: await self.async_write_ha_state()
Jun 05 16:08:22 home-assistant hass[428768]: TypeError: object NoneType can't be used in 'await' expression
While async_update_ha_state is defined as async
, async_write_ha_state is not. Should we simply remove "await" keyword in front of async_write_ha_state?..
Hi, yes, if there is no async
in front of the definition, then the await
should be removed when calling the method.
Indeed, async_update_ha_state() without params simply calls async_write_ha_state(): https://github.com/home-assistant/core/blob/23e24d75dcaae04c888df37144e9f405f10014fa/homeassistant/helpers/entity.py#L562-L598
Closes #149