several quick fixes
This commit is contained in:
@ -44,12 +44,16 @@ export class UrlSwitchItem extends AItem implements HasStateAndFeedbackTopic {
|
||||
this.state = payload;
|
||||
mqttHandler.send(this.stateFeedbackTopic, this.state);
|
||||
if (this.state != this.oldState) {
|
||||
try {
|
||||
if (this.state == 'ON') {
|
||||
http.get(this.onUrl,)
|
||||
} else {
|
||||
http.get(this.offUrl)
|
||||
}
|
||||
this.oldState = this.state;
|
||||
} catch {
|
||||
logger.error(`Failed to handle ${this.onUrl} or ${this.offUrl}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
src/main.ts
13
src/main.ts
@ -131,9 +131,9 @@ allRelevantLights.push(diningRoomCupboardLight)
|
||||
|
||||
// Esszimmer Regallicht
|
||||
let diningRoomShelfLight = new UrlSwitchItem('Gnd', 'DiningRoom', 'ShelfLight', 'Regallicht Esszimmer', 'http://172.16.2.43/dv?dv=1023', 'http://172.16.2.43/dv?dv=0')
|
||||
diningRoomShelfLight.start()
|
||||
allLabeledItems.push(diningRoomShelfLight)
|
||||
allRelevantLights.push(diningRoomShelfLight)
|
||||
// diningRoomShelfLight.start()
|
||||
// allLabeledItems.push(diningRoomShelfLight)
|
||||
// allRelevantLights.push(diningRoomShelfLight)
|
||||
|
||||
let diningRoomNaehkaestchenLight = new HueColorBulbItem('Gnd', 'DiningRoom', 'NaehkaestchenLight', 'Lampe Naehkaestchen', 15)
|
||||
diningRoomNaehkaestchenLight.start()
|
||||
@ -553,6 +553,13 @@ let heartbeatTimer = setInterval(() => {
|
||||
mqttHandler.send(config.dict.heartbeatTopic, `${heartbeatCounter}`)
|
||||
}, config.dict.heartbeatInterval)
|
||||
|
||||
// watchdog
|
||||
let watchdogCounter = 0
|
||||
let watchdogTimer = setInterval(() => {
|
||||
watchdogCounter += 1
|
||||
mqttHandler.send(config.dict.watchdogTopic, `${config.dict.watchdogMessage} ${watchdogCounter}`)
|
||||
}, config.dict.watchdogInterval)
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user