From e44d34018eae72a64bc1ab910012e1000edad24f Mon Sep 17 00:00:00 2001 From: Robert Svensson Date: Sun, 10 Apr 2022 15:24:28 +0200 Subject: [PATCH] Improve typing of deCONZ services (#69444) --- homeassistant/components/deconz/services.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/deconz/services.py b/homeassistant/components/deconz/services.py index 4b840532fa6..3d12a293c39 100644 --- a/homeassistant/components/deconz/services.py +++ b/homeassistant/components/deconz/services.py @@ -167,12 +167,13 @@ async def async_remove_orphaned_entries_service(gateway: DeconzGateway) -> None: ] # Don't remove the Gateway host entry - gateway_host = device_registry.async_get_device( - connections={(CONNECTION_NETWORK_MAC, gateway.api.config.mac)}, - identifiers=set(), - ) - if gateway_host and gateway_host.id in devices_to_be_removed: - devices_to_be_removed.remove(gateway_host.id) + if gateway.api.config.mac: + gateway_host = device_registry.async_get_device( + connections={(CONNECTION_NETWORK_MAC, gateway.api.config.mac)}, + identifiers=set(), + ) + if gateway_host and gateway_host.id in devices_to_be_removed: + devices_to_be_removed.remove(gateway_host.id) # Don't remove the Gateway service entry gateway_service = device_registry.async_get_device(