RZL: Add on/off button to kitchen light
This commit is contained in:
parent
72021aa83c
commit
02be6701be
2 changed files with 12 additions and 1 deletions
|
|
@ -522,6 +522,15 @@ const config : Config = {
|
|||
position: [325, 407],
|
||||
icon: "ceiling-light",
|
||||
ui: [
|
||||
{
|
||||
type: "toggle",
|
||||
on: 50,
|
||||
off: 0,
|
||||
toggled: n => n > 0,
|
||||
topic: "kitchen_light_brightness",
|
||||
text: "Ein/Ausschalten",
|
||||
icon: "power"
|
||||
},
|
||||
{
|
||||
type: "slider",
|
||||
min: 0,
|
||||
|
|
|
|||
|
|
@ -122,7 +122,9 @@ export class Toggle extends UiControl<UIToggle> {
|
|||
if (this.isEnabled()) {
|
||||
const control = this.props.item;
|
||||
const toggled = this.isToggled();
|
||||
const next = toggled ? (control.off || "off") : (control.on || "on");
|
||||
const on = control.on == null ? "on" : control.on;
|
||||
const off = control.off == null ? "off" : control.off;
|
||||
const next = toggled ? off : on;
|
||||
this.changeState(next);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue