RZL: Add kitchen floalt light

This commit is contained in:
uwap 2018-04-07 20:32:41 +02:00
parent 75f2aea345
commit ff67bcf2f8
5 changed files with 134 additions and 9 deletions

View file

@ -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 } from "./utils";
import { esper_topics, esper_statistics, floalt } from "./utils";
const config : Config = {
space: {
@ -165,6 +165,10 @@ const config : Config = {
type: msg => JSON.parse(msg.toString()).progress || 0
}
},
floalt.topics("65537"),
floalt.topics("65538"),
floalt.topics("65539"),
floalt.topics("65540"),
esper_topics("afba40", "flyfry"),
esper_topics("afba45", "alarm")
],
@ -500,6 +504,101 @@ const config : Config = {
text: "Open Partkeepr"
}
]
},
kitchen_light: {
name: "Deckenlicht Küche",
position: [325, 407],
icon: "ceiling-light",
ui: [
{
type: "section",
text: "Lampe Eingang"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: "brightness-7",
topic: floalt.brightness("65537"),
delayedApply: true
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: "weather-sunset-down",
topic: floalt.color("65537"),
delayedApply: true
},
{
type: "section",
text: "Lampe Hauptraum"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: "brightness-7",
topic: floalt.brightness("65538"),
delayedApply: true
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: "weather-sunset-down",
topic: floalt.color("65538"),
delayedApply: true
},
{
type: "section",
text: "Lampe Spüle"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: "brightness-7",
topic: floalt.brightness("65539"),
delayedApply: true
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: "weather-sunset-down",
topic: floalt.color("65539"),
delayedApply: true
},
{
type: "section",
text: "Lampe Herd"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: "brightness-7",
topic: floalt.brightness("65540"),
delayedApply: true
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: "weather-sunset-down",
topic: floalt.color("65540"),
delayedApply: true
}
]
}
},
layers: [

View file

@ -40,6 +40,25 @@ export const esper_topics = (chip_id: string, name: string) => ({
}
});
export const floalt = {
color: (light_id: string) => `floalt_${light_id}_color`,
brightness: (light_id: string) => `floalt_${light_id}_brightness`,
topics: (light_id: string) => ({
[ `floalt_${light_id}_color` ]: {
state: `/service/openhab/out/tradfri_0220_gwb8d7af2b448f_${light_id}_color_temperature/state`,
command: `/service/openhab/in/tradfri_0220_gwb8d7af2b448f_${light_id}_color_temperature/command`,
defaultValue: "0",
values: {}
},
[ `floalt_${light_id}_brightness` ]: {
state: `/service/openhab/out/tradfri_0220_gwb8d7af2b448f_${light_id}_brightness/state`,
command: `/service/openhab/in/tradfri_0220_gwb8d7af2b448f_${light_id}_brightness/command`,
defaultValue: "0",
values: {}
}
})
}
export const esper_statistics = (name: string,
prev_ui: Array<ControlUI> = []) => (
prev_ui.concat([