mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Update zhong_hong to use async_add_executor_job (#41846)
This commit is contained in:
parent
9270585a44
commit
a220e74154
@ -87,6 +87,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
|
|
||||||
hub_is_initialized = False
|
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():
|
async def startup():
|
||||||
"""Start hub socket after all climate entity is set up."""
|
"""Start hub socket after all climate entity is set up."""
|
||||||
nonlocal hub_is_initialized
|
nonlocal hub_is_initialized
|
||||||
@ -97,8 +102,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
return
|
return
|
||||||
|
|
||||||
_LOGGER.debug("zhong_hong hub start listen event")
|
_LOGGER.debug("zhong_hong hub start listen event")
|
||||||
await hass.async_add_job(hub.start_listen)
|
await hass.async_add_executor_job(_start_hub)
|
||||||
await hass.async_add_job(hub.query_all_status)
|
|
||||||
hub_is_initialized = True
|
hub_is_initialized = True
|
||||||
|
|
||||||
async_dispatcher_connect(hass, SIGNAL_DEVICE_ADDED, startup)
|
async_dispatcher_connect(hass, SIGNAL_DEVICE_ADDED, startup)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user