From 5d1dc5738c034291bce5ae25f8d839d0913445c4 Mon Sep 17 00:00:00 2001 From: Nicolas Dujardin Date: Sun, 24 Mar 2019 15:28:52 +0100 Subject: [PATCH] still reporting 0.6.1 --- harmonyAsSwitches.js | 3 ++- harmonyAsTVPlatform.js | 1 + harmonyBase.js | 19 ++++++++++--------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/harmonyAsSwitches.js b/harmonyAsSwitches.js index 368777a..1f15518 100644 --- a/harmonyAsSwitches.js +++ b/harmonyAsSwitches.js @@ -176,6 +176,7 @@ HarmonyPlatformAsSwitches.prototype = { this.refreshService(service, undefined); } } + this.harmonyBase.refreshHomeAccessory(this); }, handleActivityOk: function(commandToSend) { @@ -216,7 +217,7 @@ HarmonyPlatformAsSwitches.prototype = { for (let a = 0; a < homebridgeAccessory.services.length; a++) { if (homebridgeAccessory.services[a].ActivityId == idToFind) { service = homebridgeAccessory.services[a]; - this.log('INFO - ' + service.displayName + ' activated'); + this.log.debug('INFO - ' + service.displayName + ' activated'); break; } } diff --git a/harmonyAsTVPlatform.js b/harmonyAsTVPlatform.js index d2c272e..4d6bc2f 100644 --- a/harmonyAsTVPlatform.js +++ b/harmonyAsTVPlatform.js @@ -293,6 +293,7 @@ HarmonyPlatformAsTVPlatform.prototype = { this.harmonyBase.refreshCurrentActivity(this, () => { this.handleRefreshOfCharacteristic(this._currentActivity); }); + this.harmonyBase.refreshHomeAccessory(this); }, refreshCharacteristic: function(characteristic, callback) { diff --git a/harmonyBase.js b/harmonyBase.js index 09f2b39..c90f281 100644 --- a/harmonyBase.js +++ b/harmonyBase.js @@ -202,12 +202,6 @@ HarmonyBase.prototype = { 'INFO - Hub config : ' + JSON.stringify(response) ); this.getHomeControlsAccessories(harmonyPlatform).then(responseHome => { - //DEBUG - - responseHome = JSON.parse( - ' {"cmd":"harmony.automation?getstate","code":200,"id":"0.11199321450018873","msg":"OK","data":{"hue-light.harmony_virtual_button_3":{"color":{"mode":"xy","xy":{"y":0,"x":0},"temp":300,"hueSat":{"hue":0,"sat":0}},"brightness":254,"on":true,"status":0},"hue-light.harmony_virtual_button_4":{"color":{"mode":"xy","xy":{"y":0,"x":0},"temp":300,"hueSat":{"hue":0,"sat":0}},"brightness":254,"on":false,"status":0},"hue-light.harmony_virtual_button_1":{"color":{"mode":"xy","xy":{"y":0,"x":0},"temp":300,"hueSat":{"hue":0,"sat":0}},"brightness":254,"on":false,"status":0},"hue-light.harmony_virtual_button_2":{"color":{"mode":"xy","xy":{"y":0,"x":0},"temp":300,"hueSat":{"hue":0,"sat":0}},"brightness":254,"on":false,"status":0}}}' - ); - harmonyPlatform.readAccessories(response, responseHome); this.numberAttemps = 0; }); @@ -306,7 +300,7 @@ HarmonyBase.prototype = { for (let s = 0; s < myHarmonyAccessory.services.length; s++) { let service = myHarmonyAccessory.services[s]; if (service.type == HOME_TYPE) { - let newValue = data[service.id]; + let newValue = data[service.HomeId]; if (newValue) { let characteristic = service.getCharacteristic(Characteristic.On); @@ -395,6 +389,13 @@ HarmonyBase.prototype = { return this.harmony.getAutomationCommands(); } else { var responseHome = {}; + //DEBUG + /* + responseHome = JSON.parse( + ' {"cmd":"harmony.automation?getstate","code":200,"id":"0.11199321450018873","msg":"OK","data":{"hue-light.harmony_virtual_button_3":{"color":{"mode":"xy","xy":{"y":0,"x":0},"temp":300,"hueSat":{"hue":0,"sat":0}},"brightness":254,"on":true,"status":0},"hue-light.harmony_virtual_button_4":{"color":{"mode":"xy","xy":{"y":0,"x":0},"temp":300,"hueSat":{"hue":0,"sat":0}},"brightness":254,"on":false,"status":0},"hue-light.harmony_virtual_button_1":{"color":{"mode":"xy","xy":{"y":0,"x":0},"temp":300,"hueSat":{"hue":0,"sat":0}},"brightness":254,"on":false,"status":0},"hue-light.harmony_virtual_button_2":{"color":{"mode":"xy","xy":{"y":0,"x":0},"temp":300,"hueSat":{"hue":0,"sat":0}},"brightness":254,"on":false,"status":0}}}' + ); +*/ + return Promise.resolve(responseHome); } }, @@ -834,9 +835,9 @@ HarmonyBase.prototype = { if ( responseHome && responseHome.data && - responseHome.data[service.controlService.id] + responseHome.data[service.HomeId] ) - newValue = responseHome.data[service.controlService.id].on; + newValue = responseHome.data[service.HomeId].on; this.handleCharacteristicUpdate( harmonyPlatform,