TwoLedSignal stuff

This commit is contained in:
2018-04-25 13:05:28 +02:00
parent 5619ac007a
commit 1600cc9469
7 changed files with 218 additions and 37 deletions

78
dist/TwoLedSignal.js vendored Normal file
View File

@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const AItem_1 = require("./AItem");
const MqttDispatcher_1 = require("./MqttDispatcher");
const logger = require("./log");
var SignalState;
(function (SignalState) {
SignalState[SignalState["SIGNAL_RED"] = 0] = "SIGNAL_RED";
SignalState[SignalState["SIGNAL_GREEN"] = 1] = "SIGNAL_GREEN";
SignalState[SignalState["SIGNAL_UNKNOWN"] = 2] = "SIGNAL_UNKNOWN";
})(SignalState || (SignalState = {}));
class SignalItem {
constructor(item, redToken, greenToken) {
this.item = item;
this.signalState = SignalState.SIGNAL_UNKNOWN;
this.redToken = redToken;
this.greenToken = greenToken;
}
getSignalState() {
return this.signalState;
}
processMessage(topic, payload) {
if (topic == this.item.getStateFeedbackTopic()) {
logger.info(`${topic}, ${payload}`);
if (payload == this.greenToken) {
this.signalState = SignalState.SIGNAL_GREEN;
}
else if (payload == this.redToken) {
this.signalState = SignalState.SIGNAL_RED;
}
else {
this.signalState = SignalState.SIGNAL_UNKNOWN;
}
// logger.info(`DBG: SignalItem: ${topic}, ${payload}, ${this.signalState}`)
}
}
}
class TwoLedSignal extends AItem_1.AItem {
constructor(floor, room, item, label, led1Items, led1GreenToken, led1RedToken, led2Items, led2GreenToken, led2RedToken) {
super(floor, room, item, label);
this.led1Items = [];
this.led2Items = [];
this.subscribeTopics = [];
led1Items.forEach((item) => {
this.led1Items.push(new SignalItem(item, led1RedToken, led1GreenToken));
this.subscribeTopics.push(item.getStateFeedbackTopic());
});
led2Items.forEach((item) => {
this.led2Items.push(new SignalItem(item, led2RedToken, led2GreenToken));
this.subscribeTopics.push(item.getStateFeedbackTopic());
});
}
processMessage(topic, payload) {
let reds = 0;
const RED_VALUES = [SignalState.SIGNAL_RED, SignalState.SIGNAL_UNKNOWN];
this.led1Items.forEach((item) => {
item.processMessage(topic, payload);
if (RED_VALUES.indexOf(item.getSignalState()) != -1) {
reds++;
}
// logger.info(`DBG: TwoLedSignal ${item.getSignalState()}, ${reds}`)
});
let msg = (reds > 0) ? "RED" : "GREEN";
MqttDispatcher_1.mqttHandler.send(`${this.topicFirstPart}/led1`, msg);
reds = 0;
this.led2Items.forEach((item) => {
item.processMessage(topic, payload);
if (RED_VALUES.indexOf(item.getSignalState()) != -1) {
reds++;
}
// logger.info(`DBG: TwoLedSignal ${item.getSignalState()}, ${reds}`)
});
msg = (reds > 0) ? "RED" : "GREEN";
MqttDispatcher_1.mqttHandler.send(`${this.topicFirstPart}/led2`, msg);
}
}
exports.TwoLedSignal = TwoLedSignal;
//# sourceMappingURL=TwoLedSignal.js.map

39
dist/main.js vendored
View File

