mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 20:25:07 +02:00
Do not try to connect to disabled ESPHome devices. (#45092)
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user