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
This commit is contained in:
parent
2c8feefb04
commit
5c3b457511
2 changed files with 13 additions and 14 deletions
|
|
@ -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")
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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" }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue