From 7e0f7b17ab722964bc1683f1d11a3db29b54311b Mon Sep 17 00:00:00 2001 From: Nathan Kunicki Date: Thu, 16 Aug 2018 12:28:01 +0100 Subject: [PATCH] Fixed Wedo light implementation --- wedo2smarthub.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wedo2smarthub.ts b/wedo2smarthub.ts index 90cd355..991efb0 100644 --- a/wedo2smarthub.ts +++ b/wedo2smarthub.ts @@ -185,10 +185,10 @@ export class WeDo2SmartHub extends Hub { public setLightBrightness (port: string, brightness: number, time?: number) { const portObj = this._portLookup(port); return new Promise((resolve, reject) => { - const data = Buffer.from([this._portLookup(port).value, 0x01, 0x02, this._mapSpeed(brightness)]); + const data = Buffer.from([portObj.value, 0x01, 0x02, this._mapSpeed(brightness)]); this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data); setTimeout(() => { - const data = Buffer.from([this._portLookup(port).value, 0x01, 0x02, 0x00]); + const data = Buffer.from([portObj.value, 0x01, 0x02, 0x00]); this._writeMessage(Consts.BLECharacteristics.LPF2_ALL, data); return resolve(); }, time);