RZL: Simplify config a bit by using template for tasmota topics

This commit is contained in:
Ranlvor 2018-08-04 15:50:14 +02:00
parent 8feb40a30b
commit 032056b2e3
Signed by untrusted user who does not match committer: Ranlvor
GPG key ID: 5E12D04750EF6F8E
2 changed files with 21 additions and 34 deletions

View file

@ -42,6 +42,21 @@ export const esper_topics = (chip_id: string, name: string) => ({
}
});
export const tasmota = {
topics: (id: string, name: string) => ({
[name]: {
state: {
name: `stat/sonoff${id}/POWER`,
type: types.option({ ON: "on", OFF: "off" })
},
command: {
name: `cmnd/sonoff${id}/power`,
type: types.option({ on: "ON", off: "OFF" })
},
defaultValue: "off"
}
})
}
export const floalt = {
color: (light_id: string) => `floalt_${light_id}_color`,
brightness: (light_id: string) => `floalt_${light_id}_brightness`,