From 30003035dfd19e5417c4afc0ec20dacc6291066c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ndor=20Bal=C3=A1zs?= Date: Fri, 8 May 2020 14:20:52 +0200 Subject: [PATCH] auto detect zzh usb port --- zigpy_cc/uart.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zigpy_cc/uart.py b/zigpy_cc/uart.py index 14cd4e6..a6ee374 100644 --- a/zigpy_cc/uart.py +++ b/zigpy_cc/uart.py @@ -21,6 +21,12 @@ MinMessageLength = 5 MaxDataSize = 250 +'''' +0451: Texas Instruments +1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter + used in zzh - https://electrolama.com/projects/zig-a-zig-ah/ +''' +usb_regexp = "0451:|1a86:7523" class Parser: def __init__(self) -> None: @@ -161,7 +167,7 @@ async def connect(config: Dict[str, Any], api, loop=None) -> Gateway: port, baudrate = config[CONF_DEVICE_PATH], config[CONF_DEVICE_BAUDRATE] if port == "auto": - devices = list(serial.tools.list_ports.grep("0451:")) + devices = list(serial.tools.list_ports.grep(usb_regexp)) if devices: port = devices[0].device LOGGER.info("%s found at %s", devices[0].product, port)