Changes from pull request discussion

- simplyfy empty tradfri battery detection
- change command string format
This commit is contained in:
Ranlvor 2018-06-24 16:27:59 +02:00
parent 86f03ad3ef
commit d93362edcb
Signed by untrusted user who does not match committer: Ranlvor
GPG key ID: 5E12D04750EF6F8E
2 changed files with 5 additions and 4 deletions

View file

@ -736,8 +736,9 @@ const config : Config = {
name: "Fernbedinungen", name: "Fernbedinungen",
position: [400, 348], position: [400, 348],
icon: "remote", icon: "remote",
iconColor: (state) => iconColor: (state) => //if any remote is low make icon red
((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"), ["65536", "65542", "65546", "65547"
].some(x => state[tradfri_remote.low(x)] == "true") ? hex("#ff0000") : hex("#000000"),
ui: [ ui: [
{ {
type: "progress", type: "progress",

View file

@ -65,13 +65,13 @@ export const tradfri_remote = {
topics: (remote_id: string) => ({ topics: (remote_id: string) => ({
[ `tradfri_remote_${remote_id}_level` ]: { [ `tradfri_remote_${remote_id}_level` ]: {
state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_level/state`, state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_level/state`,
command: ``, command: "",
defaultValue: "0", defaultValue: "0",
values: {} values: {}
}, },
[ `tradfri_remote_${remote_id}_low` ]: { [ `tradfri_remote_${remote_id}_low` ]: {
state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_low/state`, state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_low/state`,
command: ``, command: "",
defaultValue: "OFF", defaultValue: "OFF",
values: { true: "ON", false: "OFF" } values: { true: "ON", false: "OFF" }
} }