From b01f93119f8fb0be28e3f064ed6587f6d75dd13c Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 28 Aug 2025 20:10:10 +0200 Subject: [PATCH] Fix restoring disabled_by flag of deleted devices (#151313) --- homeassistant/helpers/device_registry.py | 1 + tests/helpers/test_device_registry.py | 1 + 2 files changed, 2 insertions(+) diff --git a/homeassistant/helpers/device_registry.py b/homeassistant/helpers/device_registry.py index 8364b3574ae..fd11f7b5f21 100644 --- a/homeassistant/helpers/device_registry.py +++ b/homeassistant/helpers/device_registry.py @@ -936,6 +936,7 @@ class DeviceRegistry(BaseRegistry[dict[str, list[dict[str, Any]]]]): connections, identifiers, ) + disabled_by = UNDEFINED self.devices[device.id] = device # If creating a new device, default to the config entry name diff --git a/tests/helpers/test_device_registry.py b/tests/helpers/test_device_registry.py index 80910d42630..9690b2a52fa 100644 --- a/tests/helpers/test_device_registry.py +++ b/tests/helpers/test_device_registry.py @@ -3937,6 +3937,7 @@ async def test_restore_disabled_by( config_subentry_id=None, configuration_url="http://config_url_new.bla", connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")}, + disabled_by=None, entry_type=None, hw_version="hw_version_new", identifiers={("bridgeid", "0123")},