mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Do not try to connect to disabled ESPHome devices. (#45092)
This commit is contained in:
parent
ffd9c4e410
commit
f78b02b163
@ -225,6 +225,14 @@ async def _setup_auto_reconnect_logic(
|
|||||||
# When removing/disconnecting manually
|
# When removing/disconnecting manually
|
||||||
return
|
return
|
||||||
|
|
||||||
|
device_registry = await hass.helpers.device_registry.async_get_registry()
|
||||||
|
devices = dr.async_entries_for_config_entry(device_registry, entry.entry_id)
|
||||||
|
for device in devices:
|
||||||
|
# There is only one device in ESPHome
|
||||||
|
if device.disabled:
|
||||||
|
# Don't attempt to connect if it's disabled
|
||||||
|
return
|
||||||
|
|
||||||
data: RuntimeEntryData = hass.data[DOMAIN][entry.entry_id]
|
data: RuntimeEntryData = hass.data[DOMAIN][entry.entry_id]
|
||||||
for disconnect_cb in data.disconnect_callbacks:
|
for disconnect_cb in data.disconnect_callbacks:
|
||||||
disconnect_cb()
|
disconnect_cb()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user