Do not try to connect to disabled ESPHome devices. (#45092)
This commit is contained in:
parent
ffd9c4e410
commit
f78b02b163
1 changed files with 8 additions and 0 deletions
|
@ -225,6 +225,14 @@ async def _setup_auto_reconnect_logic(
|
|||
# When removing/disconnecting manually
|
||||
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]
|
||||
for disconnect_cb in data.disconnect_callbacks:
|
||||
disconnect_cb()
|
||||
|
|
Loading…
Add table
Reference in a new issue