several quick fixes
This commit is contained in:
16
dist/UrlSwitchItem.js
vendored
16
dist/UrlSwitchItem.js
vendored
@ -1,5 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const logger = require("./log");
|
||||
const MqttDispatcher_1 = require("./MqttDispatcher");
|
||||
const AItem_1 = require("./AItem");
|
||||
const Export_1 = require("./Export");
|
||||
@ -30,13 +31,18 @@ class UrlSwitchItem extends AItem_1.AItem {
|
||||
this.state = payload;
|
||||
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
||||
if (this.state != this.oldState) {
|
||||
if (this.state == 'ON') {
|
||||
http.get(this.onUrl);
|
||||
try {
|
||||
if (this.state == 'ON') {
|
||||
http.get(this.onUrl);
|
||||
}
|
||||
else {
|
||||
http.get(this.offUrl);
|
||||
}
|
||||
this.oldState = this.state;
|
||||
}
|
||||
else {
|
||||
http.get(this.offUrl);
|
||||
catch (_a) {
|
||||
logger.error(`Failed to handle ${this.onUrl} or ${this.offUrl}`);
|
||||
}
|
||||
this.oldState = this.state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
dist/main.js
vendored
12
dist/main.js
vendored
@ -105,9 +105,9 @@ allLabeledItems.push(diningRoomCupboardLight);
|
||||
allRelevantLights.push(diningRoomCupboardLight);
|
||||
// Esszimmer Regallicht
|
||||
let diningRoomShelfLight = new UrlSwitchItem_1.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_1.HueColorBulbItem('Gnd', 'DiningRoom', 'NaehkaestchenLight', 'Lampe Naehkaestchen', 15);
|
||||
diningRoomNaehkaestchenLight.start();
|
||||
allLabeledItems.push(diningRoomNaehkaestchenLight);
|
||||
@ -438,6 +438,12 @@ let heartbeatTimer = setInterval(() => {
|
||||
heartbeatCounter += 1;
|
||||
MqttDispatcher_1.mqttHandler.send(config.dict.heartbeatTopic, `${heartbeatCounter}`);
|
||||
}, config.dict.heartbeatInterval);
|
||||
// watchdog
|
||||
let watchdogCounter = 0;
|
||||
let watchdogTimer = setInterval(() => {
|
||||
watchdogCounter += 1;
|
||||
MqttDispatcher_1.mqttHandler.send(config.dict.watchdogTopic, `${config.dict.watchdogMessage} ${watchdogCounter}`);
|
||||
}, config.dict.watchdogInterval);
|
||||
// ----------------------------------------------------------------------------------------------------------
|
||||
// Homekit export
|
||||
let homekitObject = {};
|
||||
|
Reference in New Issue
Block a user