From 98f1ca84b0381606f737760b1e119c616202f5e8 Mon Sep 17 00:00:00 2001 From: Michal Szafranski Date: Sat, 2 Nov 2019 10:36:06 +0100 Subject: [PATCH 1/2] allow switching to mode 0 --- src/hub.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hub.ts b/src/hub.ts index 9702d29..d526de2 100644 --- a/src/hub.ts +++ b/src/hub.ts @@ -149,7 +149,7 @@ export class Hub extends EventEmitter { public subscribe (port: string, mode?: number) { return new Promise((resolve, reject) => { let newMode = this._getModeForDeviceType(this._portLookup(port).type); - if (mode) { + if (mode !== undefined) { newMode = mode; } this._activatePortDevice(this._portLookup(port).value, this._portLookup(port).type, newMode, 0x00, () => { From 822d3da5d97765bbcb4745e60d4db8ee26785268 Mon Sep 17 00:00:00 2001 From: Michal Szafranski Date: Sat, 2 Nov 2019 09:37:18 +0100 Subject: [PATCH 2/2] Fix ts error --- src/wedo2smarthub.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wedo2smarthub.ts b/src/wedo2smarthub.ts index 143c6cf..d1d6965 100644 --- a/src/wedo2smarthub.ts +++ b/src/wedo2smarthub.ts @@ -315,7 +315,7 @@ export class WeDo2SmartHub extends Hub { const keys = Object.keys(Consts.BLECharacteristic); for (let i = 0; i < keys.length; i++) { const key = keys[i]; - if (Consts.BLECharacteristic[key as any] === uuid) { + if (Consts.BLECharacteristic[key as keyof typeof Consts.BLECharacteristic] === uuid) { return key; } }