Add template for tasmota state topics
This commit is contained in:
parent
da7161c0dd
commit
70240d9dd6
1 changed files with 19 additions and 28 deletions
|
|
@ -18,6 +18,23 @@ const topicBulb = (bulb: string, argument: string) => ({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const topicTasmota = (name: string, topic: string) => ({
|
||||||
|
[`${name}State`]: {
|
||||||
|
state: {
|
||||||
|
name: `stat/${topic}/POWER`,
|
||||||
|
type: types.option({
|
||||||
|
OFF: "off",
|
||||||
|
ON: "on"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
command: {
|
||||||
|
name: `cmnd/${topic}/POWER`,
|
||||||
|
type: types.string
|
||||||
|
},
|
||||||
|
defaultValue: "OFF"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const sliderRGB = (bulb: string, argument: string) => (
|
const sliderRGB = (bulb: string, argument: string) => (
|
||||||
[{
|
[{
|
||||||
type: "slider",
|
type: "slider",
|
||||||
|
|
@ -158,20 +175,7 @@ const config: Config = {
|
||||||
},
|
},
|
||||||
defaultValue: "OFF"
|
defaultValue: "OFF"
|
||||||
},
|
},
|
||||||
fanBedroomState: {
|
...topicTasmota("fanBedroom", "sonoff-bedroom-fan"),
|
||||||
state: {
|
|
||||||
name: "stat/sonoff-bedroom-fan/POWER",
|
|
||||||
type: types.option({
|
|
||||||
OFF: "off",
|
|
||||||
ON: "on"
|
|
||||||
})
|
|
||||||
},
|
|
||||||
command: {
|
|
||||||
name: "cmnd/sonoff-bedroom-fan/POWER",
|
|
||||||
type: types.string
|
|
||||||
},
|
|
||||||
defaultValue: "OFF"
|
|
||||||
},
|
|
||||||
fanBedroomAuto: {
|
fanBedroomAuto: {
|
||||||
state: {
|
state: {
|
||||||
name: "home-rust/temperature-control/bedroom",
|
name: "home-rust/temperature-control/bedroom",
|
||||||
|
|
@ -183,20 +187,7 @@ const config: Config = {
|
||||||
},
|
},
|
||||||
defaultValue: "OFF"
|
defaultValue: "OFF"
|
||||||
},
|
},
|
||||||
fanOfficeState: {
|
...topicTasmota("fanOffice", "sonoff-office-fan"),
|
||||||
state: {
|
|
||||||
name: "stat/sonoff-office-fan/POWER",
|
|
||||||
type: types.option({
|
|
||||||
OFF: "off",
|
|
||||||
ON: "on"
|
|
||||||
})
|
|
||||||
},
|
|
||||||
command: {
|
|
||||||
name: "cmnd/sonoff-office-fan/POWER",
|
|
||||||
type: types.string
|
|
||||||
},
|
|
||||||
defaultValue: "OFF"
|
|
||||||
},
|
|
||||||
fanOfficeAuto: {
|
fanOfficeAuto: {
|
||||||
state: {
|
state: {
|
||||||
name: "home-rust/temperature-control/office",
|
name: "home-rust/temperature-control/office",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue