From d93362edcb970b849707c2077f413d2dba87382d Mon Sep 17 00:00:00 2001 From: Ranlvor Date: Sun, 24 Jun 2018 16:27:59 +0200 Subject: [PATCH] Changes from pull request discussion - simplyfy empty tradfri battery detection - change command string format --- config/rzl.js | 5 +++-- config/utils.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/rzl.js b/config/rzl.js index 129d4ae..0f2dc2f 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -736,8 +736,9 @@ const config : Config = { name: "Fernbedinungen", position: [400, 348], icon: "remote", - iconColor: (state) => - ((state[tradfri_remote.low("65536")] == "true") || (state[tradfri_remote.low("65542")] == "true") || (state[tradfri_remote.low("65546")] == "true") || (state[tradfri_remote.low("65547")] == "true")) ? hex("#ff0000") : hex("#000000"), + iconColor: (state) => //if any remote is low make icon red + ["65536", "65542", "65546", "65547" + ].some(x => state[tradfri_remote.low(x)] == "true") ? hex("#ff0000") : hex("#000000"), ui: [ { type: "progress", diff --git a/config/utils.js b/config/utils.js index 4f9ad4a..3542ca0 100644 --- a/config/utils.js +++ b/config/utils.js @@ -65,13 +65,13 @@ export const tradfri_remote = { topics: (remote_id: string) => ({ [ `tradfri_remote_${remote_id}_level` ]: { state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_level/state`, - command: ``, + command: "", defaultValue: "0", values: {} }, [ `tradfri_remote_${remote_id}_low` ]: { state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_low/state`, - command: ``, + command: "", defaultValue: "OFF", values: { true: "ON", false: "OFF" } }