Use UsbServiceInfo in zwave-js (#60267)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/60442/head
epenet 2021-11-24 14:51:28 +01:00 committed by GitHub
parent 3bf12fcd29
commit 5a8cbb8cab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 30 deletions

View File

@ -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")

View File

@ -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")