From 717c17b77e5cd9660547ed9da85ff6677cea2a45 Mon Sep 17 00:00:00 2001 From: icanos Date: Mon, 23 Dec 2019 11:43:30 +0000 Subject: [PATCH] bug fix brightness > 254 toggles back --- plejd/ble.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plejd/ble.js b/plejd/ble.js index 5a258d6..4639cc4 100644 --- a/plejd/ble.js +++ b/plejd/ble.js @@ -92,7 +92,12 @@ class PlejdService extends EventEmitter { let i = 0; const transitionRef = setInterval(() => { - this._turnOn(id, parseInt((brightnessStep * i) + 1)); + let currentBrightness = parseInt((brightnessStep * i) + 1); + if (currentBrightness > 254) { + currentBrightness = 254; + } + + this._turnOn(id, currentBrightness); if (i >= steps) { clearInterval(transitionRef);