diff --git a/homeassistant/components/switchbot/config_flow.py b/homeassistant/components/switchbot/config_flow.py index eba40d46058..2d4e61bada5 100644 --- a/homeassistant/components/switchbot/config_flow.py +++ b/homeassistant/components/switchbot/config_flow.py @@ -112,7 +112,7 @@ class SwitchbotConfigFlow(ConfigFlow, domain=DOMAIN): unconfigured_devices = { device["mac_address"]: f"{device['mac_address']} {device['modelName']}" for device in self._discovered_devices.values() - if device["modelName"] in SUPPORTED_MODEL_TYPES + if device.get("modelName") in SUPPORTED_MODEL_TYPES and device["mac_address"] not in configured_devices } diff --git a/tests/components/switchbot/conftest.py b/tests/components/switchbot/conftest.py index 8e90547a18f..52e5fd4fa15 100644 --- a/tests/components/switchbot/conftest.py +++ b/tests/components/switchbot/conftest.py @@ -41,6 +41,12 @@ class MocGetSwitchbotDevices: "model": "c", "modelName": "WoCurtain", }, + "ffffff19ffff": { + "mac_address": "ff:ff:ff:19:ff:ff", + "Flags": "06", + "Manufacturer": "5900ffffff19ffff", + "Complete 128b Services": "cba20d00-224d-11e6-9fb8-0002a5d5c51b", + }, } self._curtain_all_services_data = { "mac_address": "e7:89:43:90:90:90",