From ab02aeb9c6a9f4882733a634dfb18dd0ad966f7b Mon Sep 17 00:00:00 2001 From: bueny Date: Tue, 17 May 2022 18:08:04 +0200 Subject: [PATCH] Rename darkMode internal to darkModeOnStateChange to make things more clear for the upcoming darkModeOnModeChange flag --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 239869b..d7f9e12 100644 --- a/index.js +++ b/index.js @@ -29,6 +29,7 @@ class MiLightHubPlatform { this.forceHTTP = config.forceHTTP || false; this.debug = config.debug || false; this.darkMode = config.darkMode || false; + this.darkModeOnStateChange = this.darkMode; this.host = config.host || 'milight-hub.local'; this.syncHubInterval = config.syncHubInterval || 10; this.commandDelay = config.commandDelay || 100; @@ -566,7 +567,7 @@ if(this.adaptiveLightingController && this.adaptiveLightingController.isAdaptive command.state = 'On'; // Dark Mode - if (this.platform.darkMode) { // set cached level for dark mode + if (this.platform.darkModeOnStateChange) { // set cached level for dark mode if (typeof dstate.level === 'undefined' && typeof cstate.cachedLevel !== 'undefined' && (dstate.state === true || cstate.state !== false)) { dstate.level = cstate.cachedLevel; } else if (typeof dstate.level === 'number') { @@ -593,7 +594,7 @@ if(this.adaptiveLightingController && this.adaptiveLightingController.isAdaptive command.state = 'Off'; // Dark Mode - if (this.platform.darkMode) { + if (this.platform.darkModeOnStateChange) { if (cstate.level !== 1) { cstate.cachedLevel = cstate.level; }