mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Fix unsafe websocket stop call in isy994 (#71071)
Fixes ``` 2022-04-29 12:49:10 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry Alexander (192.168.209.83) for isy994 Traceback (most recent call last): File "/Users/bdraco/home-assistant/homeassistant/config_entries.py", line 474, in async_unload result = await component.async_unload_entry(hass, self) File "/Users/bdraco/home-assistant/homeassistant/components/isy994/__init__.py", line 294, in async_unload_entry await hass.async_add_executor_job(_stop_auto_update) File "/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/Users/bdraco/home-assistant/homeassistant/components/isy994/__init__.py", line 292, in _stop_auto_update isy.websocket.stop() File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/pyisy/events/websocket.py", line 110, in stop self.websocket_task.cancel() File "/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 753, in call_soon self._check_thread() File "/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 790, in _check_thread raise RuntimeError( RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one ```
This commit is contained in:
parent
c90eb4d6b4
commit
11b91e44c8
@ -288,14 +288,10 @@ async def async_unload_entry(
|
||||
|
||||
hass_isy_data = hass.data[DOMAIN][entry.entry_id]
|
||||
|
||||
isy = hass_isy_data[ISY994_ISY]
|
||||
isy: ISY = hass_isy_data[ISY994_ISY]
|
||||
|
||||
def _stop_auto_update() -> None:
|
||||
"""Stop the isy auto update."""
|
||||
_LOGGER.debug("ISY Stopping Event Stream and automatic updates")
|
||||
isy.websocket.stop()
|
||||
|
||||
await hass.async_add_executor_job(_stop_auto_update)
|
||||
_LOGGER.debug("ISY Stopping Event Stream and automatic updates")
|
||||
isy.websocket.stop()
|
||||
|
||||
if unload_ok:
|
||||
hass.data[DOMAIN].pop(entry.entry_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user