Use async api in template weather to create tasks (#113784)

pull/113796/head
J. Nick Koston 2024-03-18 21:43:14 -10:00 committed by GitHub
parent d740e4c3d7
commit 2f88460b68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -433,7 +433,9 @@ class WeatherTemplate(TemplateEntity, WeatherEntity):
"""Save template result and trigger forecast listener."""
attr_result = None if isinstance(result, TemplateError) else result
setattr(self, f"_forecast_{forecast_type}", attr_result)
self.hass.create_task(self.async_update_listeners([forecast_type]))
self.hass.async_create_task(
self.async_update_listeners([forecast_type]), eager_start=True
)
@callback
def _validate_forecast(