Merge remote-tracking branch 'upstream/master' into patch-22 to resolve merge conflicts

This commit is contained in:
Ranlvor 2018-09-02 03:02:30 +02:00
commit ff29ae7d5b
Signed by untrusted user who does not match committer: Ranlvor
GPG key ID: 5E12D04750EF6F8E
9 changed files with 888 additions and 796 deletions

View file

@ -1,11 +1,13 @@
// @flow
import type { Config } from "config/flowtypes";
import * as types from "config/types";
import { hex, rgb, rgba, rainbow } from "config/colors";
import { mdi, rawMdi, mdiBattery } from "config/icon";
import { esper_topics, esper_statistics, floalt, tradfri_remote, tasmota } from "./utils";
import { hex, rainbow } from "config/colors";
import { mdi, rawMdi } from "config/icon";
import { esper, tasmota } from "./utils";
import * as onkyo from "./onkyo";
import * as olymp from "./olymp";
import * as kitchen from "./kitchen";
const config: Config = {
space: {
@ -15,7 +17,7 @@ const config: Config = {
},
topics: [
{
led_stahltraeger: {
ledStahltraeger: {
state: {
name: "/service/openhab/out/pca301_ledstrips/state",
type: types.option({ ON: "on", OFF: "off" })
@ -88,28 +90,6 @@ const config: Config = {
},
defaultValue: "off"
},
videogames: {
state: {
name: "/service/openhab/out/pca301_videogames/state",
type: types.option({ ON: "on", OFF: "off" })
},
command: {
name: "/service/openhab/in/pca301_videogames/command",
type: types.option({ on: "ON", off: "OFF" })
},
defaultValue: "off"
},
olymp_pc: {
state: {
name: "/service/openhab/out/pca301_olymp_pc/state",
type: types.option({ ON: "on", OFF: "off" })
},
command: {
name: "/service/openhab/in/pca301_olymp_pc/command",
type: types.option({ on: "ON", off: "OFF" })
},
defaultValue: "off"
},
flyfry: {
state: {
name: "/service/openhab/out/wifi_flyfry/state",
@ -121,46 +101,35 @@ const config: Config = {
},
defaultValue: "off"
},
rundumleuchte: {
state: {
name: "/service/openhab/out/pca301_rundumleuchte/state",
type: types.option({ ON: "on", OFF: "off" })
},
command: {
name: "/service/openhab/in/pca301_rundumleuchte/command",
type: types.option({ on: "ON", off: "OFF" })
},
defaultValue: "off"
},
loetarbeitsplatz4: {
state: {
name: "stat/sonoff4/POWER",
type: types.option({ ON: "on", OFF: "off" })
},
defaultValue: "off",
defaultValue: "off"
},
loetarbeitsplatz5: {
state: {
name: "stat/sonoff5/POWER",
type: types.option({ ON: "on", OFF: "off" })
},
defaultValue: "off",
defaultValue: "off"
},
door_status: {
doorStatus: {
state: {
name: "/service/status",
type: types.option({ "\"open\"": "on", "\"closed\"": "off" })
},
defaultValue: "off"
},
presence_status: {
presenceStatus: {
state: {
name: "service/status/presence",
type: types.jsonArray
},
defaultValue: ""
},
devices_status: {
devicesStatus: {
state: {
name: "/service/status/devices",
type: types.string
@ -207,49 +176,16 @@ const config: Config = {
otherwise: "awaiting_interaction"
})
},
defaultValue: "unavailable",
defaultValue: "unavailable"
},
printer_3d_progress: {
state: {
name: "/service/ultimaker/job",
type: msg => JSON.parse(msg.toString()).progress || "0"
type: (msg) => JSON.parse(msg.toString()).progress || "0"
},
defaultValue: "0"
},
kitchen_light_color: {
state: {
name: "/service/openhab/out/kitchen_light_all_color_temperature/state",
type: types.string
},
command: {
name: "/service/openhab/in/kitchen_light_all_color_temperature/command",
type: types.string
},
defaultValue: "0"
},
kitchen_light_brightness: {
state: {
name: "/service/openhab/out/kitchen_light_all_brightness/state",
type: types.string
},
command: {
name: "/service/openhab/in/kitchen_light_all_brightness/command",
type: types.string
},
defaultValue: "0"
},
kitchen_sink_light_brightness: {
state: {
name: "/service/openhab/out/tradfri_0100_gwb8d7af2b448f_65545_brightness/state",
type: types.string
},
command: {
name: "/service/openhab/in/tradfri_0100_gwb8d7af2b448f_65545_brightness/command",
type: types.string
},
defaultValue: "0"
},
nebenraum_power_status: {
nebenraumPowerStatus: {
state: {
name: "/service/nebenraum-power",
type: types.option({ ON: "on", OFF: "off" })
@ -258,56 +194,30 @@ const config: Config = {
}
},
//Tasmota-Dosen
tasmota.topics("2", "olymp_printer"),
tasmota.topics("6", "snackbar"),
tasmota.topics("7", "infoscreen"),
tasmota.topics("8", "led_olymp"),
//Kuechen-Floalts
floalt.topics("65537"),
floalt.topics("65538"),
floalt.topics("65539"),
floalt.topics("65540"),
tradfri_remote.topics("65536"),
tradfri_remote.topics("65547"),
esper.topics("afba40", "flyfry"),
//Theken-Floalts
floalt.topics("65543"),
floalt.topics("65544"),
tradfri_remote.topics("65542"),
tradfri_remote.topics("65546"),
esper_topics("afba40", "flyfry"),
esper_topics("afba45", "alarm"),
onkyo.topics
onkyo.topics,
olymp.topics,
kitchen.topics
],
controls: {
...onkyo.controls,
...olymp.controls,
...kitchen.controls,
led_stahltrager: {
name: "LED Stahlträger",
position: [340, 590],
icon: mdi("white-balance-iridescent"),
iconColor: ({led_stahltraeger}) => led_stahltraeger == "on" ? rainbow : hex("#000000"),
iconColor: ({ledStahltraeger}) =>
(ledStahltraeger === "on" ? rainbow : hex("#000000")),
ui: [
{
type: "toggle",
text: "Stahlträger LED",
topic: "led_stahltraeger",
icon: mdi("power")
},
]
},
led_olymp: {
name: "LED Olymp",
position: [196, 154],
icon: mdi("white-balance-iridescent rotate-45"),
iconColor: tasmota.icon_color("led_olymp", rainbow),
ui: [
{
type: "toggle",
text: "LED Olymp",
topic: "led_olymp",
topic: "ledStahltraeger",
icon: mdi("power")
}
]
@ -316,7 +226,7 @@ const config: Config = {
name: "Snackbar",
position: [510, 500],
icon: mdi("fridge"),
iconColor: tasmota.icon_color("snackbar", hex("#E20074")),
iconColor: tasmota.iconColor("snackbar", hex("#E20074")),
ui: [
{
type: "toggle",
@ -378,8 +288,8 @@ const config: Config = {
name: "Twinkle",
position: [530, 560],
icon: ({twinkle}) =>
twinkle == "on" ? rawMdi("led-on flip-v") : rawMdi("led-off flip-v"),
iconColor: ({twinkle}) => twinkle == "on" ? rainbow : hex("#000000"),
(twinkle === "on" ? rawMdi("led-on flip-v") : rawMdi("led-off flip-v")),
iconColor: ({twinkle}) => (twinkle === "on" ? rainbow : hex("#000000")),
ui: [
{
type: "toggle",
@ -393,7 +303,7 @@ const config: Config = {
name: "Ventilator",
position: [530, 440],
icon: mdi("fan"),
iconColor: ({fan}) => fan == "on" ? hex("#00FF00") : hex("#000000"),
iconColor: ({fan}) => (fan === "on" ? hex("#00FF00") : hex("#000000")),
ui: [
{
type: "toggle",
@ -416,60 +326,13 @@ const config: Config = {
}
]
},
videogames: {
name: "Videospiele",
position: [100, 100],
icon: mdi("gamepad-variant"),
iconColor: ({videogames}) => videogames == "on" ? hex("#00FF00") : hex("#000000"),
ui: [
{
type: "toggle",
text: "Videospiele",
topic: "videogames",
icon: mdi("power")
}
]
},
olymp_pc: {
name: "Rechner",
position: [297, 90],
icon: mdi("desktop-classic"),
iconColor: ({olymp_pc}) => olymp_pc == "on" ? hex("#00FF00") : hex("#000000"),
ui: [
{
type: "toggle",
text: "Rechner",
topic: "olymp_pc",
icon: mdi("power")
}
]
},
olymp_printer: {
name: "Drucker",
position: [335, 90],
icon: mdi("printer"),
iconColor: tasmota.icon_color("olymp_printer"),
ui: [
{
type: "toggle",
text: "Drucker",
topic: "olymp_printer",
icon: mdi("power")
},
{
type: "link",
link: "http://annette.rzl/",
text: "Open Annette",
icon: mdi("open-in-new")
}
]
},
flyfry: {
name: "Fliegenbratgerät",
position: [450, 570],
icon: mdi("fire"),
iconColor: ({flyfry}) => flyfry == "on" ? hex("#6666FF") : hex("#000000"),
ui: esper_statistics("flyfry", [
iconColor: ({flyfry}) =>
(flyfry === "on" ? hex("#6666FF") : hex("#000000")),
ui: esper.statistics("flyfry", [
{
type: "toggle",
text: "Fliegenbratgerät",
@ -488,28 +351,14 @@ const config: Config = {
transient_off: hex("#b3b300"),
on: hex("#00ff00"),
off: hex("#000000"),
unknown: hex("#888888"),
unknown: hex("#888888")
})[projector],
ui: [
{
type: "toggle",
text: "Beamer",
topic: "projector",
toggled: val => val == "transient_on" || val == "on",
icon: mdi("power")
}
]
},
rundumleuchte: {
name: "Rundumleuchte",
position: [310,275],
icon: mdi("alarm-light"),
iconColor: ({rundumleuchte}) => rundumleuchte == "on" ? hex("#F0DF10") : hex("#000000"),
ui: [
{
type: "toggle",
text: "Rundumleuchte",
topic: "rundumleuchte",
toggled: (val) => val === "transient_on" || val === "on",
icon: mdi("power")
}
]
@ -518,7 +367,8 @@ const config: Config = {
name: "Lötarbeitsplatz",
position: [205, 455],
icon: mdi("eyedropper-variant"),
iconColor: ({loetarbeitsplatz4}) => loetarbeitsplatz4 == "on" ? hex("#FF0000") : hex("#000000"),
iconColor: ({loetarbeitsplatz4}) =>
(loetarbeitsplatz4 === "on" ? hex("#FF0000") : hex("#000000")),
ui: [
{
type: "text",
@ -532,7 +382,8 @@ const config: Config = {
name: "Lötarbeitsplatz",
position: [205, 405],
icon: mdi("eyedropper-variant"),
iconColor: ({loetarbeitsplatz5}) => loetarbeitsplatz5 == "on" ? hex("#FF0000") : hex("#000000"),
iconColor: ({loetarbeitsplatz5}) =>
(loetarbeitsplatz5 === "on" ? hex("#FF0000") : hex("#000000")),
ui: [
{
type: "text",
@ -542,18 +393,12 @@ const config: Config = {
}
]
},
alarm: {
name: "Alarm",
position: [340, 250],
icon: mdi("alarm-bell"),
iconColor: () => hex("#000000"),
ui: esper_statistics("alarm")
},
door: {
name: "Tür",
position: [455,350],
position: [455, 350],
icon: mdi("swap-vertical"),
iconColor: ({door_status}) => door_status == "on" ? hex("#00FF00") : hex("#FF0000"),
iconColor: ({doorStatus}) =>
(doorStatus === "on" ? hex("#00FF00") : hex("#FF0000")),
ui: [
{
type: "link",
@ -564,13 +409,13 @@ const config: Config = {
{
type: "text",
text: "Anwesend",
topic: "presence_status",
topic: "presenceStatus",
icon: mdi("account")
},
{
type: "text",
text: "Devices",
topic: "devices_status",
topic: "devicesStatus",
icon: mdi("wifi")
}
@ -580,7 +425,7 @@ const config: Config = {
name: "Infoscreen",
position: [255, 495],
icon: mdi("television-guide flip-v"),
iconColor: tasmota.icon_color("infoscreen", hex("#4444FF")),
iconColor: tasmota.iconColor("infoscreen", hex("#4444FF")),
ui: [
{
type: "toggle",
@ -600,7 +445,7 @@ const config: Config = {
name: "Ultimaker 3",
position: [754, 560],
icon: mdi("printer-3d"),
iconColor: ({printer_3d_status}) =>
iconColor: ({printer_3d_status}) =>
({
awaiting_interaction: hex("#b3b300"),
printing: hex("#00ff00"),
@ -642,244 +487,19 @@ const config: Config = {
}
]
},
kitchen_light: {
name: "Deckenlicht Küche",
position: [325, 407],
icon: mdi("ceiling-light"),
ui: [
{
type: "toggle",
on: "50",
off: "0",
toggled: n => parseInt(n) > 0,
topic: "kitchen_light_brightness",
text: "Ein/Ausschalten",
icon: mdi("power")
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: "kitchen_light_brightness"
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: "kitchen_light_color"
},
{
type: "section",
text: "Lampe Eingang"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65537")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65537")
},
{
type: "section",
text: "Lampe Hauptraum"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65538")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65538")
},
{
type: "section",
text: "Lampe Spüle"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65539")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65539")
},
{
type: "section",
text: "Lampe Herd"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65540")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65540")
}
]
},
kitchen_sink_light: {
name: "Licht Spüle",
position: [300, 345],
icon: mdi("wall-sconce-flat"),
ui: [
{
type: "toggle",
on: "50",
off: "0",
toggled: n => parseInt(n) > 0,
topic: "kitchen_sink_light_brightness",
text: "Ein/Ausschalten",
icon: mdi("power")
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: "kitchen_sink_light_brightness"
}
]
},
kitchen_counter_light: {
name: "Deckenlicht Theke",
position: [400, 440],
icon: mdi("ceiling-light"),
ui: [
{
type: "section",
text: "Lampe Eingang"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65544")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65544")
},
{
type: "section",
text: "Lampe Hauptraum"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65543")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65543")
}
]
},
remotes: {
name: "Fernbedinungen",
position: [400, 344],
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"),
ui: [
{
type: "progress",
icon: mdiBattery(tradfri_remote.level("65536")),
min: 0,
max: 100,
text: "Licht Tisch 1",
topic: tradfri_remote.level("65536")
},
{
type: "progress",
icon: mdiBattery(tradfri_remote.level("65547")),
min: 0,
max: 100,
text: "Licht Tisch 2",
topic: tradfri_remote.level("65547")
},
{
type: "progress",
icon: mdiBattery(tradfri_remote.level("65542")),
min: 0,
max: 100,
text: "Licht Theke 1",
topic: tradfri_remote.level("65542")
},
{
type: "progress",
icon: mdiBattery(tradfri_remote.level("65546")),
min: 0,
max: 100,
text: "Licht Theke 2",
topic: tradfri_remote.level("65546")
}
]
},
nebenraum_power_status: {
name: "Notaus Fablab",
nebenraumPowerStatus: {
name: "Strom Fablab",
position: [613, 537],
icon: ({nebenraum_power_status}) =>
nebenraum_power_status == "on" ? rawMdi("flash") : rawMdi("flash-off"),
iconColor: ({nebenraum_power_status}) =>
nebenraum_power_status == "on" ? hex("#00ff00") : hex("#000000"),
icon: ({nebenraumPowerStatus}) =>
(nebenraumPowerStatus === "on" ? rawMdi("flash") : rawMdi("flash-off")),
iconColor: ({nebenraumPowerStatus}) =>
(nebenraumPowerStatus === "on" ? hex("#00ff00") : hex("#000000")),
ui: [
{
type: "text",
icon: mdi("power"),
text: "Status Notaus",
topic: "nebenraum_power_status"
text: "Strom Fablab",
topic: "nebenraumPowerStatus"
}
]
}

290
config/rzl/kitchen.js Normal file
View file

@ -0,0 +1,290 @@
// @flow
import type { Topics, Controls } from "config/flowtypes";
import { mdi, mdiBattery } from "config/icon";
import { hex } from "config/colors";
import * as types from "config/types";
import { floalt, tradfri } from "./utils";
export const topics: Topics = {
//Kuechen-Floalts
...floalt.topics("65537"),
...floalt.topics("65538"),
...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"),
kitchenLightColor: {
state: {
name: "/service/openhab/out/kitchenLight_allColor_temperature"
+ "/state",
type: types.string
},
command: {
name: "/service/openhab/in/kitchenLight_allColor_temperature"
+ "/command",
type: types.string
},
defaultValue: "0"
},
kitchenLightBrightness: {
state: {
name: "/service/openhab/out/kitchenLight_allBrightness/state",
type: types.string
},
command: {
name: "/service/openhab/in/kitchenLight_allBrightness/command",
type: types.string
},
defaultValue: "0"
},
kitchenSinkLightBrightness: {
state: {
name: "/service/openhab/out/tradfri_0100_"
+ "gwb8d7af2b448f_65545Brightness/state",
type: types.string
},
command: {
name: "/service/openhab/in/tradfri_0100_"
+ "gwb8d7af2b448f_65545Brightness/command",
type: types.string
},
defaultValue: "0"
}
};
export const controls: Controls = {
kitchenLight: {
name: "Deckenlicht Küche",
position: [325, 407],
icon: mdi("ceiling-light"),
ui: [
{
type: "toggle",
on: "50",
off: "0",
toggled: (n) => parseInt(n, 10) > 0,
topic: "kitchenLightBrightness",
text: "Ein/Ausschalten",
icon: mdi("power")
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: "kitchenLightBrightness"
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: "kitchenLightColor"
},
{
type: "section",
text: "Lampe Eingang"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65537")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65537")
},
{
type: "section",
text: "Lampe Hauptraum"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65538")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65538")
},
{
type: "section",
text: "Lampe Spüle"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65539")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65539")
},
{
type: "section",
text: "Lampe Herd"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65540")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65540")
}
]
},
kitchenSinkLight: {
name: "Licht Spüle",
position: [300, 345],
icon: mdi("wall-sconce-flat"),
ui: [
{
type: "toggle",
on: "50",
off: "0",
toggled: (n) => parseInt(n, 10) > 0,
topic: "kitchenSinkLightBrightness",
text: "Ein/Ausschalten",
icon: mdi("power")
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: "kitchenSinkLightBrightness"
}
]
},
kitchenCounterLight: {
name: "Deckenlicht Theke",
position: [400, 440],
icon: mdi("ceiling-light"),
ui: [
{
type: "section",
text: "Lampe Eingang"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65544")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65544")
},
{
type: "section",
text: "Lampe Hauptraum"
},
{
type: "slider",
min: 0,
max: 100,
text: "Helligkeit",
icon: mdi("brightness-7"),
topic: floalt.brightness("65543")
},
{
type: "slider",
min: 0,
max: 100,
text: "Farbtemperatur",
icon: mdi("weather-sunset-down"),
topic: floalt.color("65543")
}
]
},
remotes: {
name: "Fernbedinungen",
position: [400, 344],
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")),
ui: [
{
type: "progress",
icon: mdiBattery(tradfri.remote.level("65536")),
min: 0,
max: 100,
text: "Licht Tisch 1",
topic: tradfri.remote.level("65536")
},
{
type: "progress",
icon: mdiBattery(tradfri.remote.level("65547")),
min: 0,
max: 100,
text: "Licht Tisch 2",
topic: tradfri.remote.level("65547")
},
{
type: "progress",
icon: mdiBattery(tradfri.remote.level("65542")),
min: 0,
max: 100,
text: "Licht Theke 1",
topic: tradfri.remote.level("65542")
},
{
type: "progress",
icon: mdiBattery(tradfri.remote.level("65546")),
min: 0,
max: 100,
text: "Licht Theke 2",
topic: tradfri.remote.level("65546")
}
]
}
};

134
config/rzl/olymp.js Normal file
View file

@ -0,0 +1,134 @@
// @flow
import type { Topics, Controls } from "config/flowtypes";
import { mdi } from "config/icon";
import { hex, rainbow } from "config/colors";
import * as types from "config/types";
import { tasmota, esper } from "./utils";
export const topics: Topics = {
videogames: {
state: {
name: "/service/openhab/out/pca301_videogames/state",
type: types.option({ ON: "on", OFF: "off" })
},
command: {
name: "/service/openhab/in/pca301_videogames/command",
type: types.option({ on: "ON", off: "OFF" })
},
defaultValue: "off"
},
olympPC: {
state: {
name: "/service/openhab/out/pca301_olymp_pc/state",
type: types.option({ ON: "on", OFF: "off" })
},
command: {
name: "/service/openhab/in/pca301_olymp_pc/command",
type: types.option({ on: "ON", off: "OFF" })
},
defaultValue: "off"
},
rundumleuchte: {
state: {
name: "/service/openhab/out/pca301_rundumleuchte/state",
type: types.option({ ON: "on", OFF: "off" })
},
command: {
name: "/service/openhab/in/pca301_rundumleuchte/command",
type: types.option({ on: "ON", off: "OFF" })
},
defaultValue: "off"
},
...tasmota.topics("2", "printerOlymp"),
...tasmota.topics("8", "ledOlymp"),
...esper.topics("afba45", "alarm")
};
export const controls: Controls = {
ledOlymp: {
name: "LED Olymp",
position: [196, 154],
icon: mdi("white-balance-iridescent rotate-45"),
iconColor: tasmota.iconColor("ledOlymp", rainbow),
ui: [
{
type: "toggle",
text: "LED Olymp",
topic: "ledOlymp",
icon: mdi("power")
}
]
},
videogames: {
name: "Videospiele",
position: [100, 100],
icon: mdi("gamepad-variant"),
iconColor: ({videogames}) =>
(videogames === "on" ? hex("#00FF00") : hex("#000000")),
ui: [
{
type: "toggle",
text: "Videospiele",
topic: "videogames",
icon: mdi("power")
}
]
},
olympPC: {
name: "Rechner",
position: [297, 90],
icon: mdi("desktop-classic"),
iconColor: ({olympPC}) =>
(olympPC === "on" ? hex("#00FF00") : hex("#000000")),
ui: [
{
type: "toggle",
text: "Rechner",
topic: "olympPC",
icon: mdi("power")
}
]
},
printerOlymp: {
name: "Drucker",
position: [335, 90],
icon: mdi("printer"),
iconColor: tasmota.iconColor("printerOlymp"),
ui: [
{
type: "toggle",
text: "Drucker",
topic: "printerOlymp",
icon: mdi("power")
},
{
type: "link",
link: "http://annette.rzl/",
text: "Open Annette",
icon: mdi("open-in-new")
}
]
},
rundumleuchte: {
name: "Rundumleuchte",
position: [310, 275],
icon: mdi("alarm-light"),
iconColor: ({rundumleuchte}) =>
(rundumleuchte === "on" ? hex("#F0DF10") : hex("#000000")),
ui: [
{
type: "toggle",
text: "Rundumleuchte",
topic: "rundumleuchte",
icon: mdi("power")
}
]
},
alarm: {
name: "Alarm",
position: [340, 250],
icon: mdi("alarm-bell"),
iconColor: () => hex("#000000"),
ui: esper.statistics("alarm")
}
};

View file

@ -5,7 +5,7 @@ import { hex } from "config/colors";
import * as types from "config/types";
export const topics: Topics = {
onkyo_connection: {
onkyoConnection: {
state: {
name: "/service/onkyo/connected",
type: types.option({
@ -16,7 +16,7 @@ export const topics: Topics = {
},
defaultValue: "disconnected"
},
onkyo_power: {
onkyoPower: {
state: {
name: "/service/onkyo/status/system-power",
type: types.json("onkyo_raw", types.option({
@ -30,7 +30,7 @@ export const topics: Topics = {
},
defaultValue: "off"
},
onkyo_mute: {
onkyoMute: {
state: {
name: "/service/onkyo/status/audio-muting",
type: types.json("onkyo_raw", types.option({
@ -44,7 +44,7 @@ export const topics: Topics = {
},
defaultValue: "off"
},
onkyo_volume: {
onkyoVolume: {
state: {
name: "/service/onkyo/status/volume",
type: types.json("val")
@ -55,7 +55,7 @@ export const topics: Topics = {
},
defaultValue: "0"
},
onkyo_inputs: {
onkyoInputs: {
state: {
name: "/service/onkyo/status/input-selector",
type: types.json("onkyo_raw", types.option({
@ -78,21 +78,21 @@ export const topics: Topics = {
unknown: "SLI00"
})
},
defaultValue: "unknown",
defaultValue: "unknown"
},
onkyo_radios: {
onkyoRadios: {
state: {
name: "/service/onkyo/status/latest-NPR",
type: types.option({
NPR01: "mpd",
NPR02: "kohina",
NPR03: "somafm_dronezone",
NPR04: "somafm_thetrip",
NPR03: "somafmDronezone",
NPR04: "somafmThetrip",
NPR05: "querfunk",
NPR06: "somafm_defconradio",
NPR07: "somafm_secretagent",
NPR08: "somafm_lush",
NPR09: "somafm_beatblender",
NPR06: "somafmDefconradio",
NPR07: "somafmSecretagent",
NPR08: "somafmLush",
NPR09: "somafmBeatblender",
NPR0a: "ponyville",
otherwise: "unknown"
})
@ -102,13 +102,13 @@ export const topics: Topics = {
type: types.option({
mpd: "NPR01",
kohina: "NPR02",
somafm_dronezone: "NPR03",
somafm_thetrip: "NPR04",
somafmDronezone: "NPR03",
somafmThetrip: "NPR04",
querfunk: "NPR05",
somafm_defconradio: "NPR06",
somafm_secretagent: "NPR07",
somafm_lush: "NPR08",
somafm_beatblender: "NPR09",
somafmDefconradio: "NPR06",
somafmSecretagent: "NPR07",
somafmLush: "NPR08",
somafmBeatblender: "NPR09",
ponyville: "NPR0a",
otherwise: "NPR00"
})
@ -118,87 +118,90 @@ export const topics: Topics = {
};
export const controls: Controls = {
onkyo: {
name: "Onkyo",
position: [350, 650],
iconColor: ({onkyo_connection, onkyo_power}) =>
onkyo_connection != "connected" ? hex("#888888") : (onkyo_power == "on" ? hex("#00FF00") : hex("#000000")),
icon: mdi("audio-video"),
ui: [
{
type: "toggle",
text: "Power",
icon: mdi("power"),
topic: "onkyo_power",
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
onkyo: {
name: "Onkyo",
position: [350, 650],
iconColor: ({onkyoConnection, onkyoPower}) =>
(onkyoConnection !== "connected" ? hex("#888888") :
(onkyoPower === "on" ? hex("#00FF00") : hex("#000000"))),
icon: mdi("audio-video"),
ui: [
{
type: "toggle",
text: "Power",
icon: mdi("power"),
topic: "onkyoPower",
enableCondition: (state) => state.onkyoConnection === "connected"
},
{
type: "section",
text: "Lautstärkeregelung"
},
{
type: "slider",
text: "Volume",
topic: "onkyoVolume",
min: 0,
max: 50,
icon: mdi("volume-high"),
enableCondition: (state) => state.onkyoConnection === "connected"
},
{
type: "toggle",
text: "Mute",
topic: "onkyoMute",
icon: mdi("volume-off"),
enableCondition: (state) => state.onkyoConnection === "connected"
},
{
type: "section",
text: "Eingänge"
},
{
type: "dropDown",
text: "Eingang",
topic: "onkyoInputs",
options: {
netzwerk: "Netzwerk",
tisch: "Tisch",
chromecast: "Chromecast",
pult: "Pult",
front: "Front HDMI"
},
{
type: "section",
text: "Lautstärkeregelung"
icon: mdi("usb"),
enableCondition: (state) => state.onkyoConnection === "connected"
},
{
type: "dropDown",
text: "Netzwerksender",
topic: "onkyoRadios",
options: {
mpd: "MPD",
kohina: "Kohina",
somafmDronezone: "Drone Zone (SomaFM)",
somafmThetrip: "The Trip (SomaFM)",
querfunk: "Querfunk",
somafmDefconradio: "Defcon Radio (SomaFM)",
somafmSecretagent: "Secret Agent (SomaFM)",
somafmLush: "Lush (SomaFM)",
somafmBeatblender: "Beat Blender (Soma FM)",
ponyville: "Ponyville FM",
unknown: "Unknown"
},
{
type: "slider",
text: "Volume",
topic: "onkyo_volume",
min: 0,
max: 50,
icon: mdi("volume-high"),
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
},
{
type: "toggle",
text: "Mute",
topic: "onkyo_mute",
icon: mdi("volume-off"),
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
},
{
type: "section",
text: "Eingänge"
},
{
type: "dropDown",
text: "Eingang",
topic: "onkyo_inputs",
options: {
netzwerk: "Netzwerk",
tisch: "Tisch",
chromecast: "Chromecast",
pult: "Pult",
front: "Front HDMI"
},
icon: mdi("usb"),
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
},
{
type: "dropDown",
text: "Netzwerksender",
topic: "onkyo_radios",
options: {
mpd: "MPD",
kohina: "Kohina",
somafm_dronezone: "Drone Zone (SomaFM)",
somafm_thetrip: "The Trip (SomaFM)",
querfunk: "Querfunk",
somafm_defconradio: "Defcon Radio (SomaFM)",
somafm_secretagent: "Secret Agent (SomaFM)",
somafm_lush: "Lush (SomaFM)",
somafm_beatblender: "Beat Blender (Soma FM)",
ponyville: "Ponyville FM"
},
icon: mdi("radio"),
enableCondition: (state) => state.onkyo_connection == "connected" && state.onkyo_inputs == "netzwerk"
},
{
type: "section",
text: "External"
},
{
type: "link",
link: "http://mpd.rzl/mpd/player/index.php",
text: "Open MPD Interface",
icon: mdi("open-in-new")
}
]
}
icon: mdi("radio"),
enableCondition: (state) => state.onkyoConnection === "connected"
&& state.onkyoInputs === "netzwerk"
},
{
type: "section",
text: "External"
},
{
type: "link",
link: "http://mpd.rzl/mpd/player/index.php",
text: "Open MPD Interface",
icon: mdi("open-in-new")
}
]
}
};

View file

@ -4,45 +4,6 @@ import { mdi } from "config/icon";
import { hex } from "config/colors";
import * as types from "config/types";
export const esper_topics = (chip_id: string, name: string) => ({
[ `esper_${name}_version` ]: {
state: {
name: `/service/esper/${chip_id}/info`,
type: types.json("version.esper")
},
defaultValue: "UNKNOWN"
},
[ `esper_${name}_ip` ]: {
state: {
name: `/service/esper/${chip_id}/info`,
type: types.json("network.ip")
},
defaultValue: "UNKNOWN"
},
[ `esper_${name}_rssi` ]: {
state: {
name: `/service/esper/${chip_id}/info`,
type: types.json("wifi.rssi")
},
defaultValue: "UNKNOWN"
},
[ `esper_${name}_uptime` ]: {
state: {
name: `/service/esper/${chip_id}/info`,
type: msg => new Date(JSON.parse(msg.toString()).time.startup * 1000)
.toLocaleString()
},
defaultValue: "UNKNOWN",
},
[ `esper_${name}_device` ]: {
state: {
name: `/service/esper/${chip_id}/info`,
type: types.json("device")
},
defaultValue: "UNKNOWN"
}
});
export const tasmota = {
topics: (id: string, name: string) => ({
[name]: {
@ -64,104 +25,158 @@ export const tasmota = {
defaultValue: "off"
},
}),
icon_color: (name: string, on_color: Color = hex("#00FF00")) => (state: State) => {
if (state[`${name}_online`] === "off") {
return hex("#888888");
} else {
if (state[name] === "on") {
return on_color;
iconColor: (name: string, onColor: Color = hex("#00FF00")) =>
(state: State) => {
if (state[`${name}_online`] === "off") {
return hex("#888888");
} else {
return hex("#000000");
if (state[name] === "on") {
return onColor;
} else {
return hex("#000000");
}
}
}
}
}
};
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` ]: {
color: (lightId: string) => `floalt_${lightId}_color`,
brightness: (lightId: string) => `floalt_${lightId}_brightness`,
topics: (lightId: string) => ({
[`floalt_${lightId}_color`]: {
state: {
name: `/service/openhab/out/tradfri_0220_gwb8d7af2b448f_${light_id}_color_temperature/state`,
name: `/service/openhab/out/tradfri_0220_gwb8d7af2b448f_${lightId}` +
"_color_temperature/state",
type: types.string
},
command: {
name: `/service/openhab/in/tradfri_0220_gwb8d7af2b448f_${light_id}_color_temperature/command`,
name: `/service/openhab/in/tradfri_0220_gwb8d7af2b448f_${lightId}` +
"_color_temperature/command",
type: types.string
},
defaultValue: "0"
},
[ `floalt_${light_id}_brightness` ]: {
[`floalt_${lightId}_brightness`]: {
state: {
name: `/service/openhab/out/tradfri_0220_gwb8d7af2b448f_${light_id}_brightness/state`,
name: `/service/openhab/out/tradfri_0220_gwb8d7af2b448f_${lightId}` +
"_brightness/state",
type: types.string
},
command: {
name: `/service/openhab/in/tradfri_0220_gwb8d7af2b448f_${light_id}_brightness/command`,
name: `/service/openhab/in/tradfri_0220_gwb8d7af2b448f_${lightId}` +
"_brightness/command",
type: types.string
},
defaultValue: "0"
}
})
}
};
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) => ({
[ `tradfri_remote_${remote_id}_level` ]: {
const tradfriRemote = {
level: (remoteId: string) => `tradfri_remote_${remoteId}_level`,
low: (remoteId: string) => `tradfri_remote_${remoteId}_low`,
topics: (remoteId: string) => ({
[`tradfri_remote_${remoteId}_level`]: {
state: {
name: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_level/state`,
name: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remoteId}` +
"_battery_level/state",
type: types.string
},
defaultValue: "0"
},
[ `tradfri_remote_${remote_id}_low` ]: {
[`tradfri_remote_${remoteId}_low`]: {
state: {
name: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remote_id}_battery_low/state`,
name: `/service/openhab/out/tradfri_0830_gwb8d7af2b448f_${remoteId}` +
"_battery_low/state",
type: types.option({ ON: "true", OFF: "false" })
},
defaultValue: "false",
defaultValue: "false"
}
})
}
};
export const esper_statistics = (name: string,
prev_ui: Array<ControlUI> = []): Array<ControlUI> => (
prev_ui.concat([
{
type: "section",
text: "Funkdose"
},
{
type: "text",
text: "Device Variant",
icon: mdi("chart-donut"),
topic: `esper_${name}_device`
},
{
type: "text",
text: "Version",
icon: mdi("source-branch"),
topic: `esper_${name}_version`
},
{
type: "text",
text: "IP",
icon: mdi("access-point-network"),
topic: `esper_${name}_ip`
},
{
type: "text",
text: "RSSI",
icon: mdi("wifi"),
topic: `esper_${name}_rssi`
},
{
type: "text",
text: "Running since…",
icon: mdi("av-timer"),
topic: `esper_${name}_uptime`
}
])
);
export const tradfri = {
remote: tradfriRemote
};
const esperStatistics = (name: string,
prevUI: Array<ControlUI> = []): Array<ControlUI> => (
prevUI.concat([
{
type: "section",
text: "Funkdose"
},
{
type: "text",
text: "Device Variant",
icon: mdi("chart-donut"),
topic: `esper_${name}_device`
},
{
type: "text",
text: "Version",
icon: mdi("source-branch"),
topic: `esper_${name}_version`
},
{
type: "text",
text: "IP",
icon: mdi("access-point-network"),
topic: `esper_${name}_ip`
},
{
type: "text",
text: "RSSI",
icon: mdi("wifi"),
topic: `esper_${name}_rssi`
},
{
type: "text",
text: "Running since…",
icon: mdi("av-timer"),
topic: `esper_${name}_uptime`
}
])
);
const esperTopics = (chipId: string, name: string) => ({
[`esper_${name}_version`]: {
state: {
name: `/service/esper/${chipId}/info`,
type: types.json("version.esper")
},
defaultValue: "UNKNOWN"
},
[`esper_${name}_ip`]: {
state: {
name: `/service/esper/${chipId}/info`,
type: types.json("network.ip")
},
defaultValue: "UNKNOWN"
},
[`esper_${name}_rssi`]: {
state: {
name: `/service/esper/${chipId}/info`,
type: types.json("wifi.rssi")
},
defaultValue: "UNKNOWN"
},
[`esper_${name}_uptime`]: {
state: {
name: `/service/esper/${chipId}/info`,
type: (msg) => new Date(JSON.parse(msg.toString()).time.startup * 1000)
.toLocaleString()
},
defaultValue: "UNKNOWN"
},
[`esper_${name}_device`]: {
state: {
name: `/service/esper/${chipId}/info`,
type: types.json("device")
},
defaultValue: "UNKNOWN"
}
});
export const esper = {
topics: esperTopics,
statistics: esperStatistics
};