From f031173ed3bf7f41110fadb1002006cfcc35d427 Mon Sep 17 00:00:00 2001 From: Jin Date: Sun, 17 Dec 2023 08:55:24 +0700 Subject: [PATCH] fix: skip invalid device id --- src/lib/ThinQ.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/ThinQ.ts b/src/lib/ThinQ.ts index 5d09195..295e9ba 100644 --- a/src/lib/ThinQ.ts +++ b/src/lib/ThinQ.ts @@ -49,7 +49,9 @@ export class ThinQ { return []; }); - return listDevices.map(dev => new Device(dev)); + return listDevices.map(device => new Device(device)) + // skip all device invalid id + .filter(device => device.id.match(/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/)); } public async setup(device: Device) {