From 4c80bc793043b0842df1d938a0151675486f8210 Mon Sep 17 00:00:00 2001 From: Ranlvor Date: Sun, 15 Apr 2018 19:46:04 +0200 Subject: [PATCH 01/11] +Theken-Floalts --- config/rzl.js | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/config/rzl.js b/config/rzl.js index 2279c8f..4fcf024 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -177,10 +177,16 @@ const config : Config = { values: {} } }, + //Kuechen-Floalts floalt.topics("65537"), floalt.topics("65538"), floalt.topics("65539"), floalt.topics("65540"), + + //Theken-Floalts + floalt.topics("65543"), + floalt.topics("65544"), + esper_topics("afba40", "flyfry"), esper_topics("afba45", "alarm") ], @@ -638,6 +644,57 @@ const config : Config = { delayedApply: true } ] + }, + kitchen_counter_light: { + name: "Deckenlicht Theke", + position: [400, 440], + icon: "ceiling-light", + ui: [ + { + type: "section", + text: "Lampe Eingang" + }, + { + type: "slider", + min: 0, + max: 100, + text: "Helligkeit", + icon: "brightness-7", + topic: floalt.brightness("65544"), + delayedApply: true + }, + { + type: "slider", + min: 0, + max: 100, + text: "Farbtemperatur", + icon: "weather-sunset-down", + topic: floalt.color("65544"), + delayedApply: true + }, + { + type: "section", + text: "Lampe Hauptraum" + }, + { + type: "slider", + min: 0, + max: 100, + text: "Helligkeit", + icon: "brightness-7", + topic: floalt.brightness("65543"), + delayedApply: true + }, + { + type: "slider", + min: 0, + max: 100, + text: "Farbtemperatur", + icon: "weather-sunset-down", + topic: floalt.color("65543"), + delayedApply: true + } + ] } }, layers: [ From 2c8feefb0484a84d749802daced0d39223bd086c Mon Sep 17 00:00:00 2001 From: Ranlvor Date: Sun, 15 Apr 2018 20:32:27 +0200 Subject: [PATCH 02/11] =?UTF-8?q?+Batteriest=C3=A4nde=20Fernbedinungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/rzl.js | 32 ++++++++++++++++++++++++++++++-- config/utils.js | 19 +++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/config/rzl.js b/config/rzl.js index 4fcf024..60304bd 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -2,7 +2,7 @@ import type { Config } from "config/flowtypes"; import * as types from "config/types"; import { hex, rgb, rgba, rainbow } from "config/colors"; -import { esper_topics, esper_statistics, floalt } from "./utils"; +import { esper_topics, esper_statistics, floalt, remote } from "./utils"; const config : Config = { space: { @@ -182,10 +182,12 @@ const config : Config = { floalt.topics("65538"), floalt.topics("65539"), floalt.topics("65540"), + remote.topics("65536"), //Theken-Floalts floalt.topics("65543"), floalt.topics("65544"), + remote.topics("65542"), esper_topics("afba40", "flyfry"), esper_topics("afba45", "alarm") @@ -695,7 +697,33 @@ const config : Config = { delayedApply: true } ] - } + }, + remotes: { + name: "Fernbedinungen", + position: [400, 348], + icon: "remote", + iconColor: ({remote_65536_low, remote_65542_low}) => + ((remote_65536_low == "true") || (remote_65542_low == "true")) + ? hex("#ff0000") : hex("#000000"), + ui: [ + { + type: "progress", + icon: "battery", + min: 0, + max: 100, + text: "Tisch", + topic: "remote_65536_level" + }, + { + type: "progress", + icon: "battery", + min: 0, + max: 100, + text: "Theke", + topic: "remote_65542_level" + } + ] + }, }, layers: [ { diff --git a/config/utils.js b/config/utils.js index 4e96d9b..bfe593c 100644 --- a/config/utils.js +++ b/config/utils.js @@ -59,6 +59,25 @@ export const floalt = { }) } +export const remote = { + level: (remote_id: string) => `remote_${remote_id}_level`, + low: (remote_id: string) => `remote_${remote_id}_low`, + topics: (remote_id: string) => ({ + [ `remote_${remote_id}_level` ]: { + state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_level/state`, + command: ``, + defaultValue: "0", + values: {} + }, + [ `remote_${remote_id}_low` ]: { + state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_low/state`, + command: ``, + defaultValue: "OFF", + values: { true: "ON", false: "OFF" } + } + }) +} + export const esper_statistics = (name: string, prev_ui: Array = []) => ( prev_ui.concat([ From 5c3b45751153269fabf4e3b3a2ba2d188345616c Mon Sep 17 00:00:00 2001 From: Ranlvor Date: Mon, 16 Apr 2018 00:43:14 +0200 Subject: [PATCH 03/11] Improvements after talking to uwap - rename utils/remote to tradfri_remote because the name was to general - rename internal topics according to previous point - change type of battery remote low from string to boolean - do not use raw topic name in config, we have helper-functions for that - reformat iconColor to be a bit more readable --- config/rzl.js | 15 +++++++-------- config/utils.js | 12 ++++++------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/config/rzl.js b/config/rzl.js index 60304bd..7f9e124 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -2,7 +2,7 @@ import type { Config } from "config/flowtypes"; import * as types from "config/types"; import { hex, rgb, rgba, rainbow } from "config/colors"; -import { esper_topics, esper_statistics, floalt, remote } from "./utils"; +import { esper_topics, esper_statistics, floalt, tradfri_remote } from "./utils"; const config : Config = { space: { @@ -182,12 +182,12 @@ const config : Config = { floalt.topics("65538"), floalt.topics("65539"), floalt.topics("65540"), - remote.topics("65536"), + tradfri_remote.topics("65536"), //Theken-Floalts floalt.topics("65543"), floalt.topics("65544"), - remote.topics("65542"), + tradfri_remote.topics("65542"), esper_topics("afba40", "flyfry"), esper_topics("afba45", "alarm") @@ -702,9 +702,8 @@ const config : Config = { name: "Fernbedinungen", position: [400, 348], icon: "remote", - iconColor: ({remote_65536_low, remote_65542_low}) => - ((remote_65536_low == "true") || (remote_65542_low == "true")) - ? hex("#ff0000") : hex("#000000"), + iconColor: (state) => + (state[tradfri_remote.low("65536")] || state[tradfri_remote.low("65542")]) ? hex("#ff0000") : hex("#000000"), ui: [ { type: "progress", @@ -712,7 +711,7 @@ const config : Config = { min: 0, max: 100, text: "Tisch", - topic: "remote_65536_level" + topic: tradfri_remote.level("65536") }, { type: "progress", @@ -720,7 +719,7 @@ const config : Config = { min: 0, max: 100, text: "Theke", - topic: "remote_65542_level" + topic: tradfri_remote.level("65542") } ] }, diff --git a/config/utils.js b/config/utils.js index bfe593c..c19ddb0 100644 --- a/config/utils.js +++ b/config/utils.js @@ -59,21 +59,21 @@ export const floalt = { }) } -export const remote = { - level: (remote_id: string) => `remote_${remote_id}_level`, - low: (remote_id: string) => `remote_${remote_id}_low`, +export const tradfri_remote = { + level: (remote_id: string) => `tradfri_remote_${remote_id}_level`, + low: (remote_id: string) => `tradfri_remote_${remote_id}_low`, topics: (remote_id: string) => ({ - [ `remote_${remote_id}_level` ]: { + [ `tradfri_remote_${remote_id}_level` ]: { state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_level/state`, command: ``, defaultValue: "0", values: {} }, - [ `remote_${remote_id}_low` ]: { + [ `tradfri_remote_${remote_id}_low` ]: { state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_low/state`, command: ``, defaultValue: "OFF", - values: { true: "ON", false: "OFF" } + values: { [true]: "ON", [false]: "OFF" } } }) } From 3a34f345587b0da920008431f9a43fd46f45296d Mon Sep 17 00:00:00 2001 From: Ranlvor Date: Sat, 21 Apr 2018 12:40:08 +0200 Subject: [PATCH 04/11] use string instead of boolean Because array-keys are strings and it seems that they can not be booleans --- config/rzl.js | 2 +- config/utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/rzl.js b/config/rzl.js index 7f9e124..3cec3f3 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -703,7 +703,7 @@ const config : Config = { position: [400, 348], icon: "remote", iconColor: (state) => - (state[tradfri_remote.low("65536")] || state[tradfri_remote.low("65542")]) ? hex("#ff0000") : hex("#000000"), + ((state[tradfri_remote.low("65536")] == "true") || (state[tradfri_remote.low("65542")] == "true")) ? hex("#ff0000") : hex("#000000"), ui: [ { type: "progress", diff --git a/config/utils.js b/config/utils.js index c19ddb0..a4cce98 100644 --- a/config/utils.js +++ b/config/utils.js @@ -73,7 +73,7 @@ export const tradfri_remote = { state: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_low/state`, command: ``, defaultValue: "OFF", - values: { [true]: "ON", [false]: "OFF" } + values: { true: "ON", false: "OFF" } } }) } From 1f248a5e9a0c89f13e41b2bd5e19e775c2ab9619 Mon Sep 17 00:00:00 2001 From: Ranlvor Date: Sun, 29 Apr 2018 18:24:23 +0200 Subject: [PATCH 05/11] +2 neue Fernbedinungen --- config/rzl.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/config/rzl.js b/config/rzl.js index 3cec3f3..3ab9230 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -183,11 +183,13 @@ const config : Config = { floalt.topics("65539"), floalt.topics("65540"), tradfri_remote.topics("65536"), + tradfri_remote.topics("65547"), //Theken-Floalts floalt.topics("65543"), floalt.topics("65544"), tradfri_remote.topics("65542"), + tradfri_remote.topics("65546"), esper_topics("afba40", "flyfry"), esper_topics("afba45", "alarm") @@ -703,7 +705,7 @@ const config : Config = { position: [400, 348], icon: "remote", iconColor: (state) => - ((state[tradfri_remote.low("65536")] == "true") || (state[tradfri_remote.low("65542")] == "true")) ? hex("#ff0000") : hex("#000000"), + ((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"), ui: [ { type: "progress", @@ -713,6 +715,14 @@ const config : Config = { text: "Tisch", topic: tradfri_remote.level("65536") }, + { + type: "progress", + icon: "battery", + min: 0, + max: 100, + text: "Tisch 2", + topic: tradfri_remote.level("65547") + }, { type: "progress", icon: "battery", @@ -720,6 +730,14 @@ const config : Config = { max: 100, text: "Theke", topic: tradfri_remote.level("65542") + }, + { + type: "progress", + icon: "battery", + min: 0, + max: 100, + text: "Theke 2", + topic: tradfri_remote.level("65546") } ] }, From d93362edcb970b849707c2077f413d2dba87382d Mon Sep 17 00:00:00 2001 From: Ranlvor Date: Sun, 24 Jun 2018 16:27:59 +0200 Subject: [PATCH 06/11] 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" } } From 0e1b41f87c21488f86c38a758811ad47921d44bd Mon Sep 17 00:00:00 2001 From: uwap Date: Sun, 24 Jun 2018 16:38:04 +0200 Subject: [PATCH 07/11] Update rzl.js --- config/rzl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/rzl.js b/config/rzl.js index 0f2dc2f..b00e813 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -737,8 +737,8 @@ const config : Config = { position: [400, 348], icon: "remote", 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"), + ["65536", "65542", "65546", "65547"].some( + x => state[tradfri_remote.low(x)] == "true") ? hex("#ff0000") : hex("#000000"), ui: [ { type: "progress", From a34ca7c25c3630a50384e8ebcc017ecfff1a8779 Mon Sep 17 00:00:00 2001 From: uwap Date: Sun, 24 Jun 2018 16:42:36 +0200 Subject: [PATCH 08/11] RZL: Use mdi_battery for tradfri remote battery icons --- config/rzl.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/rzl.js b/config/rzl.js index b515f95..eac774d 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -769,7 +769,7 @@ const config : Config = { ui: [ { type: "progress", - icon: "battery", + icon: mdi_battery(tradfri_remote.level("65536")), min: 0, max: 100, text: "Tisch", @@ -777,7 +777,7 @@ const config : Config = { }, { type: "progress", - icon: "battery", + icon: mdi_battery(tradfri_remote.level("65547")), min: 0, max: 100, text: "Tisch 2", @@ -785,7 +785,7 @@ const config : Config = { }, { type: "progress", - icon: "battery", + icon: mdi_battery(tradfri_remote.level("65542")), min: 0, max: 100, text: "Theke", @@ -793,7 +793,7 @@ const config : Config = { }, { type: "progress", - icon: "battery", + icon: mdi_battery(tradfri_remote.level("65546")), min: 0, max: 100, text: "Theke 2", From aad1b59a96efe5b9a3e28d0ca15eef5c6e7f7833 Mon Sep 17 00:00:00 2001 From: uwap Date: Sun, 24 Jun 2018 16:46:29 +0200 Subject: [PATCH 09/11] Fix merge conflicts --- config/rzl.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/rzl.js b/config/rzl.js index eac774d..c21dd99 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -308,14 +308,14 @@ const config : Config = { olymp_printer: { name: "Drucker", position: [335, 90], - icon: "printer", + icon: mdi("printer"), iconColor: ({olymp_printer}) => olymp_printer == "on" ? hex("#00FF00") : hex("#000000"), ui: [ { type: "toggle", text: "Drucker", topic: "olymp_printer", - icon: "power" + icon: mdi("power") }, { type: "link", @@ -711,7 +711,7 @@ const config : Config = { kitchen_counter_light: { name: "Deckenlicht Theke", position: [400, 440], - icon: "ceiling-light", + icon: mdi("ceiling-light"), ui: [ { type: "section", @@ -722,7 +722,7 @@ const config : Config = { min: 0, max: 100, text: "Helligkeit", - icon: "brightness-7", + icon: mdi("brightness-7"), topic: floalt.brightness("65544"), delayedApply: true }, @@ -731,7 +731,7 @@ const config : Config = { min: 0, max: 100, text: "Farbtemperatur", - icon: "weather-sunset-down", + icon: mdi("weather-sunset-down"), topic: floalt.color("65544"), delayedApply: true }, @@ -744,7 +744,7 @@ const config : Config = { min: 0, max: 100, text: "Helligkeit", - icon: "brightness-7", + icon: mdi("brightness-7"), topic: floalt.brightness("65543"), delayedApply: true }, @@ -753,7 +753,7 @@ const config : Config = { min: 0, max: 100, text: "Farbtemperatur", - icon: "weather-sunset-down", + icon: mdi("weather-sunset-down"), topic: floalt.color("65543"), delayedApply: true } From fdce5b96458a643a090cb1ed13016ca84482f727 Mon Sep 17 00:00:00 2001 From: uwap Date: Sun, 24 Jun 2018 16:51:09 +0200 Subject: [PATCH 10/11] Add forgotten import --- config/rzl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/rzl.js b/config/rzl.js index c21dd99..0ffaa0e 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -2,7 +2,7 @@ import type { Config } from "config/flowtypes"; import * as types from "config/types"; import { hex, rgb, rgba, rainbow } from "config/colors"; -import { mdi, raw_mdi } from "config/icon"; +import { mdi, raw_mdi, mdi_battery } from "config/icon"; import { esper_topics, esper_statistics, floalt, tradfri_remote } from "./utils"; const config : Config = { @@ -762,7 +762,7 @@ const config : Config = { remotes: { name: "Fernbedinungen", position: [400, 348], - icon: "remote", + icon: mdi("remote"), 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"), From 6a5bf85c1eec432b242413553cf2b50bf4fe62fe Mon Sep 17 00:00:00 2001 From: uwap Date: Sun, 24 Jun 2018 16:55:44 +0200 Subject: [PATCH 11/11] RZL: Use the light switch icon instead of remote --- config/rzl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/rzl.js b/config/rzl.js index 0ffaa0e..81e50c6 100644 --- a/config/rzl.js +++ b/config/rzl.js @@ -762,7 +762,7 @@ const config : Config = { remotes: { name: "Fernbedinungen", position: [400, 348], - icon: mdi("remote"), + icon: mdi("light-switch"), 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"),