diff --git a/homeassistant/components/zwave_js/config_flow.py b/homeassistant/components/zwave_js/config_flow.py index 86107cd52f8..023baf10bd4 100644 --- a/homeassistant/components/zwave_js/config_flow.py +++ b/homeassistant/components/zwave_js/config_flow.py @@ -345,12 +345,12 @@ class ConfigFlow(BaseZwaveJSFlow, config_entries.ConfigFlow, domain=DOMAIN): if self._async_in_progress(): return self.async_abort(reason="already_in_progress") - vid = discovery_info["vid"] - pid = discovery_info["pid"] - serial_number = discovery_info["serial_number"] - device = discovery_info["device"] - manufacturer = discovery_info["manufacturer"] - description = discovery_info["description"] + vid = discovery_info.vid + pid = discovery_info.pid + serial_number = discovery_info.serial_number + device = discovery_info.device + manufacturer = discovery_info.manufacturer + description = discovery_info.description # Zooz uses this vid/pid, but so do 2652 sticks if vid == "10C4" and pid == "EA60" and description and "2652" in description: return self.async_abort(reason="not_zwave_device") diff --git a/tests/components/zwave_js/test_config_flow.py b/tests/components/zwave_js/test_config_flow.py index a61d13be8eb..d5829283ff2 100644 --- a/tests/components/zwave_js/test_config_flow.py +++ b/tests/components/zwave_js/test_config_flow.py @@ -7,6 +7,7 @@ import pytest from zwave_js_server.version import VersionInfo from homeassistant import config_entries +from homeassistant.components import usb from homeassistant.components.hassio.handler import HassioAPIError from homeassistant.components.zwave_js.config_flow import SERVER_VERSION_TIMEOUT, TITLE from homeassistant.components.zwave_js.const import DOMAIN @@ -20,32 +21,32 @@ ADDON_DISCOVERY_INFO = { } -USB_DISCOVERY_INFO = { - "device": "/dev/zwave", - "pid": "AAAA", - "vid": "AAAA", - "serial_number": "1234", - "description": "zwave radio", - "manufacturer": "test", -} +USB_DISCOVERY_INFO = usb.UsbServiceInfo( + device="/dev/zwave", + pid="AAAA", + vid="AAAA", + serial_number="1234", + description="zwave radio", + manufacturer="test", +) -NORTEK_ZIGBEE_DISCOVERY_INFO = { - "device": "/dev/zigbee", - "pid": "8A2A", - "vid": "10C4", - "serial_number": "1234", - "description": "nortek zigbee radio", - "manufacturer": "nortek", -} +NORTEK_ZIGBEE_DISCOVERY_INFO = usb.UsbServiceInfo( + device="/dev/zigbee", + pid="8A2A", + vid="10C4", + serial_number="1234", + description="nortek zigbee radio", + manufacturer="nortek", +) -CP2652_ZIGBEE_DISCOVERY_INFO = { - "device": "/dev/zigbee", - "pid": "EA60", - "vid": "10C4", - "serial_number": "", - "description": "cp2652", - "manufacturer": "generic", -} +CP2652_ZIGBEE_DISCOVERY_INFO = usb.UsbServiceInfo( + device="/dev/zigbee", + pid="EA60", + vid="10C4", + serial_number="", + description="cp2652", + manufacturer="generic", +) @pytest.fixture(name="setup_entry")