refactoring

This commit is contained in:
Wolfgang Hottgenroth
2018-01-04 23:07:21 +01:00
parent 6118ab39d4
commit 2fdd0c9352
2 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@ class TimerAdaptor extends AItem {
this.state = 'ON';
mqtt.send(this.actionStateTopic, this.state, true);
this.timer = setTimeout(() => {
logger.info(`timer ${this.itemId} elapsed`);
this.state = 'OFF';
mqtt.send(this.actionStateTopic, this.state, true);
}, (this.delay * 1000));

View File

@ -11,6 +11,10 @@ let TimerAdaptor = require('./TimerAdaptor');
let Forwarder = require('./Forwarder');
let aquariumLight = new M433SwitchItem('1st', 'Anna', 'AquariumLight', '14665044 24 1', '14665041 24 1');
aquariumLight.start();