dimmer handling part 2
This commit is contained in:
@ -26,11 +26,19 @@ class DimmerAdaptor extends AItem {
|
||||
this.state = 'OFF';
|
||||
}
|
||||
mqtt.send(this.actionStateTopic, this.state, true);
|
||||
mqtt.send(this.actionBrightTopic, this.bright, true);
|
||||
break;
|
||||
case 'LONG_HOLD':
|
||||
this.bright += (5 * this.brightDirection);
|
||||
if (this.bright > 100) {
|
||||
this.bright = 100;
|
||||
}
|
||||
if (this.bright < 0) {
|
||||
this.bright = 0;
|
||||
}
|
||||
mqtt.send(this.actionBrightTopic, this.bright, true);
|
||||
break;
|
||||
case 'LONG_END':
|
||||
this.brightDirection = this.brightDirection * -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user