SimpleTopicSwitchItem added, Regallicht changed
This commit is contained in:
56
dist/SimpleTopicSwitchItem.js
vendored
Normal file
56
dist/SimpleTopicSwitchItem.js
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const MqttDispatcher_1 = require("./MqttDispatcher");
|
||||
const AItem_1 = require("./AItem");
|
||||
const Export_1 = require("./Export");
|
||||
class SimpleTopicSwitchItem extends AItem_1.AItem {
|
||||
getLabel() {
|
||||
return this.label;
|
||||
}
|
||||
getRoom() {
|
||||
return this.room;
|
||||
}
|
||||
getStateTopic() {
|
||||
return this.stateTopic;
|
||||
}
|
||||
getStateFeedbackTopic() {
|
||||
return this.stateFeedbackTopic;
|
||||
}
|
||||
getState() {
|
||||
return this.state;
|
||||
}
|
||||
constructor(floor, room, item, label, actionTopic) {
|
||||
super(floor, room, item, label);
|
||||
this.stateTopic = `${this.topicFirstPart}/state`;
|
||||
this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`;
|
||||
this.actionTopic = actionTopic;
|
||||
this.subscribeTopics = [
|
||||
this.stateTopic
|
||||
];
|
||||
this.state = 'OFF';
|
||||
this.oldState = undefined;
|
||||
}
|
||||
exportItem() {
|
||||
return Export_1.SwitchExport(this.itemId, this.label, this.stateTopic, this.stateFeedbackTopic, this.type);
|
||||
}
|
||||
processMessage(topic, payload) {
|
||||
switch (topic) {
|
||||
case this.stateTopic:
|
||||
this.state = payload;
|
||||
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
||||
if (this.state != this.oldState) {
|
||||
if (this.state == 'ON') {
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, 'true');
|
||||
}
|
||||
else {
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, 'false');
|
||||
}
|
||||
this.oldState = this.state;
|
||||
}
|
||||
break;
|
||||
}
|
||||
this.emit('somethingChanged');
|
||||
}
|
||||
}
|
||||
exports.SimpleTopicSwitchItem = SimpleTopicSwitchItem;
|
||||
//# sourceMappingURL=SimpleTopicSwitchItem.js.map
|
11
dist/main.js
vendored
11
dist/main.js
vendored
@ -16,7 +16,6 @@ const Scene_1 = require("./Scene");
|
||||
const MaxEcoSwitch_1 = require("./MaxEcoSwitch");
|
||||
const MaxThermostat_1 = require("./MaxThermostat");
|
||||
const MaxWindowContact_1 = require("./MaxWindowContact");
|
||||
const UrlSwitchItem_1 = require("./UrlSwitchItem");
|
||||
const Cron_1 = require("./Cron");
|
||||
const HueColorBulbItem_1 = require("./HueColorBulbItem");
|
||||
const TouchSwitchMultiButtonThing_1 = require("./TouchSwitchMultiButtonThing");
|
||||
@ -24,6 +23,7 @@ const RelayBox_1 = require("./RelayBox");
|
||||
const HeatingScene_1 = require("./HeatingScene");
|
||||
const TwoLedSignal_1 = require("./TwoLedSignal");
|
||||
const MySwitchThing_1 = require("./MySwitchThing");
|
||||
const SimpleTopicSwitchItem_1 = require("./SimpleTopicSwitchItem");
|
||||
logger.info("Dispatcher starting");
|
||||
let allLabeledItems = new Array();
|
||||
let allThermostatItems = new Array();
|
||||
@ -113,10 +113,11 @@ allLabeledItems.push(diningRoomCupboardLight);
|
||||
allRelevantLights.push(diningRoomCupboardLight);
|
||||
allLights.push(diningRoomCupboardLight);
|
||||
// Esszimmer Regallicht
|
||||
let diningRoomShelfLight = new UrlSwitchItem_1.UrlSwitchItem('Gnd', 'Esszimmer', 'ShelfLight', 'Regallicht', 'http://172.16.2.43/dv?dv=1023', 'http://172.16.2.43/dv?dv=0');
|
||||
// diningRoomShelfLight.start()
|
||||
// allLabeledItems.push(diningRoomShelfLight)
|
||||
// allRelevantLights.push(diningRoomShelfLight)
|
||||
let diningRoomShelfLight = new SimpleTopicSwitchItem_1.SimpleTopicSwitchItem('Gnd', 'Esszimmer', 'ShelfLight', 'Regallicht', 'IoT/WifiRelay1/State');
|
||||
diningRoomShelfLight.start();
|
||||
allLabeledItems.push(diningRoomShelfLight);
|
||||
allRelevantLights.push(diningRoomShelfLight);
|
||||
allLights.push(diningRoomShelfLight);
|
||||
let diningRoomNaehkaestchenLight = new HueColorBulbItem_1.HueColorBulbItem('Gnd', 'Esszimmer', 'NaehkaestchenLight', 'Nähkästchen', 15);
|
||||
diningRoomNaehkaestchenLight.start();
|
||||
allLabeledItems.push(diningRoomNaehkaestchenLight);
|
||||
|
Reference in New Issue
Block a user