mqtt-control-map/config/rzl/olymp.js
2020-10-04 18:46:37 +02:00

113 lines
2.7 KiB
JavaScript

// @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 = {
...tasmota.topics("8", "ledOlymp"),
...esper.topics("afba45", "alarm"),
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"
}
};
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")
}
]
},
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")
}
};