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"; 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 +} 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