RZL: Extract olymp.js

This commit is contained in:
uwap 2018-08-30 15:07:47 +02:00
parent 82f2d0ff50
commit 1263c56cfc
2 changed files with 138 additions and 123 deletions

View file

@ -6,6 +6,7 @@ import { mdi, rawMdi, mdiBattery } from "config/icon";
import { esper, floalt, tradfri, tasmota } from "./utils"; import { esper, floalt, tradfri, tasmota } from "./utils";
import * as onkyo from "./onkyo"; import * as onkyo from "./onkyo";
import * as olymp from "./olymp";
const config: Config = { const config: Config = {
space: { space: {
@ -48,28 +49,6 @@ const config: Config = {
}, },
defaultValue: "off" 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: { flyfry: {
state: { state: {
name: "/service/openhab/out/wifi_flyfry/state", name: "/service/openhab/out/wifi_flyfry/state",
@ -81,17 +60,6 @@ const config: Config = {
}, },
defaultValue: "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"
},
loetarbeitsplatz4: { loetarbeitsplatz4: {
state: { state: {
name: "stat/sonoff4/POWER", name: "stat/sonoff4/POWER",
@ -222,10 +190,8 @@ const config: Config = {
} }
}, },
//Tasmota-Dosen //Tasmota-Dosen
tasmota.topics("2", "olymp_printer"),
tasmota.topics("6", "snackbar"), tasmota.topics("6", "snackbar"),
tasmota.topics("7", "infoscreen"), tasmota.topics("7", "infoscreen"),
tasmota.topics("8", "led_olymp"),
//Kuechen-Floalts //Kuechen-Floalts
floalt.topics("65537"), floalt.topics("65537"),
@ -242,12 +208,13 @@ const config: Config = {
tradfri.remote.topics("65546"), tradfri.remote.topics("65546"),
esper.topics("afba40", "flyfry"), esper.topics("afba40", "flyfry"),
esper.topics("afba45", "alarm"),
onkyo.topics onkyo.topics,
olymp.topics
], ],
controls: { controls: {
...onkyo.controls, ...onkyo.controls,
...olymp.controls,
led_stahltrager: { led_stahltrager: {
name: "LED Stahlträger", name: "LED Stahlträger",
position: [340, 590], position: [340, 590],
@ -263,20 +230,6 @@ const config: Config = {
} }
] ]
}, },
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",
icon: mdi("power")
}
]
},
snackbar: { snackbar: {
name: "Snackbar", name: "Snackbar",
position: [510, 500], position: [510, 500],
@ -333,56 +286,6 @@ 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: { flyfry: {
name: "Fliegenbratgerät", name: "Fliegenbratgerät",
position: [450, 570], position: [450, 570],
@ -420,21 +323,6 @@ const config: Config = {
} }
] ]
}, },
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")
}
]
},
loetarbeitsplatz4: { loetarbeitsplatz4: {
name: "Lötarbeitsplatz", name: "Lötarbeitsplatz",
position: [205, 455], position: [205, 455],
@ -465,13 +353,6 @@ const config: Config = {
} }
] ]
}, },
alarm: {
name: "Alarm",
position: [340, 250],
icon: mdi("alarm-bell"),
iconColor: () => hex("#000000"),
ui: esper.statistics("alarm")
},
door: { door: {
name: "Tür", name: "Tür",
position: [455, 350], position: [455, 350],

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.icon_color("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.icon_color("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")
}
};