Narrow zwave_js USB discovery (#55613)

- Avoid triggering discovery when we can know in advance the
  device is not a Z-Wave stick
This commit is contained in:
J. Nick Koston 2021-09-02 17:11:03 -10:00 committed by GitHub
parent 8af0cb9e65
commit d8a81a54d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 11 deletions

View File

@ -326,11 +326,6 @@ class ConfigFlow(BaseZwaveJSFlow, config_entries.ConfigFlow, domain=DOMAIN):
device = discovery_info["device"] device = discovery_info["device"]
manufacturer = discovery_info["manufacturer"] manufacturer = discovery_info["manufacturer"]
description = discovery_info["description"] description = discovery_info["description"]
# The Nortek sticks are a special case since they
# have a Z-Wave and a Zigbee radio. We need to reject
# the Zigbee radio.
if vid == "10C4" and pid == "8A2A" and "Z-Wave" not in description:
return self.async_abort(reason="not_zwave_device")
# Zooz uses this vid/pid, but so do 2652 sticks # Zooz uses this vid/pid, but so do 2652 sticks
if vid == "10C4" and pid == "EA60" and "2652" in description: if vid == "10C4" and pid == "EA60" and "2652" in description:
return self.async_abort(reason="not_zwave_device") return self.async_abort(reason="not_zwave_device")

View File

@ -9,7 +9,7 @@
"iot_class": "local_push", "iot_class": "local_push",
"usb": [ "usb": [
{"vid":"0658","pid":"0200","known_devices":["Aeotec Z-Stick Gen5+", "Z-WaveMe UZB"]}, {"vid":"0658","pid":"0200","known_devices":["Aeotec Z-Stick Gen5+", "Z-WaveMe UZB"]},
{"vid":"10C4","pid":"8A2A","known_devices":["Nortek HUSBZB-1"]}, {"vid":"10C4","pid":"8A2A","description":"*z-wave*","known_devices":["Nortek HUSBZB-1"]},
{"vid":"10C4","pid":"EA60","known_devices":["Aeotec Z-Stick 7", "Silicon Labs UZB-7", "Zooz ZST10 700"]} {"vid":"10C4","pid":"EA60","known_devices":["Aeotec Z-Stick 7", "Silicon Labs UZB-7", "Zooz ZST10 700"]}
] ]
} }

View File

@ -32,7 +32,8 @@ USB = [
{ {
"domain": "zwave_js", "domain": "zwave_js",
"vid": "10C4", "vid": "10C4",
"pid": "8A2A" "pid": "8A2A",
"description": "*z-wave*"
}, },
{ {
"domain": "zwave_js", "domain": "zwave_js",

View File

@ -756,10 +756,7 @@ async def test_usb_discovery_already_running(hass, supervisor, addon_running):
@pytest.mark.parametrize( @pytest.mark.parametrize(
"discovery_info", "discovery_info",
[ [CP2652_ZIGBEE_DISCOVERY_INFO],
NORTEK_ZIGBEE_DISCOVERY_INFO,
CP2652_ZIGBEE_DISCOVERY_INFO,
],
) )
async def test_abort_usb_discovery_aborts_specific_devices( async def test_abort_usb_discovery_aborts_specific_devices(
hass, supervisor, addon_options, discovery_info hass, supervisor, addon_options, discovery_info