debug keller licht

This commit is contained in:
Wolfgang Hottgenroth
2018-05-24 23:26:38 +02:00
parent 27153262bc
commit f75de912ba
6 changed files with 78 additions and 5 deletions

View File

@ -47,7 +47,6 @@ export class HomematicSwitchItem extends AHomegearItem implements HasStateAndFee
}
processMessage(topic: string, payload: string) : void {
this.emit('somethingChanged')
switch (topic) {
case this.stateTopic:
this.state = payload
@ -71,5 +70,6 @@ export class HomematicSwitchItem extends AHomegearItem implements HasStateAndFee
mqttHandler.send(this.stateFeedbackTopic, this.state)
break
}
this.emit('somethingChanged')
}
}

View File

@ -458,12 +458,21 @@ let basementSmallLight = new HomematicSwitchItem('Base', 'Hallway', 'SmallLight'
basementSmallLight.start()
allLabeledItems.push(basementSmallLight)
allRelevantLights.push(basementSmallLight)
basementSmallLight.on('somethingChanged', () => {
if ((basementLargeLight.getState() == 'OFF') && (basementSmallLight.getState() == 'ON')) {
setTimeout(() => {
mqttHandler.send(basementSmallLight.getStateTopic(), 'OFF')
}, (3 * 1000))
} else if ((basementLargeLight.getState() == 'ON') && (basementSmallLight.getState() == 'OFF')) {
mqttHandler.send(basementLargeLight.getStateTopic(), 'OFF')
}
})
let basementLargeLight = new HomematicSwitchItem('Base', 'Hallway', 'LargeLight', 'Licht Keller hell', 35, 2)
basementLargeLight.start()
allLabeledItems.push(basementLargeLight)
allRelevantLights.push(basementLargeLight)
basementLargeLight.on('somethingChange', () => {
basementLargeLight.on('somethingChanged', () => {
if (basementLargeLight.getState() == 'ON') {
mqttHandler.send(basementSmallLight.getStateTopic(), 'ON')
} else if (basementLargeLight.getState() == 'OFF') {