From a220e741542e794ebc83388591ebb4fa7eaad81d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 15 Oct 2020 15:39:48 -0500 Subject: [PATCH] Update zhong_hong to use async_add_executor_job (#41846) --- homeassistant/components/zhong_hong/climate.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/zhong_hong/climate.py b/homeassistant/components/zhong_hong/climate.py index fc5a5688027..68247537847 100644 --- a/homeassistant/components/zhong_hong/climate.py +++ b/homeassistant/components/zhong_hong/climate.py @@ -87,6 +87,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None): hub_is_initialized = False + def _start_hub(): + """Start the hub socket and query status of all devices.""" + hub.start_listen() + hub.query_all_status() + async def startup(): """Start hub socket after all climate entity is set up.""" nonlocal hub_is_initialized @@ -97,8 +102,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): return _LOGGER.debug("zhong_hong hub start listen event") - await hass.async_add_job(hub.start_listen) - await hass.async_add_job(hub.query_all_status) + await hass.async_add_executor_job(_start_hub) hub_is_initialized = True async_dispatcher_connect(hass, SIGNAL_DEVICE_ADDED, startup)