use types.option instead of types.string for online/offline on tasmota

This commit is contained in:
Ranlvor 2018-09-02 02:54:52 +02:00
parent f1ffe78a40
commit ba10e8945c
Signed by untrusted user who does not match committer: Ranlvor
GPG key ID: 5E12D04750EF6F8E
2 changed files with 8 additions and 8 deletions

View file

@ -59,13 +59,13 @@ export const tasmota = {
[`${name}_online`]: {
state: {
name: `tele/sonoff${id}/LWT`,
type: types.string
type: types.option({ Online: "on", online: "on", Offline: "off", offline: "off" })
},
defaultValue: "offline"
defaultValue: "off"
},
}),
icon_color: (name: string, on_color: Color = hex("#00FF00")) => (state: State) => {
if (state[`${name}_online`] === "offline") {
if (state[`${name}_online`] === "off") {
return hex("#888888");
} else {
if (state[name] === "on") {