Use async api in generic_thermostat to create tasks (#113783)

This commit is contained in:
J. Nick Koston 2024-03-18 21:43:49 -10:00 committed by GitHub
parent 3bb0d04452
commit 31a9c9451e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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