fix some linter warnings

This commit is contained in:
Ranlvor 2018-09-02 13:20:22 +02:00
parent 37c9f524cd
commit 9410047a5c
Signed by untrusted user who does not match committer: Ranlvor
GPG key ID: 5E12D04750EF6F8E
3 changed files with 35 additions and 39 deletions

View file

@ -12,14 +12,14 @@ const config: Config = {
}, },
topics: [ topics: [
{ {
hauptraum_table_light: { hauptraumTableLight: {
command: { command: {
name: "/public/sensoren/TPH/leinwand/control", name: "/public/sensoren/TPH/leinwand/control",
type: types.option({ "A1 ON": "on", "A1 OFF": "off" }) type: types.option({ "A1 ON": "on", "A1 OFF": "off" })
}, },
defaultValue: "off" defaultValue: "off"
}, },
hauptraum_table_light_on_hack: { hauptraumTableLightOnHack: {
command: { command: {
name: "/public/sensoren/TPH/leinwand/control", name: "/public/sensoren/TPH/leinwand/control",
type: types.option({ "A1 ON": "on", "A1 OFF": "off" }) type: types.option({ "A1 ON": "on", "A1 OFF": "off" })
@ -29,7 +29,7 @@ const config: Config = {
} }
], ],
controls: { controls: {
hauptraum_table_light: { hauptraumTableLight: {
name: "Hauptraum Tisch", name: "Hauptraum Tisch",
position: [450, 450], position: [450, 450],
icon: mdi("white-balance-iridescent"), icon: mdi("white-balance-iridescent"),
@ -38,13 +38,13 @@ const config: Config = {
{ {
type: "toggle", type: "toggle",
text: "Licht", text: "Licht",
topic: "hauptraum_table_light", topic: "hauptraumTableLight",
icon: mdi("power") icon: mdi("power")
}, },
{ {
type: "toggle", type: "toggle",
text: "Licht", text: "Licht",
topic: "hauptraum_table_light_on_hack", topic: "hauptraumTableLightOnHack",
icon: mdi("power") icon: mdi("power")
} }
] ]

View file

@ -64,8 +64,8 @@ const config: Config = {
snackbarLedOnline: { snackbarLedOnline: {
state: { state: {
name: "tele/tasmota-snackbar/LWT", name: "tele/tasmota-snackbar/LWT",
type: types.option({ Online: "on", online: "on", type: types.option({ Online: "on", online: "on",
Offline: "off", offline: "off" }) Offline: "off", offline: "off" })
}, },
defaultValue: "off" defaultValue: "off"
}, },
@ -141,10 +141,10 @@ const config: Config = {
state: { state: {
name: "/service/beamer/state", name: "/service/beamer/state",
type: types.option({ type: types.option({
START_UP: "transient_on", START_UP: "transientOn",
START_UP_LAMP: "transient_on", START_UP_LAMP: "transientOn",
COOLING: "transient_off", COOLING: "transientOff",
COOLING2: "transient_off", COOLING2: "transientOff",
POWER_ON: "on", POWER_ON: "on",
STANDBY: "off", STANDBY: "off",
unknown: "unknown", unknown: "unknown",
@ -156,30 +156,30 @@ const config: Config = {
type: types.option({ type: types.option({
on: "ON", on: "ON",
off: "OFF", off: "OFF",
transient_off: "OFF", transientOff: "OFF",
transient_on: "ON", transientOn: "ON",
unknown: "OFF" unknown: "OFF"
}) })
}, },
defaultValue: "unknown" defaultValue: "unknown"
}, },
printer_3d_status: { printer3DStatus: {
state: { state: {
name: "/service/ultimaker/state", name: "/service/ultimaker/state",
type: types.option({ type: types.option({
unreachable: "unavailable", unreachable: "unavailable",
booting: "unavailable", booting: "unavailable",
pre_print: "printing", prePrint: "printing",
post_print: "printing", postPrint: "printing",
printing: "printing", printing: "printing",
idle: "idle", idle: "idle",
error: "error", error: "error",
otherwise: "awaiting_interaction" otherwise: "awaitingInteraction"
}) })
}, },
defaultValue: "unavailable" defaultValue: "unavailable"
}, },
printer_3d_progress: { printer3DProgresss: {
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"
@ -191,12 +191,11 @@ const config: Config = {
name: "/service/ultimaker/job", name: "/service/ultimaker/job",
type: (msg) => { type: (msg) => {
const json = JSON.parse(msg.toString()); const json = JSON.parse(msg.toString());
if(!json || !json["time_elapsed"] || !json["time_total"]) { if (!json || !json["time_elapsed"] || !json["time_total"]) {
return "unavailable"; return "unavailable";
} else {
const secondsLeft = json["time_total"] - json["time_elapsed"];
return new Date(secondsLeft * 1000).toISOString().substr(11, 8);
} }
const secondsLeft = json["time_total"] - json["time_elapsed"];
return new Date(secondsLeft * 1000).toISOString().substr(11, 8);
} }
}, },
defaultValue: "unavailable" defaultValue: "unavailable"
@ -223,7 +222,7 @@ const config: Config = {
...onkyo.controls, ...onkyo.controls,
...olymp.controls, ...olymp.controls,
...kitchen.controls, ...kitchen.controls,
led_stahltrager: { ledStahltrager: {
name: "LED Stahlträger", name: "LED Stahlträger",
position: [340, 590], position: [340, 590],
icon: mdi("white-balance-iridescent"), icon: mdi("white-balance-iridescent"),
@ -363,8 +362,8 @@ const config: Config = {
icon: mdi("projector flip-v"), icon: mdi("projector flip-v"),
iconColor: ({projector}) => iconColor: ({projector}) =>
({ ({
transient_on: hex("#b3b300"), transientOn: hex("#b3b300"),
transient_off: hex("#b3b300"), transientOff: hex("#b3b300"),
on: hex("#00ff00"), on: hex("#00ff00"),
off: hex("#000000"), off: hex("#000000"),
unknown: hex("#888888") unknown: hex("#888888")
@ -374,7 +373,7 @@ const config: Config = {
type: "toggle", type: "toggle",
text: "Beamer", text: "Beamer",
topic: "projector", topic: "projector",
toggled: (val) => val === "transient_on" || val === "on", toggled: (val) => val === "transientOn" || val === "on",
icon: mdi("power") icon: mdi("power")
} }
] ]
@ -457,18 +456,18 @@ const config: Config = {
} }
] ]
}, },
printer_3d: { printer3D: {
name: "Ultimaker 3", name: "Ultimaker 3",
position: [754, 560], position: [754, 560],
icon: mdi("printer-3d"), icon: mdi("printer-3d"),
iconColor: ({printer_3d_status}) => iconColor: ({printer3DStatus}) =>
({ ({
awaiting_interaction: hex("#b3b300"), awaitingInteraction: hex("#b3b300"),
printing: hex("#00ff00"), printing: hex("#00ff00"),
idle: hex("#000000"), idle: hex("#000000"),
unavailable: hex("#888888"), unavailable: hex("#888888"),
error: hex("#ff0000") error: hex("#ff0000")
})[printer_3d_status], })[printer3DStatus],
ui: [ ui: [
{ {
type: "link", type: "link",
@ -486,7 +485,7 @@ const config: Config = {
min: 0, min: 0,
max: 1, max: 1,
text: "Printing Progress", text: "Printing Progress",
topic: "printer_3d_progress" topic: "printer3DProgresss"
}, },
{ {
type: "text", type: "text",

View file

@ -20,8 +20,8 @@ export const tasmota = {
[`${name}_online`]: { [`${name}_online`]: {
state: { state: {
name: `tele/sonoff${id}/LWT`, name: `tele/sonoff${id}/LWT`,
type: types.option({ Online: "on", online: "on", type: types.option({ Online: "on", online: "on",
Offline: "off", offline: "off" }) Offline: "off", offline: "off" })
}, },
defaultValue: "off" defaultValue: "off"
} }
@ -30,13 +30,10 @@ export const tasmota = {
(state: State) => { (state: State) => {
if (state[`${name}_online`] === "off") { if (state[`${name}_online`] === "off") {
return hex("#888888"); return hex("#888888");
} else { } else if (state[name] === "on") {
if (state[name] === "on") { return onColor;
return onColor;
} else {
return hex("#000000");
}
} }
return hex("#000000");
} }
}; };
export const floalt = { export const floalt = {