mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Fix config entry exception in Ambient PWS (#21836)
This commit is contained in:
parent
012c657a9c
commit
113db9afd4
@ -296,6 +296,7 @@ class AmbientStation:
|
|||||||
def __init__(self, hass, config_entry, client, monitored_conditions):
|
def __init__(self, hass, config_entry, client, monitored_conditions):
|
||||||
"""Initialize."""
|
"""Initialize."""
|
||||||
self._config_entry = config_entry
|
self._config_entry = config_entry
|
||||||
|
self._entry_setup_complete = False
|
||||||
self._hass = hass
|
self._hass = hass
|
||||||
self._watchdog_listener = None
|
self._watchdog_listener = None
|
||||||
self._ws_reconnect_delay = DEFAULT_SOCKET_MIN_RETRY
|
self._ws_reconnect_delay = DEFAULT_SOCKET_MIN_RETRY
|
||||||
@ -362,10 +363,16 @@ class AmbientStation:
|
|||||||
'name', station['macAddress']),
|
'name', station['macAddress']),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# If the websocket disconnects and reconnects, the on_subscribed
|
||||||
|
# hanlder will get called again; in that case, we don't want to
|
||||||
|
# attempt forward setup of the config entry (because it will have
|
||||||
|
# already been done):
|
||||||
|
if not self._entry_setup_complete:
|
||||||
for component in ('binary_sensor', 'sensor'):
|
for component in ('binary_sensor', 'sensor'):
|
||||||
self._hass.async_create_task(
|
self._hass.async_create_task(
|
||||||
self._hass.config_entries.async_forward_entry_setup(
|
self._hass.config_entries.async_forward_entry_setup(
|
||||||
self._config_entry, component))
|
self._config_entry, component))
|
||||||
|
self._entry_setup_complete = True
|
||||||
|
|
||||||
self._ws_reconnect_delay = DEFAULT_SOCKET_MIN_RETRY
|
self._ws_reconnect_delay = DEFAULT_SOCKET_MIN_RETRY
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user