From 261e6beeafc5a8ddd1ceb6c98d71ffbd2d4b7c26 Mon Sep 17 00:00:00 2001 From: Timo Schilling Date: Thu, 19 Jan 2023 20:47:07 +0100 Subject: [PATCH 1/2] improve rgbw and cct labeling (#1195) --- fs_src/script.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fs_src/script.js b/fs_src/script.js index 76d7e61d..702e4f5d 100644 --- a/fs_src/script.js +++ b/fs_src/script.js @@ -730,8 +730,19 @@ function updateComponent(cd) { if (cd.type == Component_Type.kLightBulb) { if (cd.bulb_type == LightBulbController_BulbType.kCCT) { headText = "CCT"; + if (lastInfo.model == "ShellyRGBW2") { + if (cd.id == 1) { + headText += " R/G"; + } else { + headText += " B/W"; + } + } } else if (cd.bulb_type == LightBulbController_BulbType.kRGBW) { - headText = "RGB"; + if (lastInfo.sys_mode == 4) { + headText = "RGBW"; + } else { + headText = "RGB"; + } } else { headText = "Light"; } From f6ac761fc61dec140a7692391805f5707519d38c Mon Sep 17 00:00:00 2001 From: Timo Schilling Date: Thu, 19 Jan 2023 21:47:49 +0100 Subject: [PATCH 2/2] improve power meter (#1196) --- fs_src/script.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fs_src/script.js b/fs_src/script.js index 702e4f5d..ceae40fe 100644 --- a/fs_src/script.js +++ b/fs_src/script.js @@ -673,11 +673,7 @@ function updateComponent(cd) { updateInnerText(el(c, "head"), headText); setValueIfNotModified(el(c, "name"), cd.name); el(c, "state").checked = cd.state; - if (cd.apower !== undefined) { - updateInnerText( - el(c, "power_stats"), `${Math.round(cd.apower)}W, ${cd.aenergy}Wh`); - el(c, "power_stats_container").style.display = "block"; - } + updatePowerStats(c, cd); if (cd.type == Component_Type.kLightBulb) { checkIfNotModified(el(c, "svc_hidden"), cd.svc_hidden); if (cd.hap_optional !== undefined && cd.hap_optional == 0) { @@ -750,12 +746,7 @@ function updateComponent(cd) { updateInnerText(el(c, "head"), headText); setValueIfNotModified(el(c, "name"), cd.name); el(c, "state").checked = cd.state; - if (cd.apower !== undefined) { - updateInnerText( - el(c, "power_stats"), - `${Math.round(cd.apower)}W, ${cd.aenergy}Wh`); - el(c, "power_stats_container").style.display = "block"; - } + updatePowerStats(c, cd); slideIfNotModified(el(c, "color_temperature"), cd.color_temperature); slideIfNotModified(el(c, "hue"), cd.hue); slideIfNotModified(el(c, "saturation"), cd.saturation); @@ -1080,6 +1071,15 @@ function updateElement(key, value, info) { } } +function updatePowerStats(c, cd) { + if (cd.apower === undefined) return; + + apower = Math.round(cd.apower * 10) / 10; + console.log(apower) + updateInnerText(el(c, "power_stats"), `${apower}W, ${cd.aenergy}Wh`); + el(c, "power_stats_container").style.display = "block"; +} + function getInfo() { return new Promise(function(resolve, reject) { if (pendingGetInfo) {