Remove executor calls in isy994 as its fully async (#57394)

This commit is contained in:
J. Nick Koston 2021-10-09 21:01:18 -10:00 committed by GitHub
parent be8724a6f8
commit 45b60b8346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,21 +205,18 @@ async def async_setup_entry(
# Load platforms for the devices in the ISY controller that we support.
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
def _start_auto_update() -> None:
"""Start isy auto update."""
_LOGGER.debug("ISY Starting Event Stream and automatic updates")
isy.websocket.start()
def _stop_auto_update(event) -> None:
@callback
def _async_stop_auto_update(event) -> None:
"""Stop the isy auto update on Home Assistant Shutdown."""
_LOGGER.debug("ISY Stopping Event Stream and automatic updates")
isy.websocket.stop()
await hass.async_add_executor_job(_start_auto_update)
_LOGGER.debug("ISY Starting Event Stream and automatic updates")
isy.websocket.start()
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
entry.async_on_unload(
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _stop_auto_update)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_stop_auto_update)
)
# Register Integration-wide Services: