From ec624c6773793b3325ff32688350cd8226d94779 Mon Sep 17 00:00:00 2001 From: icanos Date: Sat, 21 Dec 2019 15:52:35 +0000 Subject: [PATCH] moved turn off code for transition --- plejd/ble.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plejd/ble.js b/plejd/ble.js index f542aca..aa5919e 100644 --- a/plejd/ble.js +++ b/plejd/ble.js @@ -133,13 +133,20 @@ class PlejdService extends EventEmitter { if (i >= steps) { clearInterval(transitionRef); + + // finally, we turn it off + this._turnOff(id); } i++; }, 500); } + else { + this._turnOff(id); + } + } - // finally, we turn it off + _turnOff(id) { var payload = Buffer.from((id).toString(16).padStart(2, '0') + '0110009700', 'hex'); this.write(payload); }