@ -21,9 +21,12 @@ const HueColorBulbItem_1 = require("./HueColorBulbItem");
const TouchSwitchMultiButtonThing_1 = require("./TouchSwitchMultiButtonThing"); const TouchSwitchMultiButtonThing_1 = require("./TouchSwitchMultiButtonThing");
const RelayBox_1 = require("./RelayBox"); const RelayBox_1 = require("./RelayBox");
const HeatingScene_1 = require("./HeatingScene"); const HeatingScene_1 = require("./HeatingScene");
const TwoLedSignal_1 = require("./TwoLedSignal");
logger.info("Dispatcher starting"); logger.info("Dispatcher starting");
let allLabeledItems = new Array(); let allLabeledItems = new Array();
let allThermostatItems = new Array(); let allThermostatItems = new Array();
let allWindows = new Array();
let allRelevantLights = new Array();
// Anna ----------------------------------------------------------------------------------------------------- // Anna -----------------------------------------------------------------------------------------------------
// Anna Aquarium 14665044 24 1 14665041 24 1 // Anna Aquarium 14665044 24 1 14665041 24 1
let aquariumLight = new M433SwitchItem_1.M433SwitchItem('1st', 'Anna', 'AquariumLight', 'Aquariumlicht', '14665044 24 1', '14665041 24 1'); let aquariumLight = new M433SwitchItem_1.M433SwitchItem('1st', 'Anna', 'AquariumLight', 'Aquariumlicht', '14665044 24 1', '14665041 24 1');
@ -41,9 +44,11 @@ aquariumLightCron.start();
let annaBedLight = new M433SwitchItem_1.M433SwitchItem('1st', 'Anna', 'BedLight', 'Bettlicht Anna', '14668116 24 1', '14668113 24 1'); let annaBedLight = new M433SwitchItem_1.M433SwitchItem('1st', 'Anna', 'BedLight', 'Bettlicht Anna', '14668116 24 1', '14668113 24 1');
annaBedLight.start(); annaBedLight.start();
allLabeledItems.push(annaBedLight); allLabeledItems.push(annaBedLight);
allRelevantLights.push(annaBedLight);
let windowContactAnna1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Anna', 'WindowContact', 'Fenster Anna', 20); let windowContactAnna1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Anna', 'WindowContact', 'Fenster Anna', 20);
windowContactAnna1st.start(); windowContactAnna1st.start();
allLabeledItems.push(windowContactAnna1st); allLabeledItems.push(windowContactAnna1st);
allWindows.push(windowContactAnna1st);
let thermostatAnna1st = new MaxThermostat_1.MaxThermostat('1st', 'Anna', 'Thermostat', 'Thermostat Anna', 21, [windowContactAnna1st]); let thermostatAnna1st = new MaxThermostat_1.MaxThermostat('1st', 'Anna', 'Thermostat', 'Thermostat Anna', 21, [windowContactAnna1st]);
thermostatAnna1st.start(); thermostatAnna1st.start();
thermostatAnna1st.setPresetTemperature(21.0); thermostatAnna1st.setPresetTemperature(21.0);
@ -65,84 +70,104 @@ thermostatAnna1stCron.start();
let matthiasStandLights = new M433SwitchItem_1.M433SwitchItem('1st', 'Matthias', 'StandLight', 'Stehlampen Matthias', '7 24 1', '6 24 1'); let matthiasStandLights = new M433SwitchItem_1.M433SwitchItem('1st', 'Matthias', 'StandLight', 'Stehlampen Matthias', '7 24 1', '6 24 1');
matthiasStandLights.start(); matthiasStandLights.start();
allLabeledItems.push(matthiasStandLights); allLabeledItems.push(matthiasStandLights);
allRelevantLights.push(matthiasStandLights);
// Matthias Bett 15 24 1 14 24 1 // Matthias Bett 15 24 1 14 24 1
let matthiasBedLight = new M433SwitchItem_1.M433SwitchItem('1st', 'Matthias', 'BedLight', 'Bettlicht Matthias', '15 24 1', '14 24 1'); let matthiasBedLight = new M433SwitchItem_1.M433SwitchItem('1st', 'Matthias', 'BedLight', 'Bettlicht Matthias', '15 24 1', '14 24 1');
matthiasBedLight.start(); matthiasBedLight.start();
allLabeledItems.push(matthiasBedLight); allLabeledItems.push(matthiasBedLight);
allRelevantLights.push(matthiasBedLight);
// Matthias Lautsprecher 11 24 1 10 24 1 // Matthias Lautsprecher 11 24 1 10 24 1
let matthiasSpeaker = new M433SwitchItem_1.M433SwitchItem('1st', 'Matthias', 'Speaker', 'Lautsprecher Matthias', '11 24 1', '10 24 1', 'outlet'); let matthiasSpeaker = new M433SwitchItem_1.M433SwitchItem('1st', 'Matthias', 'Speaker', 'Lautsprecher Matthias', '11 24 1', '10 24 1', 'outlet');
matthiasSpeaker.start(); matthiasSpeaker.start();
allLabeledItems.push(matthiasSpeaker); allLabeledItems.push(matthiasSpeaker);
allRelevantLights.push(matthiasSpeaker);
let windowContactMatthias = new MaxWindowContact_1.MaxWindowContact('1st', 'Matthias', 'WindowContact', 'Fenster', 24); let windowContactMatthias = new MaxWindowContact_1.MaxWindowContact('1st', 'Matthias', 'WindowContact', 'Fenster', 24);
windowContactMatthias.start(); windowContactMatthias.start();
allLabeledItems.push(windowContactMatthias); allLabeledItems.push(windowContactMatthias);
allWindows.push(windowContactMatthias);
// Esszimmer ------------------------------------------------------------------------------------------------ // Esszimmer ------------------------------------------------------------------------------------------------
// Esszimmer kleine Lampe 69653 24 1 69652 24 1 // Esszimmer kleine Lampe 69653 24 1 69652 24 1
let diningRoomSmallLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'DiningRoom', 'SmallLight', 'kleine Lampe Esszimmer', '69653 24 1', '69652 24 1'); let diningRoomSmallLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'DiningRoom', 'SmallLight', 'kleine Lampe Esszimmer', '69653 24 1', '69652 24 1');
diningRoomSmallLight.start(); diningRoomSmallLight.start();
allLabeledItems.push(diningRoomSmallLight); allLabeledItems.push(diningRoomSmallLight);
allRelevantLights.push(diningRoomSmallLight);
// Esszimmer Stehlampe 86037 24 1 86036 24 1 // Esszimmer Stehlampe 86037 24 1 86036 24 1
let diningRoomStandLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'DiningRoom', 'StandLight', 'Stehlampe Esszimmer', '86037 24 1', '86036 24 1'); let diningRoomStandLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'DiningRoom', 'StandLight', 'Stehlampe Esszimmer', '86037 24 1', '86036 24 1');
diningRoomStandLight.start(); diningRoomStandLight.start();
allLabeledItems.push(diningRoomStandLight); allLabeledItems.push(diningRoomStandLight);
allRelevantLights.push(diningRoomStandLight);
// Esszimmer Schranklicht 65813 24 1 65812 24 1 // Esszimmer Schranklicht 65813 24 1 65812 24 1
let diningRoomCupboardLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'DiningRoom', 'CupboardLight', 'Schranklicht Esszimmer', '65813 24 1', '65812 24 1'); let diningRoomCupboardLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'DiningRoom', 'CupboardLight', 'Schranklicht Esszimmer', '65813 24 1', '65812 24 1');
diningRoomCupboardLight.start(); diningRoomCupboardLight.start();
allLabeledItems.push(diningRoomCupboardLight); allLabeledItems.push(diningRoomCupboardLight);
allRelevantLights.push(diningRoomCupboardLight);
// Esszimmer Regallicht // Esszimmer Regallicht
let diningRoomShelfLight = new UrlSwitchItem_1.UrlSwitchItem('Gnd', 'DiningRoom', 'ShelfLight', 'Regallicht Esszimmer', 'http://regallampe/dv?dv=1023', 'http://regallampe/dv?dv=0'); let diningRoomShelfLight = new UrlSwitchItem_1.UrlSwitchItem('Gnd', 'DiningRoom', 'ShelfLight', 'Regallicht Esszimmer', 'http://regallampe/dv?dv=1023', 'http://regallampe/dv?dv=0');
diningRoomShelfLight.start(); diningRoomShelfLight.start();
allLabeledItems.push(diningRoomShelfLight); allLabeledItems.push(diningRoomShelfLight);
allRelevantLights.push(diningRoomShelfLight);
let diningRoomNaehkaestchenLight = new HueColorBulbItem_1.HueColorBulbItem('Gnd', 'DiningRoom', 'NaehkaestchenLight', 'Lampe Naehkaestchen', 15); let diningRoomNaehkaestchenLight = new HueColorBulbItem_1.HueColorBulbItem('Gnd', 'DiningRoom', 'NaehkaestchenLight', 'Lampe Naehkaestchen', 15);
diningRoomNaehkaestchenLight.start(); diningRoomNaehkaestchenLight.start();
allLabeledItems.push(diningRoomNaehkaestchenLight); allLabeledItems.push(diningRoomNaehkaestchenLight);
allRelevantLights.push(diningRoomNaehkaestchenLight);
// Wohnzimmer ----------------------------------------------------------------------------------------------- // Wohnzimmer -----------------------------------------------------------------------------------------------
// Wohnzimmer grosse Lampe 65557 24 1 65556 24 1 // Wohnzimmer grosse Lampe 65557 24 1 65556 24 1
let livingRoomLargeLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'LivingRoom', 'LargeLight', 'große Lampe Wohnzimmer', '65557 24 1', '65556 24 1'); let livingRoomLargeLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'LivingRoom', 'LargeLight', 'große Lampe Wohnzimmer', '65557 24 1', '65556 24 1');
livingRoomLargeLight.start(); livingRoomLargeLight.start();
allLabeledItems.push(livingRoomLargeLight); allLabeledItems.push(livingRoomLargeLight);
allRelevantLights.push(livingRoomLargeLight);
// Wohnzimmer kleine Lampe 87061 24 1 87060 24 1 // Wohnzimmer kleine Lampe 87061 24 1 87060 24 1
let livingRoomSmallLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'LivingRoom', 'SmallLight', 'kleine Lampe Wohnzimmer', '87061 24 1', '87060 24 1'); let livingRoomSmallLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'LivingRoom', 'SmallLight', 'kleine Lampe Wohnzimmer', '87061 24 1', '87060 24 1');
livingRoomSmallLight.start(); livingRoomSmallLight.start();
allLabeledItems.push(livingRoomSmallLight); allLabeledItems.push(livingRoomSmallLight);
allRelevantLights.push(livingRoomSmallLight);
// Wohnzimmer Sterne 69909 24 1 69908 24 1 // Wohnzimmer Sterne 69909 24 1 69908 24 1
let livingRoomStars = new M433SwitchItem_1.M433SwitchItem('Gnd', 'LivingRoom', 'Stars', 'Sterne Wohnzimmer', '69909 24 1', '69908 24 1'); let livingRoomStars = new M433SwitchItem_1.M433SwitchItem('Gnd', 'LivingRoom', 'Stars', 'Sterne Wohnzimmer', '69909 24 1', '69908 24 1');
livingRoomStars.start(); livingRoomStars.start();
allLabeledItems.push(livingRoomStars); allLabeledItems.push(livingRoomStars);
allRelevantLights.push(livingRoomStars);
// Wohnzimmer kleine Stehlampe 81941 24 1 81940 24 1 // Wohnzimmer kleine Stehlampe 81941 24 1 81940 24 1
let livingRoomStandLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'LivingRoom', 'StandLight', 'Stehlampe Wohnzimmer', '81941 24 1', '81940 24 1'); let livingRoomStandLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'LivingRoom', 'StandLight', 'Stehlampe Wohnzimmer', '81941 24 1', '81940 24 1');
livingRoomStandLight.start(); livingRoomStandLight.start();
allLabeledItems.push(livingRoomStandLight); allLabeledItems.push(livingRoomStandLight);
allRelevantLights.push(livingRoomStandLight);
// Flur ----------------------------------------------------------------------------------------------------- // Flur -----------------------------------------------------------------------------------------------------
// Flur Schreibtisch 83221 24 1 83220 24 1 // Flur Schreibtisch 83221 24 1 83220 24 1
let hallwayDeskLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'Hallway', 'DeskLight', 'Schreibtischlampe Flur', '83221 24 1', '83220 24 1'); let hallwayDeskLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'Hallway', 'DeskLight', 'Schreibtischlampe Flur', '83221 24 1', '83220 24 1');
hallwayDeskLight.start(); hallwayDeskLight.start();
allLabeledItems.push(hallwayDeskLight); allLabeledItems.push(hallwayDeskLight);
allRelevantLights.push(hallwayDeskLight);
// Flur Stehlampe 8704914 24 5 8793154 24 5 // Flur Stehlampe 8704914 24 5 8793154 24 5
let hallwayStandLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'Hallway', 'StandLight', 'Stehlampe Flur', '8704914 24 5', '8793154 24 5'); let hallwayStandLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'Hallway', 'StandLight', 'Stehlampe Flur', '8704914 24 5', '8793154 24 5');
hallwayStandLight.start(); hallwayStandLight.start();
allLabeledItems.push(hallwayStandLight); allLabeledItems.push(hallwayStandLight);
allRelevantLights.push(hallwayStandLight);
// Flur Schranklicht 66581 24 1 66580 24 1 // Flur Schranklicht 66581 24 1 66580 24 1
let hallwayWardrobeLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'Hallway', 'WardrobeLight', 'Schranklicht Flur', '66581 24 1', '66580 24 1'); let hallwayWardrobeLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'Hallway', 'WardrobeLight', 'Schranklicht Flur', '66581 24 1', '66580 24 1');
hallwayWardrobeLight.start(); hallwayWardrobeLight.start();
allLabeledItems.push(hallwayWardrobeLight); allLabeledItems.push(hallwayWardrobeLight);
allRelevantLights.push(hallwayWardrobeLight);
// Küche ---------------------------------------------------------------------------------------------------- // Küche ----------------------------------------------------------------------------------------------------
// Küche Fensterbank 66837 24 1 66836 24 1 // Küche Fensterbank 66837 24 1 66836 24 1
let kitchenWindowLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'Kitchen', 'WindowLight', 'Fensterbanklicht Küche', '66837 24 1', '66836 24 1'); let kitchenWindowLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'Kitchen', 'WindowLight', 'Fensterbanklicht Küche', '66837 24 1', '66836 24 1');
kitchenWindowLight.start(); kitchenWindowLight.start();
allLabeledItems.push(kitchenWindowLight); allLabeledItems.push(kitchenWindowLight);
allRelevantLights.push(kitchenWindowLight);
// Küche Deckenlampe 82197 24 1 82196 24 1 // Küche Deckenlampe 82197 24 1 82196 24 1
let kitchenCeilingLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'Kitchen', 'CeilingLight', 'Deckenlampe Küche', '82197 24 1', '82196 24 1'); let kitchenCeilingLight = new M433SwitchItem_1.M433SwitchItem('Gnd', 'Kitchen', 'CeilingLight', 'Deckenlampe Küche', '82197 24 1', '82196 24 1');
kitchenCeilingLight.start(); kitchenCeilingLight.start();
allLabeledItems.push(kitchenCeilingLight); allLabeledItems.push(kitchenCeilingLight);
allRelevantLights.push(kitchenCeilingLight);
// Schlafzimmer --------------------------------------------------------------------------------------------- // Schlafzimmer ---------------------------------------------------------------------------------------------
// Schlafzimmer Wolfgangs Seite 13976916 24 1 13976913 24 1 // Schlafzimmer Wolfgangs Seite 13976916 24 1 13976913 24 1
let bedRoomWolfgangsSide = new M433SwitchItem_1.M433SwitchItem('1st', 'BedRoom', 'WolfgangsSide', 'Wolfgangs Seite Schlafzimmer', '13976916 24 1', '13976913 24 1'); let bedRoomWolfgangsSide = new M433SwitchItem_1.M433SwitchItem('1st', 'BedRoom', 'WolfgangsSide', 'Wolfgangs Seite Schlafzimmer', '13976916 24 1', '13976913 24 1');
bedRoomWolfgangsSide.start(); bedRoomWolfgangsSide.start();
allLabeledItems.push(bedRoomWolfgangsSide); allLabeledItems.push(bedRoomWolfgangsSide);
allRelevantLights.push(bedRoomWolfgangsSide);
let bedRoomWolfgangBedLight = new HueColorBulbItem_1.HueColorBulbItem('1st', 'BedRoom', 'WolfgangBedLight', 'Bettlicht', 16); let bedRoomWolfgangBedLight = new HueColorBulbItem_1.HueColorBulbItem('1st', 'BedRoom', 'WolfgangBedLight', 'Bettlicht', 16);
bedRoomWolfgangBedLight.start(); bedRoomWolfgangBedLight.start();
allLabeledItems.push(bedRoomWolfgangBedLight); allLabeledItems.push(bedRoomWolfgangBedLight);
allRelevantLights.push(bedRoomWolfgangBedLight);
let bedRoomWolfgangBedLightDimmerAdaptor = new DimmerAdaptor_1.DimmerAdaptor('1st', 'BedRoom', 'WolfgangBedLight'); let bedRoomWolfgangBedLightDimmerAdaptor = new DimmerAdaptor_1.DimmerAdaptor('1st', 'BedRoom', 'WolfgangBedLight');
bedRoomWolfgangBedLightDimmerAdaptor.start(); bedRoomWolfgangBedLightDimmerAdaptor.start();
let touchSwitchMultiButtonThing = new TouchSwitchMultiButtonThing_1.TouchSwitchMultiButtonThing('1st', 'Bedroom', 'Wolfgang', [new TouchSwitchMultiButtonThing_1.TouchSwitchButtonSingleItem(bedRoomWolfgangBedLightDimmerAdaptor.getInTopic())]); let touchSwitchMultiButtonThing = new TouchSwitchMultiButtonThing_1.TouchSwitchMultiButtonThing('1st', 'Bedroom', 'Wolfgang', [new TouchSwitchMultiButtonThing_1.TouchSwitchButtonSingleItem(bedRoomWolfgangBedLightDimmerAdaptor.getInTopic())]);
@ -151,19 +176,24 @@ touchSwitchMultiButtonThing.start();
let bedRoomPattysSide = new M433SwitchItem_1.M433SwitchItem('1st', 'BedRoom', 'PattysSide', 'Pattys Seite Schlafzimmer', '13980756 24 1', '13980753 24 1'); let bedRoomPattysSide = new M433SwitchItem_1.M433SwitchItem('1st', 'BedRoom', 'PattysSide', 'Pattys Seite Schlafzimmer', '13980756 24 1', '13980753 24 1');
bedRoomPattysSide.start(); bedRoomPattysSide.start();
allLabeledItems.push(bedRoomPattysSide); allLabeledItems.push(bedRoomPattysSide);
allRelevantLights.push(bedRoomPattysSide);
// Schlafzimmer Fensterbank 13979988 24 1 13979985 24 1 // Schlafzimmer Fensterbank 13979988 24 1 13979985 24 1
let bedRoomWindowLight = new M433SwitchItem_1.M433SwitchItem('1st', 'BedRoom', 'WindowLight', 'Fensterbanklicht Schlafzimmer', '13979988 24 1', '13979985 24 1'); let bedRoomWindowLight = new M433SwitchItem_1.M433SwitchItem('1st', 'BedRoom', 'WindowLight', 'Fensterbanklicht Schlafzimmer', '13979988 24 1', '13979985 24 1');
bedRoomWindowLight.start(); bedRoomWindowLight.start();
allLabeledItems.push(bedRoomWindowLight); allLabeledItems.push(bedRoomWindowLight);
allRelevantLights.push(bedRoomWindowLight);
let windowContactBedroomStreet1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bedroom', 'WindowContactStreet', 'Fenster Schlafzimmer Strasse', 17); let windowContactBedroomStreet1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bedroom', 'WindowContactStreet', 'Fenster Schlafzimmer Strasse', 17);
windowContactBedroomStreet1st.start(); windowContactBedroomStreet1st.start();
allLabeledItems.push(windowContactBedroomStreet1st); allLabeledItems.push(windowContactBedroomStreet1st);
allWindows.push(windowContactBedroomStreet1st);
let windowContact1BedroomGarden1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bedroom', 'WindowContact1Garden', 'Fenster Schlafzimmer 1 Garten', 18); let windowContact1BedroomGarden1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bedroom', 'WindowContact1Garden', 'Fenster Schlafzimmer 1 Garten', 18);
windowContact1BedroomGarden1st.start(); windowContact1BedroomGarden1st.start();
allLabeledItems.push(windowContact1BedroomGarden1st); allLabeledItems.push(windowContact1BedroomGarden1st);
allWindows.push(windowContact1BedroomGarden1st);
let windowContact2BedroomGarden1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bedroom', 'WindowContact2Garden', 'Fenster Schlafzimmer 2 Garten', 22); let windowContact2BedroomGarden1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bedroom', 'WindowContact2Garden', 'Fenster Schlafzimmer 2 Garten', 22);
windowContact2BedroomGarden1st.start(); windowContact2BedroomGarden1st.start();
allLabeledItems.push(windowContact2BedroomGarden1st); allLabeledItems.push(windowContact2BedroomGarden1st);
allWindows.push(windowContact2BedroomGarden1st);
let thermostatBedroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bedroom', 'Thermostat', 'Thermostat Schlafzimmer', 19, [windowContact1BedroomGarden1st, windowContact2BedroomGarden1st, windowContactBedroomStreet1st]); let thermostatBedroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bedroom', 'Thermostat', 'Thermostat Schlafzimmer', 19, [windowContact1BedroomGarden1st, windowContact2BedroomGarden1st, windowContactBedroomStreet1st]);
thermostatBedroom1st.start(); thermostatBedroom1st.start();
thermostatBedroom1st.setPresetTemperature(20.0); thermostatBedroom1st.setPresetTemperature(20.0);
@ -211,6 +241,7 @@ allLabeledItems.push(morningLightScene);
let windowContactBathroomGnd = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Bathroom', 'WindowContact', 'Fenster Bad unten', 7); let windowContactBathroomGnd = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Bathroom', 'WindowContact', 'Fenster Bad unten', 7);
windowContactBathroomGnd.start(); windowContactBathroomGnd.start();
allLabeledItems.push(windowContactBathroomGnd); allLabeledItems.push(windowContactBathroomGnd);
allWindows.push(windowContactBathroomGnd);
let thermostatBathroomGnd = new MaxThermostat_1.MaxThermostat('Gnd', 'Bathroom', 'Thermostat', 'Thermostat Bad unten', 4, [windowContactBathroomGnd]); let thermostatBathroomGnd = new MaxThermostat_1.MaxThermostat('Gnd', 'Bathroom', 'Thermostat', 'Thermostat Bad unten', 4, [windowContactBathroomGnd]);
thermostatBathroomGnd.start(); thermostatBathroomGnd.start();
thermostatBathroomGnd.setPresetTemperature(20.0); thermostatBathroomGnd.setPresetTemperature(20.0);
@ -227,6 +258,7 @@ thermostatBathroomGndCron.start();
let windowContactBathroom1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2); let windowContactBathroom1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2);
windowContactBathroom1st.start(); windowContactBathroom1st.start();
allLabeledItems.push(windowContactBathroom1st); allLabeledItems.push(windowContactBathroom1st);
allWindows.push(windowContactBathroom1st);
let thermostatBathroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st]); let thermostatBathroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st]);
thermostatBathroom1st.start(); thermostatBathroom1st.start();
thermostatBathroom1st.setPresetTemperature(20.0); thermostatBathroom1st.setPresetTemperature(20.0);
@ -243,15 +275,19 @@ thermostatBathroom1stCron.start();
let windowContactKitchen1 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact1', 'Fenster Küche Garten', 11); let windowContactKitchen1 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact1', 'Fenster Küche Garten', 11);
windowContactKitchen1.start(); windowContactKitchen1.start();
allLabeledItems.push(windowContactKitchen1); allLabeledItems.push(windowContactKitchen1);
allWindows.push(windowContactKitchen1);
let windowContactKitchen2 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact2', 'Fenster Küche Terassentür Garten', 10); let windowContactKitchen2 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact2', 'Fenster Küche Terassentür Garten', 10);
windowContactKitchen2.start(); windowContactKitchen2.start();
allLabeledItems.push(windowContactKitchen2); allLabeledItems.push(windowContactKitchen2);
allWindows.push(windowContactKitchen2);
let windowContactKitchen3 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact3', 'Fenster Küche Straße 1', 12); let windowContactKitchen3 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact3', 'Fenster Küche Straße 1', 12);
windowContactKitchen3.start(); windowContactKitchen3.start();
allLabeledItems.push(windowContactKitchen3); allLabeledItems.push(windowContactKitchen3);
allWindows.push(windowContactKitchen3);
let windowContactKitchen4 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact4', 'Fenster Küche Straße 2', 13); let windowContactKitchen4 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact4', 'Fenster Küche Straße 2', 13);
windowContactKitchen4.start(); windowContactKitchen4.start();
allLabeledItems.push(windowContactKitchen4); allLabeledItems.push(windowContactKitchen4);
allWindows.push(windowContactKitchen4);
let thermostatKitchen = new MaxThermostat_1.MaxThermostat('Gnd', 'Kitchen', 'Thermostat', 'Thermostat Küche', 14, [ let thermostatKitchen = new MaxThermostat_1.MaxThermostat('Gnd', 'Kitchen', 'Thermostat', 'Thermostat Küche', 14, [
windowContactKitchen1, windowContactKitchen2, windowContactKitchen3, windowContactKitchen4 windowContactKitchen1, windowContactKitchen2, windowContactKitchen3, windowContactKitchen4
]); ]);
@ -281,6 +317,9 @@ allLabeledItems.push(relayBox);
let heatingSceneAll = new HeatingScene_1.HeatingScene('Gnd', 'House', 'Heatings', 'Alle Heizungen', allThermostatItems); let heatingSceneAll = new HeatingScene_1.HeatingScene('Gnd', 'House', 'Heatings', 'Alle Heizungen', allThermostatItems);
heatingSceneAll.start(); heatingSceneAll.start();
// ---------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------
let twoLedSignal1 = new TwoLedSignal_1.TwoLedSignal('Gnd', 'Hallway', 'TwoLedSignal1', 'Licht- und Fenster-Anzeiger', allRelevantLights, "OFF", "ON", allWindows, "CLOSED", "OPEN");
twoLedSignal1.start();
// ----------------------------------------------------------------------------------------------------------
let testFourButton = new HomematicFourButtonThing_1.HomematicFourButtonThing('Gnd', 'Hallway', 'TestButton', 9, [ let testFourButton = new HomematicFourButtonThing_1.HomematicFourButtonThing('Gnd', 'Hallway', 'TestButton', 9, [
new HomematicFourButtonThing_1.HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/Testlight/dimmerIn'), new HomematicFourButtonThing_1.HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/Testlight/dimmerIn'),
new HomematicFourButtonThing_1.HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/DeskLight/timerIn'), new HomematicFourButtonThing_1.HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/DeskLight/timerIn'),

View File

@ -165,23 +165,6 @@
}, },
"config": {} "config": {}
}, },
"Gnd_DiningRoom_ShelfLight": {
"id": "Gnd_DiningRoom_ShelfLight",
"name": "Regallicht Esszimmer",
"service": "Lightbulb",
"topic": {
"setOn": "dispatcher_ng/items/Gnd/DiningRoom/ShelfLight/state",
"statusOn": "dispatcher_ng/items/Gnd/DiningRoom/ShelfLight/state/feedback"
},
"payload": {
"onTrue": "ON",
"onFalse": "OFF",
"brightnessFactor": "",
"hueFactor": "",
"saturationFactor": ""
},
"config": {}
},
"Gnd_DiningRoom_NaehkaestchenLight": { "Gnd_DiningRoom_NaehkaestchenLight": {
"id": "Gnd_DiningRoom_NaehkaestchenLight", "id": "Gnd_DiningRoom_NaehkaestchenLight",
"name": "Lampe Naehkaestchen", "name": "Lampe Naehkaestchen",

View File

@ -10,7 +10,6 @@ Contact 1st_Matthias_WindowContact "Fenster" {mqtt="<[localbroker:dispatcher_ng/
Switch Gnd_DiningRoom_SmallLight "kleine Lampe Esszimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/DiningRoom/SmallLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/DiningRoom/SmallLight/state/feedback:state:default]"} Switch Gnd_DiningRoom_SmallLight "kleine Lampe Esszimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/DiningRoom/SmallLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/DiningRoom/SmallLight/state/feedback:state:default]"}
Switch Gnd_DiningRoom_StandLight "Stehlampe Esszimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/DiningRoom/StandLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/DiningRoom/StandLight/state/feedback:state:default]"} Switch Gnd_DiningRoom_StandLight "Stehlampe Esszimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/DiningRoom/StandLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/DiningRoom/StandLight/state/feedback:state:default]"}
Switch Gnd_DiningRoom_CupboardLight "Schranklicht Esszimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/DiningRoom/CupboardLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/DiningRoom/CupboardLight/state/feedback:state:default]"} Switch Gnd_DiningRoom_CupboardLight "Schranklicht Esszimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/DiningRoom/CupboardLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/DiningRoom/CupboardLight/state/feedback:state:default]"}
Switch Gnd_DiningRoom_ShelfLight "Regallicht Esszimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/DiningRoom/ShelfLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/DiningRoom/ShelfLight/state/feedback:state:default]"}
Switch Gnd_LivingRoom_LargeLight "große Lampe Wohnzimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/LivingRoom/LargeLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/LivingRoom/LargeLight/state/feedback:state:default]"} Switch Gnd_LivingRoom_LargeLight "große Lampe Wohnzimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/LivingRoom/LargeLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/LivingRoom/LargeLight/state/feedback:state:default]"}
Switch Gnd_LivingRoom_SmallLight "kleine Lampe Wohnzimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/LivingRoom/SmallLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/LivingRoom/SmallLight/state/feedback:state:default]"} Switch Gnd_LivingRoom_SmallLight "kleine Lampe Wohnzimmer"{mqtt=">[localbroker:dispatcher_ng/items/Gnd/LivingRoom/SmallLight/state:command:*:default],<[localbroker:dispatcher_ng/items/Gnd/LivingRoom/SmallLight/state/feedback:state:default]"}

View File

@ -1,12 +1,48 @@
import { AItem, HasFeedbackTopic } from './AItem' import { AItem, HasFeedbackTopic } from './AItem'
import { mqttHandler } from './MqttDispatcher'
import * as logger from './log'
export class HeatingScene extends AItem { enum SignalState {
private led1Topics: string[] = [] SIGNAL_RED,
private led2Topics: string[] = [] SIGNAL_GREEN,
private led1GreenToken: string SIGNAL_UNKNOWN,
private led1RedToken: string }
private led2GreenToken: string
private led2RedToken: string class SignalItem {
private item: HasFeedbackTopic
private signalState: SignalState
private redToken: string
private greenToken: string
constructor(item: HasFeedbackTopic, redToken: string, greenToken: string) {
this.item = item
this.signalState = SignalState.SIGNAL_UNKNOWN
this.redToken = redToken
this.greenToken = greenToken
}
getSignalState() : SignalState {
return this.signalState
}
processMessage(topic: string, payload: string): void {
if (topic == this.item.getStateFeedbackTopic()) {
logger.info(`${topic}, ${payload}`)
if (payload == this.greenToken) {
this.signalState = SignalState.SIGNAL_GREEN
} else if (payload == this.redToken) {
this.signalState = SignalState.SIGNAL_RED
} else {
this.signalState = SignalState.SIGNAL_UNKNOWN
}
// logger.info(`DBG: SignalItem: ${topic}, ${payload}, ${this.signalState}`)
}
}
}
export class TwoLedSignal extends AItem {
private led1Items: SignalItem[] = []
private led2Items: SignalItem[] = []
constructor(floor: string, room: string, item: string, label: string, constructor(floor: string, room: string, item: string, label: string,
led1Items: HasFeedbackTopic[], led1GreenToken: string, led1RedToken: string, led1Items: HasFeedbackTopic[], led1GreenToken: string, led1RedToken: string,
@ -16,23 +52,39 @@ export class HeatingScene extends AItem {
this.subscribeTopics = [] this.subscribeTopics = []
led1Items.forEach((item: HasFeedbackTopic) => { led1Items.forEach((item: HasFeedbackTopic) => {
this.led1Topics.push(item.getStateFeedbackTopic()) this.led1Items.push(new SignalItem(item, led1RedToken, led1GreenToken))
this.subscribeTopics.push(item.getStateFeedbackTopic()) this.subscribeTopics.push(item.getStateFeedbackTopic())
}) })
led2Items.forEach((item: HasFeedbackTopic) => { led2Items.forEach((item: HasFeedbackTopic) => {
this.led2Topics.push(item.getStateFeedbackTopic()) this.led2Items.push(new SignalItem(item, led2RedToken, led2GreenToken))
this.subscribeTopics.push(item.getStateFeedbackTopic()) this.subscribeTopics.push(item.getStateFeedbackTopic())
}) })
this.led1GreenToken = led1GreenToken
this.led1RedToken = led1RedToken
this.led2GreenToken = led2GreenToken
this.led2RedToken = led2RedToken
} }
processMessage(topic: string, payload: string) : void { processMessage(topic: string, payload: string) : void {
let reds : number = 0
const RED_VALUES : SignalState[] = [SignalState.SIGNAL_RED, SignalState.SIGNAL_UNKNOWN]
this.led1Items.forEach((item: SignalItem) => {
item.processMessage(topic, payload)
if (RED_VALUES.indexOf(item.getSignalState()) != -1) {
reds++
}
// logger.info(`DBG: TwoLedSignal ${item.getSignalState()}, ${reds}`)
})
let msg = (reds > 0) ? "RED" : "GREEN"
mqttHandler.send(`${this.topicFirstPart}/led1`, msg)
reds = 0
this.led2Items.forEach((item: SignalItem) => {
item.processMessage(topic, payload)
if (RED_VALUES.indexOf(item.getSignalState()) != -1) {
reds++
}
// logger.info(`DBG: TwoLedSignal ${item.getSignalState()}, ${reds}`)
})
msg = (reds > 0) ? "RED" : "GREEN"
mqttHandler.send(`${this.topicFirstPart}/led2`, msg)
} }
} }

View File

@ -45,7 +45,7 @@ export class UrlSwitchItem extends AItem implements HasStateAndFeedbackTopic {
mqttHandler.send(this.stateFeedbackTopic, this.state); mqttHandler.send(this.stateFeedbackTopic, this.state);
if (this.state != this.oldState) { if (this.state != this.oldState) {
if (this.state == 'ON') { if (this.state == 'ON') {
http.get(this.onUrl) http.get(this.onUrl,)
} else { } else {
http.get(this.offUrl) http.get(this.offUrl)
} }

View File

@ -23,13 +23,14 @@ import { HueColorBulbItem } from './HueColorBulbItem'
import { TouchSwitchMultiButtonThing, TouchSwitchButtonSingleItem } from './TouchSwitchMultiButtonThing' import { TouchSwitchMultiButtonThing, TouchSwitchButtonSingleItem } from './TouchSwitchMultiButtonThing'
import { RelayBoxThing } from './RelayBox' import { RelayBoxThing } from './RelayBox'
import { HeatingScene } from './HeatingScene' import { HeatingScene } from './HeatingScene'
import { TwoLedSignal } from './TwoLedSignal'
logger.info("Dispatcher starting") logger.info("Dispatcher starting")
let allLabeledItems : Array<AItem> = new Array() let allLabeledItems : Array<AItem> = new Array()
let allThermostatItems : Array<HasInTopic> = new Array() let allThermostatItems : Array<HasInTopic> = new Array()
let allWindows : Array<HasFeedbackTopic> = new Array() let allWindows : Array<HasFeedbackTopic> = new Array()
let allRelevantLights: Array<HasFeedbackTopic> = new Array()
// Anna ----------------------------------------------------------------------------------------------------- // Anna -----------------------------------------------------------------------------------------------------
@ -53,7 +54,7 @@ aquariumLightCron.start()
let annaBedLight = new M433SwitchItem('1st', 'Anna', 'BedLight', 'Bettlicht Anna', '14668116 24 1', '14668113 24 1') let annaBedLight = new M433SwitchItem('1st', 'Anna', 'BedLight', 'Bettlicht Anna', '14668116 24 1', '14668113 24 1')
annaBedLight.start() annaBedLight.start()
allLabeledItems.push(annaBedLight) allLabeledItems.push(annaBedLight)
allRelevantLights.push(annaBedLight)
let windowContactAnna1st = new MaxWindowContact('1st', 'Anna', 'WindowContact', 'Fenster Anna', 20) let windowContactAnna1st = new MaxWindowContact('1st', 'Anna', 'WindowContact', 'Fenster Anna', 20)
windowContactAnna1st.start() windowContactAnna1st.start()
@ -84,16 +85,20 @@ thermostatAnna1stCron.start()
let matthiasStandLights = new M433SwitchItem('1st', 'Matthias', 'StandLight', 'Stehlampen Matthias', '7 24 1', '6 24 1') let matthiasStandLights = new M433SwitchItem('1st', 'Matthias', 'StandLight', 'Stehlampen Matthias', '7 24 1', '6 24 1')
matthiasStandLights.start() matthiasStandLights.start()
allLabeledItems.push(matthiasStandLights) allLabeledItems.push(matthiasStandLights)
allRelevantLights.push(matthiasStandLights)
// Matthias Bett 15 24 1 14 24 1 // Matthias Bett 15 24 1 14 24 1
let matthiasBedLight = new M433SwitchItem('1st', 'Matthias', 'BedLight', 'Bettlicht Matthias', '15 24 1', '14 24 1') let matthiasBedLight = new M433SwitchItem('1st', 'Matthias', 'BedLight', 'Bettlicht Matthias', '15 24 1', '14 24 1')
matthiasBedLight.start() matthiasBedLight.start()
allLabeledItems.push(matthiasBedLight) allLabeledItems.push(matthiasBedLight)
allRelevantLights.push(matthiasBedLight)
// Matthias Lautsprecher 11 24 1 10 24 1 // Matthias Lautsprecher 11 24 1 10 24 1
let matthiasSpeaker = new M433SwitchItem('1st', 'Matthias', 'Speaker', 'Lautsprecher Matthias', '11 24 1', '10 24 1', 'outlet') let matthiasSpeaker = new M433SwitchItem('1st', 'Matthias', 'Speaker', 'Lautsprecher Matthias', '11 24 1', '10 24 1', 'outlet')
matthiasSpeaker.start() matthiasSpeaker.start()
allLabeledItems.push(matthiasSpeaker) allLabeledItems.push(matthiasSpeaker)
allRelevantLights.push(matthiasSpeaker)
let windowContactMatthias = new MaxWindowContact('1st', 'Matthias', 'WindowContact', 'Fenster', 24) let windowContactMatthias = new MaxWindowContact('1st', 'Matthias', 'WindowContact', 'Fenster', 24)
windowContactMatthias.start() windowContactMatthias.start()
@ -107,46 +112,55 @@ allWindows.push(windowContactMatthias)
let diningRoomSmallLight = new M433SwitchItem('Gnd', 'DiningRoom', 'SmallLight', 'kleine Lampe Esszimmer', '69653 24 1', '69652 24 1') let diningRoomSmallLight = new M433SwitchItem('Gnd', 'DiningRoom', 'SmallLight', 'kleine Lampe Esszimmer', '69653 24 1', '69652 24 1')
diningRoomSmallLight.start() diningRoomSmallLight.start()
allLabeledItems.push(diningRoomSmallLight) allLabeledItems.push(diningRoomSmallLight)
allRelevantLights.push(diningRoomSmallLight)
// Esszimmer Stehlampe 86037 24 1 86036 24 1 // Esszimmer Stehlampe 86037 24 1 86036 24 1
let diningRoomStandLight = new M433SwitchItem('Gnd', 'DiningRoom', 'StandLight', 'Stehlampe Esszimmer', '86037 24 1', '86036 24 1') let diningRoomStandLight = new M433SwitchItem('Gnd', 'DiningRoom', 'StandLight', 'Stehlampe Esszimmer', '86037 24 1', '86036 24 1')
diningRoomStandLight.start() diningRoomStandLight.start()
allLabeledItems.push(diningRoomStandLight) allLabeledItems.push(diningRoomStandLight)
allRelevantLights.push(diningRoomStandLight)
// Esszimmer Schranklicht 65813 24 1 65812 24 1 // Esszimmer Schranklicht 65813 24 1 65812 24 1
let diningRoomCupboardLight = new M433SwitchItem('Gnd', 'DiningRoom', 'CupboardLight', 'Schranklicht Esszimmer', '65813 24 1', '65812 24 1') let diningRoomCupboardLight = new M433SwitchItem('Gnd', 'DiningRoom', 'CupboardLight', 'Schranklicht Esszimmer', '65813 24 1', '65812 24 1')
diningRoomCupboardLight.start() diningRoomCupboardLight.start()
allLabeledItems.push(diningRoomCupboardLight) allLabeledItems.push(diningRoomCupboardLight)
allRelevantLights.push(diningRoomCupboardLight)
// Esszimmer Regallicht // Esszimmer Regallicht
let diningRoomShelfLight = new UrlSwitchItem('Gnd', 'DiningRoom', 'ShelfLight', 'Regallicht Esszimmer', 'http://regallampe/dv?dv=1023', 'http://regallampe/dv?dv=0') let diningRoomShelfLight = new UrlSwitchItem('Gnd', 'DiningRoom', 'ShelfLight', 'Regallicht Esszimmer', 'http://regallampe/dv?dv=1023', 'http://regallampe/dv?dv=0')
diningRoomShelfLight.start() diningRoomShelfLight.start()
allLabeledItems.push(diningRoomShelfLight) allLabeledItems.push(diningRoomShelfLight)
allRelevantLights.push(diningRoomShelfLight)
let diningRoomNaehkaestchenLight = new HueColorBulbItem('Gnd', 'DiningRoom', 'NaehkaestchenLight', 'Lampe Naehkaestchen', 15) let diningRoomNaehkaestchenLight = new HueColorBulbItem('Gnd', 'DiningRoom', 'NaehkaestchenLight', 'Lampe Naehkaestchen', 15)
diningRoomNaehkaestchenLight.start() diningRoomNaehkaestchenLight.start()
allLabeledItems.push(diningRoomNaehkaestchenLight) allLabeledItems.push(diningRoomNaehkaestchenLight)
allRelevantLights.push(diningRoomNaehkaestchenLight)
// Wohnzimmer ----------------------------------------------------------------------------------------------- // Wohnzimmer -----------------------------------------------------------------------------------------------
// Wohnzimmer grosse Lampe 65557 24 1 65556 24 1 // Wohnzimmer grosse Lampe 65557 24 1 65556 24 1
let livingRoomLargeLight = new M433SwitchItem('Gnd', 'LivingRoom', 'LargeLight', 'große Lampe Wohnzimmer', '65557 24 1', '65556 24 1') let livingRoomLargeLight = new M433SwitchItem('Gnd', 'LivingRoom', 'LargeLight', 'große Lampe Wohnzimmer', '65557 24 1', '65556 24 1')
livingRoomLargeLight.start() livingRoomLargeLight.start()
allLabeledItems.push(livingRoomLargeLight) allLabeledItems.push(livingRoomLargeLight)
allRelevantLights.push(livingRoomLargeLight)
// Wohnzimmer kleine Lampe 87061 24 1 87060 24 1 // Wohnzimmer kleine Lampe 87061 24 1 87060 24 1
let livingRoomSmallLight = new M433SwitchItem('Gnd', 'LivingRoom', 'SmallLight', 'kleine Lampe Wohnzimmer', '87061 24 1', '87060 24 1') let livingRoomSmallLight = new M433SwitchItem('Gnd', 'LivingRoom', 'SmallLight', 'kleine Lampe Wohnzimmer', '87061 24 1', '87060 24 1')
livingRoomSmallLight.start() livingRoomSmallLight.start()
allLabeledItems.push(livingRoomSmallLight) allLabeledItems.push(livingRoomSmallLight)
allRelevantLights.push(livingRoomSmallLight)
// Wohnzimmer Sterne 69909 24 1 69908 24 1 // Wohnzimmer Sterne 69909 24 1 69908 24 1
let livingRoomStars = new M433SwitchItem('Gnd', 'LivingRoom', 'Stars', 'Sterne Wohnzimmer', '69909 24 1', '69908 24 1') let livingRoomStars = new M433SwitchItem('Gnd', 'LivingRoom', 'Stars', 'Sterne Wohnzimmer', '69909 24 1', '69908 24 1')
livingRoomStars.start() livingRoomStars.start()
allLabeledItems.push(livingRoomStars) allLabeledItems.push(livingRoomStars)
allRelevantLights.push(livingRoomStars)
// Wohnzimmer kleine Stehlampe 81941 24 1 81940 24 1 // Wohnzimmer kleine Stehlampe 81941 24 1 81940 24 1
let livingRoomStandLight = new M433SwitchItem('Gnd', 'LivingRoom', 'StandLight', 'Stehlampe Wohnzimmer', '81941 24 1', '81940 24 1') let livingRoomStandLight = new M433SwitchItem('Gnd', 'LivingRoom', 'StandLight', 'Stehlampe Wohnzimmer', '81941 24 1', '81940 24 1')
livingRoomStandLight.start() livingRoomStandLight.start()
allLabeledItems.push(livingRoomStandLight) allLabeledItems.push(livingRoomStandLight)
allRelevantLights.push(livingRoomStandLight)
// Flur ----------------------------------------------------------------------------------------------------- // Flur -----------------------------------------------------------------------------------------------------
@ -154,16 +168,19 @@ allLabeledItems.push(livingRoomStandLight)
let hallwayDeskLight = new M433SwitchItem('Gnd', 'Hallway', 'DeskLight', 'Schreibtischlampe Flur', '83221 24 1', '83220 24 1') let hallwayDeskLight = new M433SwitchItem('Gnd', 'Hallway', 'DeskLight', 'Schreibtischlampe Flur', '83221 24 1', '83220 24 1')
hallwayDeskLight.start() hallwayDeskLight.start()
allLabeledItems.push(hallwayDeskLight) allLabeledItems.push(hallwayDeskLight)
allRelevantLights.push(hallwayDeskLight)
// Flur Stehlampe 8704914 24 5 8793154 24 5 // Flur Stehlampe 8704914 24 5 8793154 24 5
let hallwayStandLight = new M433SwitchItem('Gnd', 'Hallway', 'StandLight', 'Stehlampe Flur', '8704914 24 5', '8793154 24 5') let hallwayStandLight = new M433SwitchItem('Gnd', 'Hallway', 'StandLight', 'Stehlampe Flur', '8704914 24 5', '8793154 24 5')
hallwayStandLight.start() hallwayStandLight.start()
allLabeledItems.push(hallwayStandLight) allLabeledItems.push(hallwayStandLight)
allRelevantLights.push(hallwayStandLight)
// Flur Schranklicht 66581 24 1 66580 24 1 // Flur Schranklicht 66581 24 1 66580 24 1
let hallwayWardrobeLight = new M433SwitchItem('Gnd', 'Hallway', 'WardrobeLight', 'Schranklicht Flur', '66581 24 1', '66580 24 1') let hallwayWardrobeLight = new M433SwitchItem('Gnd', 'Hallway', 'WardrobeLight', 'Schranklicht Flur', '66581 24 1', '66580 24 1')
hallwayWardrobeLight.start() hallwayWardrobeLight.start()
allLabeledItems.push(hallwayWardrobeLight) allLabeledItems.push(hallwayWardrobeLight)
allRelevantLights.push(hallwayWardrobeLight)
// Küche ---------------------------------------------------------------------------------------------------- // Küche ----------------------------------------------------------------------------------------------------
@ -171,11 +188,13 @@ allLabeledItems.push(hallwayWardrobeLight)
let kitchenWindowLight = new M433SwitchItem('Gnd', 'Kitchen', 'WindowLight', 'Fensterbanklicht Küche', '66837 24 1', '66836 24 1') let kitchenWindowLight = new M433SwitchItem('Gnd', 'Kitchen', 'WindowLight', 'Fensterbanklicht Küche', '66837 24 1', '66836 24 1')
kitchenWindowLight.start() kitchenWindowLight.start()
allLabeledItems.push(kitchenWindowLight) allLabeledItems.push(kitchenWindowLight)
allRelevantLights.push(kitchenWindowLight)
// Küche Deckenlampe 82197 24 1 82196 24 1 // Küche Deckenlampe 82197 24 1 82196 24 1
let kitchenCeilingLight = new M433SwitchItem('Gnd', 'Kitchen', 'CeilingLight', 'Deckenlampe Küche', '82197 24 1', '82196 24 1') let kitchenCeilingLight = new M433SwitchItem('Gnd', 'Kitchen', 'CeilingLight', 'Deckenlampe Küche', '82197 24 1', '82196 24 1')
kitchenCeilingLight.start() kitchenCeilingLight.start()
allLabeledItems.push(kitchenCeilingLight) allLabeledItems.push(kitchenCeilingLight)
allRelevantLights.push(kitchenCeilingLight)
// Schlafzimmer --------------------------------------------------------------------------------------------- // Schlafzimmer ---------------------------------------------------------------------------------------------
@ -183,10 +202,12 @@ allLabeledItems.push(kitchenCeilingLight)
let bedRoomWolfgangsSide = new M433SwitchItem('1st', 'BedRoom', 'WolfgangsSide', 'Wolfgangs Seite Schlafzimmer', '13976916 24 1', '13976913 24 1') let bedRoomWolfgangsSide = new M433SwitchItem('1st', 'BedRoom', 'WolfgangsSide', 'Wolfgangs Seite Schlafzimmer', '13976916 24 1', '13976913 24 1')
bedRoomWolfgangsSide.start() bedRoomWolfgangsSide.start()
allLabeledItems.push(bedRoomWolfgangsSide) allLabeledItems.push(bedRoomWolfgangsSide)
allRelevantLights.push(bedRoomWolfgangsSide)
let bedRoomWolfgangBedLight = new HueColorBulbItem('1st', 'BedRoom', 'WolfgangBedLight', 'Bettlicht', 16) let bedRoomWolfgangBedLight = new HueColorBulbItem('1st', 'BedRoom', 'WolfgangBedLight', 'Bettlicht', 16)
bedRoomWolfgangBedLight.start() bedRoomWolfgangBedLight.start()
allLabeledItems.push(bedRoomWolfgangBedLight) allLabeledItems.push(bedRoomWolfgangBedLight)
allRelevantLights.push(bedRoomWolfgangBedLight)
let bedRoomWolfgangBedLightDimmerAdaptor = new DimmerAdaptor('1st', 'BedRoom', 'WolfgangBedLight') let bedRoomWolfgangBedLightDimmerAdaptor = new DimmerAdaptor('1st', 'BedRoom', 'WolfgangBedLight')
bedRoomWolfgangBedLightDimmerAdaptor.start() bedRoomWolfgangBedLightDimmerAdaptor.start()
@ -199,11 +220,13 @@ touchSwitchMultiButtonThing.start()
let bedRoomPattysSide = new M433SwitchItem('1st', 'BedRoom', 'PattysSide', 'Pattys Seite Schlafzimmer', '13980756 24 1', '13980753 24 1') let bedRoomPattysSide = new M433SwitchItem('1st', 'BedRoom', 'PattysSide', 'Pattys Seite Schlafzimmer', '13980756 24 1', '13980753 24 1')
bedRoomPattysSide.start() bedRoomPattysSide.start()
allLabeledItems.push(bedRoomPattysSide) allLabeledItems.push(bedRoomPattysSide)
allRelevantLights.push(bedRoomPattysSide)
// Schlafzimmer Fensterbank 13979988 24 1 13979985 24 1 // Schlafzimmer Fensterbank 13979988 24 1 13979985 24 1
let bedRoomWindowLight = new M433SwitchItem('1st', 'BedRoom', 'WindowLight', 'Fensterbanklicht Schlafzimmer', '13979988 24 1', '13979985 24 1') let bedRoomWindowLight = new M433SwitchItem('1st', 'BedRoom', 'WindowLight', 'Fensterbanklicht Schlafzimmer', '13979988 24 1', '13979985 24 1')
bedRoomWindowLight.start() bedRoomWindowLight.start()
allLabeledItems.push(bedRoomWindowLight) allLabeledItems.push(bedRoomWindowLight)
allRelevantLights.push(bedRoomWindowLight)
@ -375,6 +398,14 @@ allLabeledItems.push(relayBox)
let heatingSceneAll = new HeatingScene('Gnd', 'House', 'Heatings', 'Alle Heizungen', allThermostatItems) let heatingSceneAll = new HeatingScene('Gnd', 'House', 'Heatings', 'Alle Heizungen', allThermostatItems)
heatingSceneAll.start() heatingSceneAll.start()
// ----------------------------------------------------------------------------------------------------------
let twoLedSignal1 = new TwoLedSignal('Gnd', 'Hallway', 'TwoLedSignal1', 'Licht- und Fenster-Anzeiger',
allRelevantLights, "OFF", "ON",
allWindows, "CLOSED", "OPEN")
twoLedSignal1.start()
// ---------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------
let testFourButton = new HomematicFourButtonThing('Gnd', 'Hallway', 'TestButton', 9, [ let testFourButton = new HomematicFourButtonThing('Gnd', 'Hallway', 'TestButton', 9, [
new HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/Testlight/dimmerIn'), new HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/Testlight/dimmerIn'),
@ -450,4 +481,3 @@ fs.writeFileSync(config.dict.openhabItemFile, openhabList.join('\n'))
mqttHandler.exec() mqttHandler.exec()
logger.info("Dispatcher running") logger.info("Dispatcher running")