Use async api in generic_thermostat to create tasks (#113783)
This commit is contained in:
parent
3bb0d04452
commit
31a9c9451e
1 changed files with 6 additions and 2 deletions
|
@ -279,7 +279,9 @@ class GenericThermostat(ClimateEntity, RestoreEntity):
|
|||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
):
|
||||
self.hass.create_task(self._check_switch_initial_state())
|
||||
self.hass.async_create_task(
|
||||
self._check_switch_initial_state(), eager_start=True
|
||||
)
|
||||
|
||||
if self.hass.state is CoreState.running:
|
||||
_async_startup()
|
||||
|
@ -443,7 +445,9 @@ class GenericThermostat(ClimateEntity, RestoreEntity):
|
|||
if new_state is None:
|
||||
return
|
||||
if old_state is None:
|
||||
self.hass.create_task(self._check_switch_initial_state())
|
||||
self.hass.async_create_task(
|
||||
self._check_switch_initial_state(), eager_start=True
|
||||
)
|
||||
self.async_write_ha_state()
|
||||
|
||||
@callback
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue