From 5330175a5b5638767750cb264c67da4cd41243c1 Mon Sep 17 00:00:00 2001 From: leoneleone Date: Sun, 2 Sep 2018 21:20:41 +0100 Subject: [PATCH 1/3] Reverse Night Mode function, behaves like a norma light switch Night Mode switch renamed LED. Reverse switch function so that it behaves like a normal light switch. Either the Fan LED is ON or OFF. This helps with Siri Commands like "Turn of all the lights". The Fan LED light then get put into "Night Mode" or an OFF setting. This approach is far more logical within the HomeKit ecosystem. --- DysonLinkAccessory.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DysonLinkAccessory.js b/DysonLinkAccessory.js index aaa3412..be935c7 100644 --- a/DysonLinkAccessory.js +++ b/DysonLinkAccessory.js @@ -128,7 +128,7 @@ class DysonLinkAccessory { if(this.nightModeVisible) { this.log.info("Night mode button is added"); - this.nightModeSwitch = this.getServiceBySubtype(Service.Switch, "Night Mode - " + this.displayName, "Night Mode"); + this.nightModeSwitch = this.getServiceBySubtype(Service.Switch, "LED - " + this.displayName, "LED");//changed name to LED (and reversing the Night Mode switch to function as a normal light. Either the Fan LED Light is ON or OFF. this.nightModeSwitch .getCharacteristic(Characteristic.On) @@ -294,4 +294,4 @@ class DysonLinkAccessory { module.exports = { DysonLinkAccessory, setHomebridge -} \ No newline at end of file +} From acd17fdff29b0d822c0a8f756cb92a2e644dccf7 Mon Sep 17 00:00:00 2001 From: leoneleone Date: Sun, 2 Sep 2018 21:42:41 +0100 Subject: [PATCH 2/3] Reverse this._nightMode result reading DysonNightMode ON = HomeKit Fan LED light OFF --- DysonFanState.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DysonFanState.js b/DysonFanState.js index a65171f..048e81b 100644 --- a/DysonFanState.js +++ b/DysonFanState.js @@ -26,7 +26,7 @@ class DysonFanState { (this.getFieldValue(newState, "auto") === "ON" && this._fan); this._rotate = this.getFieldValue(newState, "oson") === "ON"; - this._nightMode = this.getFieldValue(newState, "nmod") === "ON"; + this._nightMode = this.getFieldValue(newState, "nmod") === "ON" ? false : true; this._speed = (Number.parseInt(this.getFieldValue(newState, "fnsp"))||5) * 10; if (this.heatAvailable) { this._heat = this.getFieldValue(newState, "hmod") === "HEAT"; From f7271b08cddf9659a3659b6cd96d5aea1f6e8764 Mon Sep 17 00:00:00 2001 From: leoneleone Date: Sun, 2 Sep 2018 21:47:01 +0100 Subject: [PATCH 3/3] Reverse setNightMode / isNightMode functionality. this.nightMode ? false : true --- DysonLinkDevice.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DysonLinkDevice.js b/DysonLinkDevice.js index 21a4e1e..2ef70de 100644 --- a/DysonLinkDevice.js +++ b/DysonLinkDevice.js @@ -236,13 +236,13 @@ class DysonLinkDevice { } setNightMode(value, callback) { - this.setState({ nmod: value ? "ON" : "OFF" }); + this.setState({ nmod: value ? "OFF" : "ON" }); this.isNightMode(callback); } isNightMode(callback) { this.mqttEvent.once(this.STATE_EVENT, () => { - this.log.info(this.displayName + " - Night Mode: " + this.fanState.nightMode); + this.log.info(this.displayName + " - Night Mode: " + this.fanState.nightMode);//this.fanState.nightMode has been reversed to function in HomeKit as an LED light on/off. callback(null, this.fanState.nightMode); }); // Request for update