Lint config/
This commit is contained in:
parent
2d43f238f7
commit
82f2d0ff50
6 changed files with 286 additions and 253 deletions
|
|
@ -19,6 +19,9 @@ module.exports = {
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"react", "flowtype"
|
"react", "flowtype"
|
||||||
],
|
],
|
||||||
|
"globals": {
|
||||||
|
"require": false
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
// possible errors
|
// possible errors
|
||||||
"getter-return": "error",
|
"getter-return": "error",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import type { Config } from "config/flowtypes";
|
import type { Config } from "config/flowtypes";
|
||||||
import { hex, rgb, rgba, rainbow } from "config/colors";
|
import { hex } from "config/colors";
|
||||||
import * as types from "config/types";
|
import * as types from "config/types";
|
||||||
import { mdi } from "config/icon";
|
import { mdi } from "config/icon";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
// @flow
|
// @flow
|
||||||
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, rainbow } from "config/colors";
|
||||||
import { mdi, rawMdi, mdiBattery } from "config/icon";
|
import { mdi, rawMdi, mdiBattery } from "config/icon";
|
||||||
import { esper_topics, esper_statistics, floalt, tradfri_remote, tasmota } from "./utils";
|
import { esper, floalt, tradfri, tasmota } from "./utils";
|
||||||
|
|
||||||
import * as onkyo from "./onkyo";
|
import * as onkyo from "./onkyo";
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@ const config: Config = {
|
||||||
},
|
},
|
||||||
topics: [
|
topics: [
|
||||||
{
|
{
|
||||||
led_stahltraeger: {
|
ledStahltraeger: {
|
||||||
state: {
|
state: {
|
||||||
name: "/service/openhab/out/pca301_ledstrips/state",
|
name: "/service/openhab/out/pca301_ledstrips/state",
|
||||||
type: types.option({ ON: "on", OFF: "off" })
|
type: types.option({ ON: "on", OFF: "off" })
|
||||||
|
|
@ -97,23 +97,23 @@ const config: Config = {
|
||||||
name: "stat/sonoff4/POWER",
|
name: "stat/sonoff4/POWER",
|
||||||
type: types.option({ ON: "on", OFF: "off" })
|
type: types.option({ ON: "on", OFF: "off" })
|
||||||
},
|
},
|
||||||
defaultValue: "off",
|
defaultValue: "off"
|
||||||
},
|
},
|
||||||
loetarbeitsplatz5: {
|
loetarbeitsplatz5: {
|
||||||
state: {
|
state: {
|
||||||
name: "stat/sonoff5/POWER",
|
name: "stat/sonoff5/POWER",
|
||||||
type: types.option({ ON: "on", OFF: "off" })
|
type: types.option({ ON: "on", OFF: "off" })
|
||||||
},
|
},
|
||||||
defaultValue: "off",
|
defaultValue: "off"
|
||||||
},
|
},
|
||||||
door_status: {
|
doorStatus: {
|
||||||
state: {
|
state: {
|
||||||
name: "/service/status",
|
name: "/service/status",
|
||||||
type: types.option({ "\"open\"": "on", "\"closed\"": "off" })
|
type: types.option({ "\"open\"": "on", "\"closed\"": "off" })
|
||||||
},
|
},
|
||||||
defaultValue: "off"
|
defaultValue: "off"
|
||||||
},
|
},
|
||||||
presence_status: {
|
presenceStatus: {
|
||||||
state: {
|
state: {
|
||||||
name: "service/status/presence",
|
name: "service/status/presence",
|
||||||
type: types.jsonArray
|
type: types.jsonArray
|
||||||
|
|
@ -167,22 +167,24 @@ const config: Config = {
|
||||||
otherwise: "awaiting_interaction"
|
otherwise: "awaiting_interaction"
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
defaultValue: "unavailable",
|
defaultValue: "unavailable"
|
||||||
},
|
},
|
||||||
printer_3d_progress: {
|
printer_3d_progress: {
|
||||||
state: {
|
state: {
|
||||||
name: "/service/ultimaker/job",
|
name: "/service/ultimaker/job",
|
||||||
type: msg => JSON.parse(msg.toString()).progress || "0"
|
type: (msg) => JSON.parse(msg.toString()).progress || "0"
|
||||||
},
|
},
|
||||||
defaultValue: "0"
|
defaultValue: "0"
|
||||||
},
|
},
|
||||||
kitchen_light_color: {
|
kitchen_light_color: {
|
||||||
state: {
|
state: {
|
||||||
name: "/service/openhab/out/kitchen_light_all_color_temperature/state",
|
name: "/service/openhab/out/kitchen_light_all_color_temperature"
|
||||||
|
+ "/state",
|
||||||
type: types.string
|
type: types.string
|
||||||
},
|
},
|
||||||
command: {
|
command: {
|
||||||
name: "/service/openhab/in/kitchen_light_all_color_temperature/command",
|
name: "/service/openhab/in/kitchen_light_all_color_temperature"
|
||||||
|
+ "/command",
|
||||||
type: types.string
|
type: types.string
|
||||||
},
|
},
|
||||||
defaultValue: "0"
|
defaultValue: "0"
|
||||||
|
|
@ -200,16 +202,18 @@ const config: Config = {
|
||||||
},
|
},
|
||||||
kitchen_sink_light_brightness: {
|
kitchen_sink_light_brightness: {
|
||||||
state: {
|
state: {
|
||||||
name: "/service/openhab/out/tradfri_0100_gwb8d7af2b448f_65545_brightness/state",
|
name: "/service/openhab/out/tradfri_0100_"
|
||||||
|
+ "gwb8d7af2b448f_65545_brightness/state",
|
||||||
type: types.string
|
type: types.string
|
||||||
},
|
},
|
||||||
command: {
|
command: {
|
||||||
name: "/service/openhab/in/tradfri_0100_gwb8d7af2b448f_65545_brightness/command",
|
name: "/service/openhab/in/tradfri_0100_"
|
||||||
|
+ "gwb8d7af2b448f_65545_brightness/command",
|
||||||
type: types.string
|
type: types.string
|
||||||
},
|
},
|
||||||
defaultValue: "0"
|
defaultValue: "0"
|
||||||
},
|
},
|
||||||
nebenraum_power_status: {
|
nebenraumPowerStatus: {
|
||||||
state: {
|
state: {
|
||||||
name: "/service/nebenraum-power",
|
name: "/service/nebenraum-power",
|
||||||
type: types.option({ ON: "on", OFF: "off" })
|
type: types.option({ ON: "on", OFF: "off" })
|
||||||
|
|
@ -228,17 +232,17 @@ const config: Config = {
|
||||||
floalt.topics("65538"),
|
floalt.topics("65538"),
|
||||||
floalt.topics("65539"),
|
floalt.topics("65539"),
|
||||||
floalt.topics("65540"),
|
floalt.topics("65540"),
|
||||||
tradfri_remote.topics("65536"),
|
tradfri.remote.topics("65536"),
|
||||||
tradfri_remote.topics("65547"),
|
tradfri.remote.topics("65547"),
|
||||||
|
|
||||||
//Theken-Floalts
|
//Theken-Floalts
|
||||||
floalt.topics("65543"),
|
floalt.topics("65543"),
|
||||||
floalt.topics("65544"),
|
floalt.topics("65544"),
|
||||||
tradfri_remote.topics("65542"),
|
tradfri.remote.topics("65542"),
|
||||||
tradfri_remote.topics("65546"),
|
tradfri.remote.topics("65546"),
|
||||||
|
|
||||||
esper_topics("afba40", "flyfry"),
|
esper.topics("afba40", "flyfry"),
|
||||||
esper_topics("afba45", "alarm"),
|
esper.topics("afba45", "alarm"),
|
||||||
|
|
||||||
onkyo.topics
|
onkyo.topics
|
||||||
],
|
],
|
||||||
|
|
@ -248,14 +252,15 @@ const config: Config = {
|
||||||
name: "LED Stahlträger",
|
name: "LED Stahlträger",
|
||||||
position: [340, 590],
|
position: [340, 590],
|
||||||
icon: mdi("white-balance-iridescent"),
|
icon: mdi("white-balance-iridescent"),
|
||||||
iconColor: ({led_stahltraeger}) => led_stahltraeger == "on" ? rainbow : hex("#000000"),
|
iconColor: ({ledStahltraeger}) =>
|
||||||
|
(ledStahltraeger === "on" ? rainbow : hex("#000000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
text: "Stahlträger LED",
|
text: "Stahlträger LED",
|
||||||
topic: "led_stahltraeger",
|
topic: "ledStahltraeger",
|
||||||
icon: mdi("power")
|
icon: mdi("power")
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
led_olymp: {
|
led_olymp: {
|
||||||
|
|
@ -290,8 +295,8 @@ const config: Config = {
|
||||||
name: "Twinkle",
|
name: "Twinkle",
|
||||||
position: [530, 560],
|
position: [530, 560],
|
||||||
icon: ({twinkle}) =>
|
icon: ({twinkle}) =>
|
||||||
twinkle == "on" ? rawMdi("led-on flip-v") : rawMdi("led-off flip-v"),
|
(twinkle === "on" ? rawMdi("led-on flip-v") : rawMdi("led-off flip-v")),
|
||||||
iconColor: ({twinkle}) => twinkle == "on" ? rainbow : hex("#000000"),
|
iconColor: ({twinkle}) => (twinkle === "on" ? rainbow : hex("#000000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -305,7 +310,7 @@ const config: Config = {
|
||||||
name: "Ventilator",
|
name: "Ventilator",
|
||||||
position: [530, 440],
|
position: [530, 440],
|
||||||
icon: mdi("fan"),
|
icon: mdi("fan"),
|
||||||
iconColor: ({fan}) => fan == "on" ? hex("#00FF00") : hex("#000000"),
|
iconColor: ({fan}) => (fan === "on" ? hex("#00FF00") : hex("#000000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -332,7 +337,8 @@ const config: Config = {
|
||||||
name: "Videospiele",
|
name: "Videospiele",
|
||||||
position: [100, 100],
|
position: [100, 100],
|
||||||
icon: mdi("gamepad-variant"),
|
icon: mdi("gamepad-variant"),
|
||||||
iconColor: ({videogames}) => videogames == "on" ? hex("#00FF00") : hex("#000000"),
|
iconColor: ({videogames}) =>
|
||||||
|
(videogames === "on" ? hex("#00FF00") : hex("#000000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -346,7 +352,8 @@ const config: Config = {
|
||||||
name: "Rechner",
|
name: "Rechner",
|
||||||
position: [297, 90],
|
position: [297, 90],
|
||||||
icon: mdi("desktop-classic"),
|
icon: mdi("desktop-classic"),
|
||||||
iconColor: ({olymp_pc}) => olymp_pc == "on" ? hex("#00FF00") : hex("#000000"),
|
iconColor: ({olymp_pc}) =>
|
||||||
|
(olymp_pc === "on" ? hex("#00FF00") : hex("#000000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -380,8 +387,9 @@ const config: Config = {
|
||||||
name: "Fliegenbratgerät",
|
name: "Fliegenbratgerät",
|
||||||
position: [450, 570],
|
position: [450, 570],
|
||||||
icon: mdi("fire"),
|
icon: mdi("fire"),
|
||||||
iconColor: ({flyfry}) => flyfry == "on" ? hex("#6666FF") : hex("#000000"),
|
iconColor: ({flyfry}) =>
|
||||||
ui: esper_statistics("flyfry", [
|
(flyfry === "on" ? hex("#6666FF") : hex("#000000")),
|
||||||
|
ui: esper.statistics("flyfry", [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
text: "Fliegenbratgerät",
|
text: "Fliegenbratgerät",
|
||||||
|
|
@ -400,14 +408,14 @@ const config: Config = {
|
||||||
transient_off: hex("#b3b300"),
|
transient_off: hex("#b3b300"),
|
||||||
on: hex("#00ff00"),
|
on: hex("#00ff00"),
|
||||||
off: hex("#000000"),
|
off: hex("#000000"),
|
||||||
unknown: hex("#888888"),
|
unknown: hex("#888888")
|
||||||
})[projector],
|
})[projector],
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
text: "Beamer",
|
text: "Beamer",
|
||||||
topic: "projector",
|
topic: "projector",
|
||||||
toggled: val => val == "transient_on" || val == "on",
|
toggled: (val) => val === "transient_on" || val === "on",
|
||||||
icon: mdi("power")
|
icon: mdi("power")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -416,7 +424,8 @@ const config: Config = {
|
||||||
name: "Rundumleuchte",
|
name: "Rundumleuchte",
|
||||||
position: [310, 275],
|
position: [310, 275],
|
||||||
icon: mdi("alarm-light"),
|
icon: mdi("alarm-light"),
|
||||||
iconColor: ({rundumleuchte}) => rundumleuchte == "on" ? hex("#F0DF10") : hex("#000000"),
|
iconColor: ({rundumleuchte}) =>
|
||||||
|
(rundumleuchte === "on" ? hex("#F0DF10") : hex("#000000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
|
|
@ -430,7 +439,8 @@ const config: Config = {
|
||||||
name: "Lötarbeitsplatz",
|
name: "Lötarbeitsplatz",
|
||||||
position: [205, 455],
|
position: [205, 455],
|
||||||
icon: mdi("eyedropper-variant"),
|
icon: mdi("eyedropper-variant"),
|
||||||
iconColor: ({loetarbeitsplatz4}) => loetarbeitsplatz4 == "on" ? hex("#FF0000") : hex("#000000"),
|
iconColor: ({loetarbeitsplatz4}) =>
|
||||||
|
(loetarbeitsplatz4 === "on" ? hex("#FF0000") : hex("#000000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
|
|
@ -444,7 +454,8 @@ const config: Config = {
|
||||||
name: "Lötarbeitsplatz",
|
name: "Lötarbeitsplatz",
|
||||||
position: [205, 405],
|
position: [205, 405],
|
||||||
icon: mdi("eyedropper-variant"),
|
icon: mdi("eyedropper-variant"),
|
||||||
iconColor: ({loetarbeitsplatz5}) => loetarbeitsplatz5 == "on" ? hex("#FF0000") : hex("#000000"),
|
iconColor: ({loetarbeitsplatz5}) =>
|
||||||
|
(loetarbeitsplatz5 === "on" ? hex("#FF0000") : hex("#000000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
|
|
@ -459,13 +470,14 @@ const config: Config = {
|
||||||
position: [340, 250],
|
position: [340, 250],
|
||||||
icon: mdi("alarm-bell"),
|
icon: mdi("alarm-bell"),
|
||||||
iconColor: () => hex("#000000"),
|
iconColor: () => hex("#000000"),
|
||||||
ui: esper_statistics("alarm")
|
ui: esper.statistics("alarm")
|
||||||
},
|
},
|
||||||
door: {
|
door: {
|
||||||
name: "Tür",
|
name: "Tür",
|
||||||
position: [455, 350],
|
position: [455, 350],
|
||||||
icon: mdi("swap-vertical"),
|
icon: mdi("swap-vertical"),
|
||||||
iconColor: ({door_status}) => door_status == "on" ? hex("#00FF00") : hex("#FF0000"),
|
iconColor: ({doorStatus}) =>
|
||||||
|
(doorStatus === "on" ? hex("#00FF00") : hex("#FF0000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "link",
|
type: "link",
|
||||||
|
|
@ -476,7 +488,7 @@ const config: Config = {
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: "Anwesend",
|
text: "Anwesend",
|
||||||
topic: "presence_status",
|
topic: "presenceStatus",
|
||||||
icon: mdi("account")
|
icon: mdi("account")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -563,7 +575,7 @@ const config: Config = {
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
on: "50",
|
on: "50",
|
||||||
off: "0",
|
off: "0",
|
||||||
toggled: n => parseInt(n) > 0,
|
toggled: (n) => parseInt(n) > 0,
|
||||||
topic: "kitchen_light_brightness",
|
topic: "kitchen_light_brightness",
|
||||||
text: "Ein/Ausschalten",
|
text: "Ein/Ausschalten",
|
||||||
icon: mdi("power")
|
icon: mdi("power")
|
||||||
|
|
@ -675,7 +687,7 @@ const config: Config = {
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
on: "50",
|
on: "50",
|
||||||
off: "0",
|
off: "0",
|
||||||
toggled: n => parseInt(n) > 0,
|
toggled: (n) => parseInt(n) > 0,
|
||||||
topic: "kitchen_sink_light_brightness",
|
topic: "kitchen_sink_light_brightness",
|
||||||
text: "Ein/Ausschalten",
|
text: "Ein/Ausschalten",
|
||||||
icon: mdi("power")
|
icon: mdi("power")
|
||||||
|
|
@ -742,56 +754,57 @@ const config: Config = {
|
||||||
position: [400, 344],
|
position: [400, 344],
|
||||||
icon: mdi("light-switch"),
|
icon: mdi("light-switch"),
|
||||||
iconColor: (state) => //if any remote is low make icon red
|
iconColor: (state) => //if any remote is low make icon red
|
||||||
["65536", "65542", "65546", "65547"].some(
|
(["65536", "65542", "65546", "65547"]
|
||||||
x => state[tradfri_remote.low(x)] == "true") ? hex("#ff0000") : hex("#000000"),
|
.some((x) => state[tradfri.remote.low(x)] === "true")
|
||||||
|
? hex("#ff0000") : hex("#000000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "progress",
|
type: "progress",
|
||||||
icon: mdiBattery(tradfri_remote.level("65536")),
|
icon: mdiBattery(tradfri.remote.level("65536")),
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
text: "Licht Tisch 1",
|
text: "Licht Tisch 1",
|
||||||
topic: tradfri_remote.level("65536")
|
topic: tradfri.remote.level("65536")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "progress",
|
type: "progress",
|
||||||
icon: mdiBattery(tradfri_remote.level("65547")),
|
icon: mdiBattery(tradfri.remote.level("65547")),
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
text: "Licht Tisch 2",
|
text: "Licht Tisch 2",
|
||||||
topic: tradfri_remote.level("65547")
|
topic: tradfri.remote.level("65547")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "progress",
|
type: "progress",
|
||||||
icon: mdiBattery(tradfri_remote.level("65542")),
|
icon: mdiBattery(tradfri.remote.level("65542")),
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
text: "Licht Theke 1",
|
text: "Licht Theke 1",
|
||||||
topic: tradfri_remote.level("65542")
|
topic: tradfri.remote.level("65542")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "progress",
|
type: "progress",
|
||||||
icon: mdiBattery(tradfri_remote.level("65546")),
|
icon: mdiBattery(tradfri.remote.level("65546")),
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
text: "Licht Theke 2",
|
text: "Licht Theke 2",
|
||||||
topic: tradfri_remote.level("65546")
|
topic: tradfri.remote.level("65546")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
nebenraum_power_status: {
|
nebenraumPowerStatus: {
|
||||||
name: "Strom Fablab",
|
name: "Strom Fablab",
|
||||||
position: [613, 537],
|
position: [613, 537],
|
||||||
icon: ({nebenraum_power_status}) =>
|
icon: ({nebenraumPowerStatus}) =>
|
||||||
nebenraum_power_status == "on" ? rawMdi("flash") : rawMdi("flash-off"),
|
(nebenraumPowerStatus === "on" ? rawMdi("flash") : rawMdi("flash-off")),
|
||||||
iconColor: ({nebenraum_power_status}) =>
|
iconColor: ({nebenraumPowerStatus}) =>
|
||||||
nebenraum_power_status == "on" ? hex("#00ff00") : hex("#000000"),
|
(nebenraumPowerStatus === "on" ? hex("#00ff00") : hex("#000000")),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
icon: mdi("power"),
|
icon: mdi("power"),
|
||||||
text: "Strom Fablab",
|
text: "Strom Fablab",
|
||||||
topic: "nebenraum_power_status"
|
topic: "nebenraumPowerStatus"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ export const topics: Topics = {
|
||||||
unknown: "SLI00"
|
unknown: "SLI00"
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
defaultValue: "unknown",
|
defaultValue: "unknown"
|
||||||
},
|
},
|
||||||
onkyo_radios: {
|
onkyo_radios: {
|
||||||
state: {
|
state: {
|
||||||
|
|
@ -122,7 +122,8 @@ export const controls: Controls = {
|
||||||
name: "Onkyo",
|
name: "Onkyo",
|
||||||
position: [350, 650],
|
position: [350, 650],
|
||||||
iconColor: ({onkyo_connection, onkyo_power}) =>
|
iconColor: ({onkyo_connection, onkyo_power}) =>
|
||||||
onkyo_connection != "connected" ? hex("#888888") : (onkyo_power == "on" ? hex("#00FF00") : hex("#000000")),
|
(onkyo_connection !== "connected" ? hex("#888888") :
|
||||||
|
(onkyo_power === "on" ? hex("#00FF00") : hex("#000000"))),
|
||||||
icon: mdi("audio-video"),
|
icon: mdi("audio-video"),
|
||||||
ui: [
|
ui: [
|
||||||
{
|
{
|
||||||
|
|
@ -130,7 +131,7 @@ export const controls: Controls = {
|
||||||
text: "Power",
|
text: "Power",
|
||||||
icon: mdi("power"),
|
icon: mdi("power"),
|
||||||
topic: "onkyo_power",
|
topic: "onkyo_power",
|
||||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
enableCondition: (state) => state.onkyo_connection === "connected"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "section",
|
type: "section",
|
||||||
|
|
@ -143,14 +144,14 @@ export const controls: Controls = {
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 50,
|
max: 50,
|
||||||
icon: mdi("volume-high"),
|
icon: mdi("volume-high"),
|
||||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
enableCondition: (state) => state.onkyo_connection === "connected"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
text: "Mute",
|
text: "Mute",
|
||||||
topic: "onkyo_mute",
|
topic: "onkyo_mute",
|
||||||
icon: mdi("volume-off"),
|
icon: mdi("volume-off"),
|
||||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
enableCondition: (state) => state.onkyo_connection === "connected"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "section",
|
type: "section",
|
||||||
|
|
@ -168,7 +169,7 @@ export const controls: Controls = {
|
||||||
front: "Front HDMI"
|
front: "Front HDMI"
|
||||||
},
|
},
|
||||||
icon: mdi("usb"),
|
icon: mdi("usb"),
|
||||||
enableCondition: ({ onkyo_connection }) => onkyo_connection == "connected"
|
enableCondition: (state) => state.onkyo_connection === "connected"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "dropDown",
|
type: "dropDown",
|
||||||
|
|
@ -187,7 +188,8 @@ export const controls: Controls = {
|
||||||
ponyville: "Ponyville FM"
|
ponyville: "Ponyville FM"
|
||||||
},
|
},
|
||||||
icon: mdi("radio"),
|
icon: mdi("radio"),
|
||||||
enableCondition: (state) => state.onkyo_connection == "connected" && state.onkyo_inputs == "netzwerk"
|
enableCondition: (state) => state.onkyo_connection === "connected"
|
||||||
|
&& state.onkyo_inputs === "netzwerk"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "section",
|
type: "section",
|
||||||
|
|
|
||||||
|
|
@ -4,45 +4,6 @@ import { mdi } from "config/icon";
|
||||||
import { hex } from "config/colors";
|
import { hex } from "config/colors";
|
||||||
import * as types from "config/types";
|
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 = {
|
export const tasmota = {
|
||||||
topics: (id: string, name: string) => ({
|
topics: (id: string, name: string) => ({
|
||||||
[name]: {
|
[name]: {
|
||||||
|
|
@ -62,9 +23,10 @@ export const tasmota = {
|
||||||
type: types.string
|
type: types.string
|
||||||
},
|
},
|
||||||
defaultValue: "offline"
|
defaultValue: "offline"
|
||||||
},
|
}
|
||||||
}),
|
}),
|
||||||
icon_color: (name: string, on_color: Color = hex("#00FF00")) => (state: State) => {
|
icon_color: (name: string, on_color: Color = hex("#00FF00")) =>
|
||||||
|
(state: State) => {
|
||||||
if (state[`${name}_online`] === "offline") {
|
if (state[`${name}_online`] === "offline") {
|
||||||
return hex("#888888");
|
return hex("#888888");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -75,58 +37,68 @@ export const tasmota = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
export const floalt = {
|
export const floalt = {
|
||||||
color: (light_id: string) => `floalt_${light_id}_color`,
|
color: (lightId: string) => `floalt_${lightId}_color`,
|
||||||
brightness: (light_id: string) => `floalt_${light_id}_brightness`,
|
brightness: (lightId: string) => `floalt_${lightId}_brightness`,
|
||||||
topics: (light_id: string) => ({
|
topics: (lightId: string) => ({
|
||||||
[ `floalt_${light_id}_color` ]: {
|
[`floalt_${lightId}_color`]: {
|
||||||
state: {
|
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
|
type: types.string
|
||||||
},
|
},
|
||||||
command: {
|
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
|
type: types.string
|
||||||
},
|
},
|
||||||
defaultValue: "0"
|
defaultValue: "0"
|
||||||
},
|
},
|
||||||
[ `floalt_${light_id}_brightness` ]: {
|
[`floalt_${lightId}_brightness`]: {
|
||||||
state: {
|
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
|
type: types.string
|
||||||
},
|
},
|
||||||
command: {
|
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
|
type: types.string
|
||||||
},
|
},
|
||||||
defaultValue: "0"
|
defaultValue: "0"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
};
|
||||||
|
|
||||||
export const tradfri_remote = {
|
const tradfriRemote = {
|
||||||
level: (remote_id: string) => `tradfri_remote_${remote_id}_level`,
|
level: (remoteId: string) => `tradfri_remote_${remoteId}_level`,
|
||||||
low: (remote_id: string) => `tradfri_remote_${remote_id}_low`,
|
low: (remoteId: string) => `tradfri_remote_${remoteId}_low`,
|
||||||
topics: (remote_id: string) => ({
|
topics: (remoteId: string) => ({
|
||||||
[ `tradfri_remote_${remote_id}_level` ]: {
|
[`tradfri_remote_${remoteId}_level`]: {
|
||||||
state: {
|
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
|
type: types.string
|
||||||
},
|
},
|
||||||
defaultValue: "0"
|
defaultValue: "0"
|
||||||
},
|
},
|
||||||
[ `tradfri_remote_${remote_id}_low` ]: {
|
[`tradfri_remote_${remoteId}_low`]: {
|
||||||
state: {
|
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" })
|
type: types.option({ ON: "true", OFF: "false" })
|
||||||
},
|
},
|
||||||
defaultValue: "false",
|
defaultValue: "false"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
};
|
||||||
|
|
||||||
export const esper_statistics = (name: string,
|
export const tradfri = {
|
||||||
|
remote: tradfriRemote
|
||||||
|
};
|
||||||
|
|
||||||
|
const esperStatistics = (name: string,
|
||||||
prev_ui: Array<ControlUI> = []): Array<ControlUI> => (
|
prev_ui: Array<ControlUI> = []): Array<ControlUI> => (
|
||||||
prev_ui.concat([
|
prev_ui.concat([
|
||||||
{
|
{
|
||||||
|
|
@ -165,3 +137,46 @@ export const esper_statistics = (name: string,
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
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
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
"dev": "webpack --bail --config webpack.config.js --mode development --env",
|
"dev": "webpack --bail --config webpack.config.js --mode development --env",
|
||||||
"watch": "webpack-dev-server --open --config webpack.config.js --mode development --env",
|
"watch": "webpack-dev-server --open --config webpack.config.js --mode development --env",
|
||||||
"travis": "./travis.sh",
|
"travis": "./travis.sh",
|
||||||
"lint": "eslint --ext js --ext jsx src/",
|
"lint": "eslint --ext js --ext jsx src/ config/",
|
||||||
"precommit": "yarn lint"
|
"precommit": "yarn lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue