+Batteriestände Fernbedinungen

This commit is contained in:
Ranlvor 2018-04-15 20:32:27 +02:00
parent 4c80bc7930
commit 2c8feefb04
Signed by untrusted user who does not match committer: Ranlvor
GPG key ID: 5E12D04750EF6F8E
2 changed files with 49 additions and 2 deletions

View file

@ -2,7 +2,7 @@
import type { Config } from "config/flowtypes"; import type { Config } from "config/flowtypes";
import * as types from "config/types"; import * as types from "config/types";
import { hex, rgb, rgba, rainbow } from "config/colors"; 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 = { const config : Config = {
space: { space: {
@ -182,10 +182,12 @@ const config : Config = {
floalt.topics("65538"), floalt.topics("65538"),
floalt.topics("65539"), floalt.topics("65539"),
floalt.topics("65540"), floalt.topics("65540"),
remote.topics("65536"),
//Theken-Floalts //Theken-Floalts
floalt.topics("65543"), floalt.topics("65543"),
floalt.topics("65544"), floalt.topics("65544"),
remote.topics("65542"),
esper_topics("afba40", "flyfry"), esper_topics("afba40", "flyfry"),
esper_topics("afba45", "alarm") esper_topics("afba45", "alarm")
@ -695,7 +697,33 @@ const config : Config = {
delayedApply: true 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: [ layers: [
{ {

View file

@ -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, export const esper_statistics = (name: string,
prev_ui: Array<ControlUI> = []) => ( prev_ui: Array<ControlUI> = []) => (
prev_ui.concat([ prev_ui.concat([