From 87ad14e2fe979311fa739a6d67b763be638b6132 Mon Sep 17 00:00:00 2001 From: SeydX Date: Mon, 28 Jun 2021 01:28:37 +0200 Subject: [PATCH] v6.0.9 --- CHANGELOG.md | 5 +++++ package-lock.json | 2 +- package.json | 2 +- .../smarthome/smarthome.handler.js | 20 +++++++++++++++---- src/accessories/smarthome/smarthome.utils.js | 1 + 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b47f091..23dc21d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +# v6.0.9 - 2021-06-28 + +## Other Changes +- Fixed an issue where changing lightbulb color didnt work + # v6.0.8 - 2021-06-27 ## Other Changes diff --git a/package-lock.json b/package-lock.json index cc05e07..46a18df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "homebridge-fritz-platform", - "version": "6.0.8", + "version": "6.0.9", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index dd59c36..371b7fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-fritz-platform", - "version": "6.0.8", + "version": "6.0.9", "description": "Homebridge Plugin to control FritzBox router, smarthome devices and more.", "main": "index.js", "funding": [ diff --git a/src/accessories/smarthome/smarthome.handler.js b/src/accessories/smarthome/smarthome.handler.js index 0743f90..796bfc2 100644 --- a/src/accessories/smarthome/smarthome.handler.js +++ b/src/accessories/smarthome/smarthome.handler.js @@ -1217,9 +1217,15 @@ class Handler { } } else { //color - let validHueSat = getValidColor(accessory, false, state); + //state = saturation + const hue = accessory + .getService(this.api.hap.Service.Lightbulb) + .getCharacteristic(this.api.hap.Characteristic.Hue).value; + + const validHueSat = getValidColor(hue, state); + logger.info( - `Hue ${validHueSat.hue} - Saturation ${validHueSat.sat}`, + `Hue ${hue} (${validHueSat.hue}) - Saturation ${state} (${validHueSat.sat})`, `${accessory.displayName} (${subtype})` ); @@ -1337,9 +1343,15 @@ class Handler { } } else { //color - let validHueSat = getValidColor(accessory, false, state); + //state = saturation + const hue = accessory + .getService(this.api.hap.Service.Lightbulb) + .getCharacteristic(this.api.hap.Characteristic.Hue).value; + + const validHueSat = getValidColor(hue, state); + logger.info( - `Hue ${validHueSat.hue} - Saturation ${validHueSat.sat}`, + `Hue ${hue} (${validHueSat.hue}) - Saturation ${state} (${validHueSat.sat})`, `${accessory.displayName} (${subtype})` ); diff --git a/src/accessories/smarthome/smarthome.utils.js b/src/accessories/smarthome/smarthome.utils.js index 813439f..e8e94ca 100644 --- a/src/accessories/smarthome/smarthome.utils.js +++ b/src/accessories/smarthome/smarthome.utils.js @@ -13,6 +13,7 @@ exports.colortemp2api = (param) => { }; exports.getValidColor = (hue, sat) => { + hue = Math.round(hue); sat = Math.round(sat); let hues = [35, 52, 92, 120, 160, 195, 212, 225, 266, 296, 335, 358];