6 Commits

18 changed files with 357 additions and 583 deletions

View File

@ -8,12 +8,5 @@
"smtpSender": "dispatcher@hottis.de",
"smtpReceiver": "woho@hottis.de",
"homekitFile": "homekit.json",
"openhabItemFile": "openhab.items",
"geofencesPort": 8000,
"occupants": {
"386D105B-80D0-4708-95AB-77B4D1E36D0E": "Wolfgang",
"E24E910A-ED0A-444E-8290-794339BC887C": "Matthias",
"D7352171-FCF5-4E21-8FD3-8C34FF0F2F15": "Anna",
"219117FF-B721-43E3-BE56-F77E8239705E": "Patty"
}
"openhabItemFile": "openhab.items"
}

45
dist/GeoFences.js vendored
View File

@ -1,45 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express = require("express");
const logger = require("./log");
const bodyParser = require("body-parser");
const config = require("./config");
const MqttDispatcher_1 = require("./MqttDispatcher");
const events_1 = require("events");
class GeoFences extends events_1.EventEmitter {
constructor() {
super();
this.app = express();
this.app.use(bodyParser.urlencoded({ extended: false }));
this.app.use(bodyParser.json());
this.attendanceSheet = {};
}
exec() {
this.app.post('/', (req, res) => {
const reqData = req.body;
const deviceId = reqData.device;
let occupantName = 'unknown';
const location = reqData.name;
if (deviceId in config.dict.occupants) {
occupantName = config.dict.occupants[deviceId];
}
const presence = reqData.entry == '1';
const direction = presence ? 'arrives at' : 'leaves from';
logger.info(`${deviceId} (${occupantName}) ${direction} ${location}`);
logger.info(JSON.stringify(reqData));
res.send('OK');
const state = presence ? 'present' : 'absent';
MqttDispatcher_1.mqttHandler.send(`${GeoFences.geoFencesTopicPre}/${occupantName}`, state);
this.attendanceSheet[occupantName] = presence;
logger.info(`attendanceSheet is now ${JSON.stringify(this.attendanceSheet)}`);
this.emit('change', this.attendanceSheet);
});
let port = parseInt(config.dict.geofencesPort);
this.server = this.app.listen(port, '', () => {
logger.info(`geofences server listening on ${port}`);
});
}
}
GeoFences.geoFencesTopicPre = "dispatcher_ng/geofences";
exports.GeoFences = GeoFences;
//# sourceMappingURL=GeoFences.js.map

14
dist/HeatingScene.js vendored Normal file
View File

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Forwarder_1 = require("./Forwarder");
class HeatingScene extends Forwarder_1.Forwarder {
constructor(floor, room, item, label, targetItems) {
let inTopics = [];
targetItems.forEach((item) => {
inTopics.push(item.getInTopic());
});
super(floor, room, item, "command", label, inTopics);
}
}
exports.HeatingScene = HeatingScene;
//# sourceMappingURL=HeatingScene.js.map

22
dist/MaxThermostat.js vendored
View File

@ -54,13 +54,16 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
setTemperature = true;
}
else if (topic == this.commandTopic) {
if (this.heatingMainFlag) {
if (payload == 'ON') {
this.temperature = this.presetTemperature;
}
else if (payload == 'OFF') {
this.temperature = DISABLED_TEMPERATURE;
}
if ((payload == 'ON') && this.heatingMainFlag) {
this.temperature = this.presetTemperature;
setTemperature = true;
}
else if (payload == 'OFF') {
this.temperature = DISABLED_TEMPERATURE;
setTemperature = true;
}
else if (payload == 'FORCE_ON') {
this.temperature = this.presetTemperature;
setTemperature = true;
}
}
@ -68,8 +71,9 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem {
this.heatingMainFlag = (payload == 'ON');
logger.info(`${this.itemId} heating main: ${this.heatingMainFlag}`);
if (!this.heatingMainFlag) {
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${DISABLED_TEMPERATURE}`);
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${DISABLED_TEMPERATURE}`);
this.temperature = DISABLED_TEMPERATURE;
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${this.temperature}`);
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${this.temperature}`);
}
}
else if (topic == this.presetTemperatureTopic) {

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

57
dist/main.js vendored
View File

@ -20,9 +20,13 @@ const Cron_1 = require("./Cron");
const HueColorBulbItem_1 = require("./HueColorBulbItem");
const TouchSwitchMultiButtonThing_1 = require("./TouchSwitchMultiButtonThing");
const RelayBox_1 = require("./RelayBox");
const GeoFences_1 = require("./GeoFences");
const HeatingScene_1 = require("./HeatingScene");
const TwoLedSignal_1 = require("./TwoLedSignal");
logger.info("Dispatcher starting");
let allLabeledItems = new Array();
let allThermostatItems = new Array();
let allWindows = new Array();
let allRelevantLights = new Array();
// Anna -----------------------------------------------------------------------------------------------------
// Anna Aquarium 14665044 24 1 14665041 24 1
let aquariumLight = new M433SwitchItem_1.M433SwitchItem('1st', 'Anna', 'AquariumLight', 'Aquariumlicht', '14665044 24 1', '14665041 24 1');
@ -40,13 +44,16 @@ aquariumLightCron.start();
let annaBedLight = new M433SwitchItem_1.M433SwitchItem('1st', 'Anna', 'BedLight', 'Bettlicht Anna', '14668116 24 1', '14668113 24 1');
annaBedLight.start();
allLabeledItems.push(annaBedLight);
allRelevantLights.push(annaBedLight);
let windowContactAnna1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Anna', 'WindowContact', 'Fenster Anna', 20);
windowContactAnna1st.start();
allLabeledItems.push(windowContactAnna1st);
allWindows.push(windowContactAnna1st);
let thermostatAnna1st = new MaxThermostat_1.MaxThermostat('1st', 'Anna', 'Thermostat', 'Thermostat Anna', 21, [windowContactAnna1st]);
thermostatAnna1st.start();
thermostatAnna1st.setPresetTemperature(21.0);
allLabeledItems.push(thermostatAnna1st);
allThermostatItems.push(thermostatAnna1st);
let thermostatAnna1stCron = new Cron_1.Cron('thermostatAnna1stCron', thermostatAnna1st, [
{ cronTime: '00 05 06 * * *', output: 'ON' },
{ cronTime: '00 05 08 * * 1-5', output: 'OFF' },
@ -63,81 +70,104 @@ thermostatAnna1stCron.start();
let matthiasStandLights = new M433SwitchItem_1.M433SwitchItem('1st', 'Matthias', 'StandLight', 'Stehlampen Matthias', '7 24 1', '6 24 1');
matthiasStandLights.start();
allLabeledItems.push(matthiasStandLights);
allRelevantLights.push(matthiasStandLights);
// 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');
matthiasBedLight.start();
allLabeledItems.push(matthiasBedLight);
allRelevantLights.push(matthiasBedLight);
// 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');
matthiasSpeaker.start();
allLabeledItems.push(matthiasSpeaker);
allRelevantLights.push(matthiasSpeaker);
let windowContactMatthias = new MaxWindowContact_1.MaxWindowContact('1st', 'Matthias', 'WindowContact', 'Fenster', 24);
windowContactMatthias.start();
allLabeledItems.push(windowContactMatthias);
allWindows.push(windowContactMatthias);
// Esszimmer ------------------------------------------------------------------------------------------------
// 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');
diningRoomSmallLight.start();
allLabeledItems.push(diningRoomSmallLight);
allRelevantLights.push(diningRoomSmallLight);
// 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');
diningRoomStandLight.start();
allLabeledItems.push(diningRoomStandLight);
allRelevantLights.push(diningRoomStandLight);
// 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');
diningRoomCupboardLight.start();
allLabeledItems.push(diningRoomCupboardLight);
allRelevantLights.push(diningRoomCupboardLight);
// Esszimmer Regallicht
let diningRoomShelfLight = new UrlSwitchItem_1.UrlSwitchItem('Gnd', 'DiningRoom', 'ShelfLight', 'Regallicht Esszimmer', 'http://regallampe/dv?dv=1023', 'http://regallampe/dv?dv=0');
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);
allRelevantLights.push(diningRoomNaehkaestchenLight);
// Wohnzimmer -----------------------------------------------------------------------------------------------
// 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');
livingRoomLargeLight.start();
allLabeledItems.push(livingRoomLargeLight);
allRelevantLights.push(livingRoomLargeLight);
// 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');
livingRoomSmallLight.start();
allLabeledItems.push(livingRoomSmallLight);
allRelevantLights.push(livingRoomSmallLight);
// 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');
livingRoomStars.start();
allLabeledItems.push(livingRoomStars);
allRelevantLights.push(livingRoomStars);
// 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');
livingRoomStandLight.start();
allLabeledItems.push(livingRoomStandLight);
allRelevantLights.push(livingRoomStandLight);
// Flur -----------------------------------------------------------------------------------------------------
// 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');
hallwayDeskLight.start();
allLabeledItems.push(hallwayDeskLight);
allRelevantLights.push(hallwayDeskLight);
// 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');
hallwayStandLight.start();
allLabeledItems.push(hallwayStandLight);
allRelevantLights.push(hallwayStandLight);
// 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');
hallwayWardrobeLight.start();
allLabeledItems.push(hallwayWardrobeLight);
allRelevantLights.push(hallwayWardrobeLight);
// Küche ----------------------------------------------------------------------------------------------------
// 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');
kitchenWindowLight.start();
allLabeledItems.push(kitchenWindowLight);
allRelevantLights.push(kitchenWindowLight);
// 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');
kitchenCeilingLight.start();
allLabeledItems.push(kitchenCeilingLight);
allRelevantLights.push(kitchenCeilingLight);
// Schlafzimmer ---------------------------------------------------------------------------------------------
// 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');
bedRoomWolfgangsSide.start();
allLabeledItems.push(bedRoomWolfgangsSide);
allRelevantLights.push(bedRoomWolfgangsSide);
let bedRoomWolfgangBedLight = new HueColorBulbItem_1.HueColorBulbItem('1st', 'BedRoom', 'WolfgangBedLight', 'Bettlicht', 16);
bedRoomWolfgangBedLight.start();
allLabeledItems.push(bedRoomWolfgangBedLight);
allRelevantLights.push(bedRoomWolfgangBedLight);
let bedRoomWolfgangBedLightDimmerAdaptor = new DimmerAdaptor_1.DimmerAdaptor('1st', 'BedRoom', 'WolfgangBedLight');
bedRoomWolfgangBedLightDimmerAdaptor.start();
let touchSwitchMultiButtonThing = new TouchSwitchMultiButtonThing_1.TouchSwitchMultiButtonThing('1st', 'Bedroom', 'Wolfgang', [new TouchSwitchMultiButtonThing_1.TouchSwitchButtonSingleItem(bedRoomWolfgangBedLightDimmerAdaptor.getInTopic())]);
@ -146,23 +176,29 @@ touchSwitchMultiButtonThing.start();
let bedRoomPattysSide = new M433SwitchItem_1.M433SwitchItem('1st', 'BedRoom', 'PattysSide', 'Pattys Seite Schlafzimmer', '13980756 24 1', '13980753 24 1');
bedRoomPattysSide.start();
allLabeledItems.push(bedRoomPattysSide);
allRelevantLights.push(bedRoomPattysSide);
// 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');
bedRoomWindowLight.start();
allLabeledItems.push(bedRoomWindowLight);
allRelevantLights.push(bedRoomWindowLight);
let windowContactBedroomStreet1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bedroom', 'WindowContactStreet', 'Fenster Schlafzimmer Strasse', 17);
windowContactBedroomStreet1st.start();
allLabeledItems.push(windowContactBedroomStreet1st);
allWindows.push(windowContactBedroomStreet1st);
let windowContact1BedroomGarden1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bedroom', 'WindowContact1Garden', 'Fenster Schlafzimmer 1 Garten', 18);
windowContact1BedroomGarden1st.start();
allLabeledItems.push(windowContact1BedroomGarden1st);
allWindows.push(windowContact1BedroomGarden1st);
let windowContact2BedroomGarden1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bedroom', 'WindowContact2Garden', 'Fenster Schlafzimmer 2 Garten', 22);
windowContact2BedroomGarden1st.start();
allLabeledItems.push(windowContact2BedroomGarden1st);
allWindows.push(windowContact2BedroomGarden1st);
let thermostatBedroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bedroom', 'Thermostat', 'Thermostat Schlafzimmer', 19, [windowContact1BedroomGarden1st, windowContact2BedroomGarden1st, windowContactBedroomStreet1st]);
thermostatBedroom1st.start();
thermostatBedroom1st.setPresetTemperature(20.0);
allLabeledItems.push(thermostatBedroom1st);
allThermostatItems.push(thermostatBedroom1st);
let thermostatBedroom1stCron = new Cron_1.Cron('thermostatBedroom1stCron', thermostatBedroom1st, [
{ cronTime: '00 01 06 * * 1-5', output: 'ON' },
{ cronTime: '00 01 09 * * 1-5', output: 'OFF' },
@ -205,10 +241,12 @@ allLabeledItems.push(morningLightScene);
let windowContactBathroomGnd = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Bathroom', 'WindowContact', 'Fenster Bad unten', 7);
windowContactBathroomGnd.start();
allLabeledItems.push(windowContactBathroomGnd);
allWindows.push(windowContactBathroomGnd);
let thermostatBathroomGnd = new MaxThermostat_1.MaxThermostat('Gnd', 'Bathroom', 'Thermostat', 'Thermostat Bad unten', 4, [windowContactBathroomGnd]);
thermostatBathroomGnd.start();
thermostatBathroomGnd.setPresetTemperature(20.0);
allLabeledItems.push(thermostatBathroomGnd);
allThermostatItems.push(thermostatBathroomGnd);
let thermostatBathroomGndCron = new Cron_1.Cron('thermostatBathroomGndCron', thermostatBathroomGnd, [
{ cronTime: '00 02 06 * * 1-5', output: 'ON' },
{ cronTime: '00 02 08 * * 6,0', output: 'ON' },
@ -220,10 +258,12 @@ thermostatBathroomGndCron.start();
let windowContactBathroom1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2);
windowContactBathroom1st.start();
allLabeledItems.push(windowContactBathroom1st);
allWindows.push(windowContactBathroom1st);
let thermostatBathroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st]);
thermostatBathroom1st.start();
thermostatBathroom1st.setPresetTemperature(20.0);
allLabeledItems.push(thermostatBathroom1st);
allThermostatItems.push(thermostatBathroom1st);
let thermostatBathroom1stCron = new Cron_1.Cron('thermostatBathroom1stCron', thermostatBathroom1st, [
{ cronTime: '00 00 06 * * 1-5', output: 'ON' },
{ cronTime: '00 00 08 * * 6,0', output: 'ON' },
@ -235,21 +275,26 @@ thermostatBathroom1stCron.start();
let windowContactKitchen1 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact1', 'Fenster Küche Garten', 11);
windowContactKitchen1.start();
allLabeledItems.push(windowContactKitchen1);
allWindows.push(windowContactKitchen1);
let windowContactKitchen2 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact2', 'Fenster Küche Terassentür Garten', 10);
windowContactKitchen2.start();
allLabeledItems.push(windowContactKitchen2);
allWindows.push(windowContactKitchen2);
let windowContactKitchen3 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact3', 'Fenster Küche Straße 1', 12);
windowContactKitchen3.start();
allLabeledItems.push(windowContactKitchen3);
allWindows.push(windowContactKitchen3);
let windowContactKitchen4 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact4', 'Fenster Küche Straße 2', 13);
windowContactKitchen4.start();
allLabeledItems.push(windowContactKitchen4);
allWindows.push(windowContactKitchen4);
let thermostatKitchen = new MaxThermostat_1.MaxThermostat('Gnd', 'Kitchen', 'Thermostat', 'Thermostat Küche', 14, [
windowContactKitchen1, windowContactKitchen2, windowContactKitchen3, windowContactKitchen4
]);
thermostatKitchen.start();
thermostatKitchen.setPresetTemperature(20.0);
allLabeledItems.push(thermostatKitchen);
allThermostatItems.push(thermostatKitchen);
let thermostatKitchenCron = new Cron_1.Cron('thermostatKitchenCron', thermostatKitchen, [
{ cronTime: '00 00 06 * * 1-5', output: 'ON' },
{ cronTime: '00 00 08 * * 6,0', output: 'ON' },
@ -269,11 +314,11 @@ let relayBox = new RelayBox_1.RelayBoxThing('base', 'labor', 'relaybox', 'IoT/Co
relayBox.start();
allLabeledItems.push(relayBox);
// ----------------------------------------------------------------------------------------------------------
let geoFences = new GeoFences_1.GeoFences();
geoFences.exec();
geoFences.on('change', (attendanceSheet) => {
logger.info(`geoFences change event: ${JSON.stringify(attendanceSheet)}`);
});
let heatingSceneAll = new HeatingScene_1.HeatingScene('Gnd', 'House', 'Heatings', 'Alle Heizungen', allThermostatItems);
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, [
new HomematicFourButtonThing_1.HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/Testlight/dimmerIn'),

View File

@ -103,6 +103,17 @@
},
"config": {}
},
"1st_Matthias_WindowContact": {
"id": "1st_Matthias_WindowContact",
"name": "Fenster",
"service": "ContactSensor",
"topic": {
"statusContactSensorState": "dispatcher_ng/items/1st/Matthias/WindowContact/state/feedback"
},
"payload": {
"onContactDetected": "CLOSED"
}
},
"Gnd_DiningRoom_SmallLight": {
"id": "Gnd_DiningRoom_SmallLight",
"name": "kleine Lampe Esszimmer",
@ -154,23 +165,6 @@
},
"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": {
"id": "Gnd_DiningRoom_NaehkaestchenLight",
"name": "Lampe Naehkaestchen",

View File

@ -6,10 +6,10 @@ Number Preset_1st_Anna_Thermostat "Preset_Thermostat Anna [%.1f °C]" {mqtt=">[l
Switch 1st_Matthias_StandLight "Stehlampen Matthias"{mqtt=">[localbroker:dispatcher_ng/items/1st/Matthias/StandLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Matthias/StandLight/state/feedback:state:default]"}
Switch 1st_Matthias_BedLight "Bettlicht Matthias"{mqtt=">[localbroker:dispatcher_ng/items/1st/Matthias/BedLight/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Matthias/BedLight/state/feedback:state:default]"}
Switch 1st_Matthias_Speaker "Lautsprecher Matthias"{mqtt=">[localbroker:dispatcher_ng/items/1st/Matthias/Speaker/state:command:*:default],<[localbroker:dispatcher_ng/items/1st/Matthias/Speaker/state/feedback:state:default]"}
Contact 1st_Matthias_WindowContact "Fenster" {mqtt="<[localbroker:dispatcher_ng/items/1st/Matthias/WindowContact/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_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_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]"}

408
package-lock.json generated
View File

@ -4,16 +4,6 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/body-parser": {
"version": "1.16.8",
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.16.8.tgz",
"integrity": "sha512-BdN2PXxOFnTXFcyONPW6t0fHjz2fvRZHVMFpaS0wYr+Y8fWEaNOs4V8LEu/fpzQlMx+ahdndgTaGTwPC+J/EeA==",
"dev": true,
"requires": {
"@types/express": "4.11.1",
"@types/node": "8.5.8"
}
},
"@types/chalk": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@types/chalk/-/chalk-2.2.0.tgz",
@ -35,39 +25,6 @@
"integrity": "sha1-lcHkMtYQbKNMkvB0Nji8eGwHP6o=",
"dev": true
},
"@types/events": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz",
"integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==",
"dev": true
},
"@types/express": {
"version": "4.11.1",
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.11.1.tgz",
"integrity": "sha512-ttWle8cnPA5rAelauSWeWJimtY2RsUf2aspYZs7xPHiWgOlPn6nnUfBMtrkcnjFJuIHJF4gNOdVvpLK2Zmvh6g==",
"dev": true,
"requires": {
"@types/body-parser": "1.16.8",
"@types/express-serve-static-core": "4.11.1",
"@types/serve-static": "1.13.1"
}
},
"@types/express-serve-static-core": {
"version": "4.11.1",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.11.1.tgz",
"integrity": "sha512-EehCl3tpuqiM8RUb+0255M8PhhSwTtLfmO7zBBdv0ay/VTd/zmrqDfQdZFsa5z/PVMbH2yCMZPXsnrImpATyIw==",
"dev": true,
"requires": {
"@types/events": "1.2.0",
"@types/node": "8.5.8"
}
},
"@types/mime": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.0.tgz",
"integrity": "sha512-A2TAGbTFdBw9azHbpVd+/FkdW2T6msN1uct1O9bH3vTerEHKZhTXJUQXy+hNq1B0RagfU8U+KBdqiZpxjhOUQA==",
"dev": true
},
"@types/moment": {
"version": "2.13.0",
"resolved": "https://registry.npmjs.org/@types/moment/-/moment-2.13.0.tgz",
@ -101,25 +58,6 @@
"@types/node": "8.5.8"
}
},
"@types/serve-static": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.1.tgz",
"integrity": "sha512-jDMH+3BQPtvqZVIcsH700Dfi8Q3MIcEx16g/VdxjoqiGR/NntekB10xdBpirMKnPe9z2C5cBmL0vte0YttOr3Q==",
"dev": true,
"requires": {
"@types/express-serve-static-core": "4.11.1",
"@types/mime": "2.0.0"
}
},
"accepts": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
"integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
"requires": {
"mime-types": "2.1.18",
"negotiator": "0.6.1"
}
},
"ansi-styles": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
@ -136,11 +74,6 @@
"typical": "2.6.1"
}
},
"array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
@ -159,23 +92,6 @@
"readable-stream": "2.3.3"
}
},
"body-parser": {
"version": "1.18.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz",
"integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=",
"requires": {
"bytes": "3.0.0",
"content-type": "1.0.4",
"debug": "2.6.9",
"depd": "1.1.2",
"http-errors": "1.6.3",
"iconv-lite": "0.4.19",
"on-finished": "2.3.0",
"qs": "6.5.1",
"raw-body": "2.3.2",
"type-is": "1.6.16"
}
},
"brace-expansion": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
@ -185,11 +101,6 @@
"concat-map": "0.0.1"
}
},
"bytes": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
"integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg="
},
"callback-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/callback-stream/-/callback-stream-1.1.0.tgz",
@ -256,26 +167,6 @@
"typedarray": "0.0.6"
}
},
"content-disposition": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
"integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
},
"content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
},
"cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@ -289,24 +180,6 @@
"moment-timezone": "0.5.14"
}
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"destroy": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"duplexify": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.1.tgz",
@ -318,16 +191,6 @@
"stream-shift": "1.0.0"
}
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"end-of-stream": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz",
@ -336,77 +199,16 @@
"once": "1.4.0"
}
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
},
"express": {
"version": "4.16.3",
"resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz",
"integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=",
"requires": {
"accepts": "1.3.5",
"array-flatten": "1.1.1",
"body-parser": "1.18.2",
"content-disposition": "0.5.2",
"content-type": "1.0.4",
"cookie": "0.3.1",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "1.1.2",
"encodeurl": "1.0.2",
"escape-html": "1.0.3",
"etag": "1.8.1",
"finalhandler": "1.1.1",
"fresh": "0.5.2",
"merge-descriptors": "1.0.1",
"methods": "1.1.2",
"on-finished": "2.3.0",
"parseurl": "1.3.2",
"path-to-regexp": "0.1.7",
"proxy-addr": "2.0.3",
"qs": "6.5.1",
"range-parser": "1.2.0",
"safe-buffer": "5.1.1",
"send": "0.16.2",
"serve-static": "1.13.2",
"setprototypeof": "1.1.0",
"statuses": "1.4.0",
"type-is": "1.6.16",
"utils-merge": "1.0.1",
"vary": "1.1.2"
}
},
"extend": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
},
"finalhandler": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
"requires": {
"debug": "2.6.9",
"encodeurl": "1.0.2",
"escape-html": "1.0.3",
"on-finished": "2.3.0",
"parseurl": "1.3.2",
"statuses": "1.4.0",
"unpipe": "1.0.0"
}
},
"find-replace": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/find-replace/-/find-replace-1.0.3.tgz",
@ -426,16 +228,6 @@
}
}
},
"forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
},
"fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -496,22 +288,6 @@
"xtend": "4.0.1"
}
},
"http-errors": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
"requires": {
"depd": "1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.0",
"statuses": "1.4.0"
}
},
"iconv-lite": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz",
"integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ=="
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@ -526,11 +302,6 @@
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ipaddr.js": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz",
"integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs="
},
"is-absolute": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz",
@ -607,39 +378,6 @@
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4="
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
},
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
},
"mime": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
"integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
},
"mime-db": {
"version": "1.33.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
"integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ=="
},
"mime-types": {
"version": "2.1.18",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
"integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
"requires": {
"mime-db": "1.33.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
@ -697,29 +435,11 @@
"safe-buffer": "5.1.1"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"negotiator": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
},
"nodemailer": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-4.4.1.tgz",
"integrity": "sha512-1bnszJJXatcHJhLpxQ1XMkLDjCjPKvGKMtRQ73FOsoNln3UQjddEQmz6fAwM3aj0GtQ3dQX9qtMHPelz63GU7A=="
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"requires": {
"ee-first": "1.1.1"
}
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@ -736,11 +456,6 @@
"readable-stream": "2.3.3"
}
},
"parseurl": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
"integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M="
},
"path-dirname": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz",
@ -751,25 +466,11 @@
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"process-nextick-args": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
"integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M="
},
"proxy-addr": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz",
"integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==",
"requires": {
"forwarded": "0.1.2",
"ipaddr.js": "1.6.0"
}
},
"pump": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/pump/-/pump-2.0.0.tgz",
@ -800,50 +501,6 @@
}
}
},
"qs": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
"integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A=="
},
"range-parser": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
"integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
},
"raw-body": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz",
"integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=",
"requires": {
"bytes": "3.0.0",
"http-errors": "1.6.2",
"iconv-lite": "0.4.19",
"unpipe": "1.0.0"
},
"dependencies": {
"depd": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz",
"integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k="
},
"http-errors": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz",
"integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=",
"requires": {
"depd": "1.1.1",
"inherits": "2.0.3",
"setprototypeof": "1.0.3",
"statuses": "1.4.0"
}
},
"setprototypeof": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz",
"integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ="
}
}
},
"readable-stream": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
@ -873,42 +530,6 @@
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM="
},
"send": {
"version": "0.16.2",
"resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
"integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
"requires": {
"debug": "2.6.9",
"depd": "1.1.2",
"destroy": "1.0.4",
"encodeurl": "1.0.2",
"escape-html": "1.0.3",
"etag": "1.8.1",
"fresh": "0.5.2",
"http-errors": "1.6.3",
"mime": "1.4.1",
"ms": "2.0.0",
"on-finished": "2.3.0",
"range-parser": "1.2.0",
"statuses": "1.4.0"
}
},
"serve-static": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
"integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
"requires": {
"encodeurl": "1.0.2",
"escape-html": "1.0.3",
"parseurl": "1.3.2",
"send": "0.16.2"
}
},
"setprototypeof": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
},
"simple-node-logger": {
"version": "0.93.33",
"resolved": "https://registry.npmjs.org/simple-node-logger/-/simple-node-logger-0.93.33.tgz",
@ -926,11 +547,6 @@
"through2": "2.0.3"
}
},
"statuses": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
},
"stream-shift": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz",
@ -998,15 +614,6 @@
"is-negated-glob": "1.0.0"
}
},
"type-is": {
"version": "1.6.16",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz",
"integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==",
"requires": {
"media-typer": "0.3.0",
"mime-types": "2.1.18"
}
},
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
@ -1042,26 +649,11 @@
"through2-filter": "2.0.0"
}
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"websocket-stream": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/websocket-stream/-/websocket-stream-5.1.1.tgz",

View File

@ -19,19 +19,15 @@
},
"homepage": "https://gitlab.com/wolutator/dispatcher_ng#README",
"dependencies": {
"body-parser": "^1.18.2",
"chalk": "^2.3.0",
"command-line-args": "^4.0.7",
"cron": "^1.3.0",
"express": "^4.16.3",
"moment": "^2.20.1",
"mqtt": "^2.15.0",
"nodemailer": "^4.4.1",
"simple-node-logger": "^0.93.33"
},
"devDependencies": {
"@types/body-parser": "^1.16.8",
"@types/express": "^4.11.1",
"@types/chalk": "^2.2.0",
"@types/command-line-args": "^4.0.2",
"@types/cron": "^1.2.1",

View File

@ -12,6 +12,10 @@ export interface HasStateAndFeedbackTopic extends HasStateTopic {
getStateFeedbackTopic() : string
}
export interface HasFeedbackTopic {
getStateFeedbackTopic() : string
}
export interface HasInTopic {
getInTopic() : string
}

View File

@ -1,64 +0,0 @@
import * as http from 'http'
import * as express from 'express'
import * as logger from './log'
import * as bodyParser from 'body-parser'
import * as config from './config'
import { mqttHandler } from './MqttDispatcher'
import { EventEmitter } from 'events';
export type AttendanceSheetType = { [index: string]: boolean }
export class GeoFences extends EventEmitter {
private app: express.Express
private server: http.Server
public attendanceSheet : AttendanceSheetType
static geoFencesTopicPre : string = "dispatcher_ng/geofences"
constructor() {
super()
this.app = express()
this.app.use(bodyParser.urlencoded({ extended: false }));
this.app.use(bodyParser.json());
this.attendanceSheet = {}
}
exec() : void {
this.app.post('/', (req: express.Request , res: express.Response) => {
const reqData = req.body
const deviceId = reqData.device
let occupantName : string = 'unknown'
const location = reqData.name
if (deviceId in config.dict.occupants) {
occupantName = config.dict.occupants[deviceId]
}
const presence : boolean = reqData.entry == '1'
const direction : string = presence ? 'arrives at' : 'leaves from'
logger.info(`${deviceId} (${occupantName}) ${direction} ${location}`)
logger.info(JSON.stringify(reqData))
res.send('OK')
const state : string = presence ? 'present' : 'absent'
mqttHandler.send(`${GeoFences.geoFencesTopicPre}/${occupantName}`, state)
this.attendanceSheet[occupantName] = presence
//logger.info(`attendanceSheet is now ${JSON.stringify(this.attendanceSheet)}`)
this.emit('change', this.attendanceSheet)
})
let port = parseInt(config.dict.geofencesPort)
this.server = this.app.listen(port, '', () => {
logger.info(`geofences server listening on ${port}`)
})
}
}

16
src/HeatingScene.ts Normal file
View File

@ -0,0 +1,16 @@
import { Forwarder } from './Forwarder'
import { HasInTopic } from './AItem'
export class HeatingScene extends Forwarder {
constructor(floor: string, room: string, item: string, label: string,
targetItems: HasInTopic[]) {
let inTopics: string[] = []
targetItems.forEach((item: HasInTopic) => {
inTopics.push(item.getInTopic())
})
super(floor, room, item, "command", label, inTopics)
}
}

View File

@ -81,20 +81,23 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic {
this.temperature = parseFloat(payload)
setTemperature = true
} else if (topic == this.commandTopic) {
if (this.heatingMainFlag) {
if (payload == 'ON') {
this.temperature = this.presetTemperature
} else if (payload == 'OFF') {
this.temperature = DISABLED_TEMPERATURE
}
if ((payload == 'ON') && this.heatingMainFlag) {
this.temperature = this.presetTemperature
setTemperature = true
} else if (payload == 'OFF') {
this.temperature = DISABLED_TEMPERATURE
setTemperature = true
} else if (payload == 'FORCE_ON') {
this.temperature = this.presetTemperature
setTemperature = true
}
} else if (topic == MaxThermostat.heatingMainSwitchTopic) {
this.heatingMainFlag = (payload == 'ON')
logger.info(`${this.itemId} heating main: ${this.heatingMainFlag}`)
if (! this.heatingMainFlag) {
mqttHandler.send(this.temperatureFeedbackTopic, `${DISABLED_TEMPERATURE}`)
mqttHandler.send(this.actionTopic, `${DISABLED_TEMPERATURE}`)
this.temperature = DISABLED_TEMPERATURE
mqttHandler.send(this.temperatureFeedbackTopic, `${this.temperature}`)
mqttHandler.send(this.actionTopic, `${this.temperature}`)
}
} else if (topic == this.presetTemperatureTopic) {
this.presetTemperature = parseFloat(payload)

View File

@ -3,8 +3,9 @@ import { mqttHandler } from './MqttDispatcher'
import { AHomegearItem } from './AHomegearItem'
import { ContactExport, ExportType } from './Export'
import { Disabler } from './Disabler'
import { HasFeedbackTopic } from './AItem'
export class MaxWindowContact extends AHomegearItem implements Disabler {
export class MaxWindowContact extends AHomegearItem implements Disabler, HasFeedbackTopic {
private deviceFeedbackTopic: string
private stateFeedbackTopic: string
private stateTopic: string

90
src/TwoLedSignal.ts Normal file
View File

@ -0,0 +1,90 @@
import { AItem, HasFeedbackTopic } from './AItem'
import { mqttHandler } from './MqttDispatcher'
import * as logger from './log'
enum SignalState {
SIGNAL_RED,
SIGNAL_GREEN,
SIGNAL_UNKNOWN,
}
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,
led1Items: HasFeedbackTopic[], led1GreenToken: string, led1RedToken: string,
led2Items: HasFeedbackTopic[], led2GreenToken: string, led2RedToken: string) {
super(floor, room, item, label)
this.subscribeTopics = []
led1Items.forEach((item: HasFeedbackTopic) => {
this.led1Items.push(new SignalItem(item, led1RedToken, led1GreenToken))
this.subscribeTopics.push(item.getStateFeedbackTopic())
})
led2Items.forEach((item: HasFeedbackTopic) => {
this.led2Items.push(new SignalItem(item, led2RedToken, led2GreenToken))
this.subscribeTopics.push(item.getStateFeedbackTopic())
})
}
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);
if (this.state != this.oldState) {
if (this.state == 'ON') {
http.get(this.onUrl)
http.get(this.onUrl,)
} else {
http.get(this.offUrl)
}

View File

@ -4,7 +4,7 @@ import * as config from './config'
import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AItem } from './AItem'
import { AItem, HasInTopic, HasFeedbackTopic, HasStateAndFeedbackTopic } from './AItem'
import { HomekitExportType, ExportType } from './Export'
import { M433SwitchItem } from './M433SwitchItem'
import { HomematicFourButtonThing, HomematicFourButtonSingleItem } from './HomematicFourButtonThing'
@ -22,12 +22,15 @@ import { Cron } from './Cron'
import { HueColorBulbItem } from './HueColorBulbItem'
import { TouchSwitchMultiButtonThing, TouchSwitchButtonSingleItem } from './TouchSwitchMultiButtonThing'
import { RelayBoxThing } from './RelayBox'
import { GeoFences, AttendanceSheetType } from './GeoFences'
import { HeatingScene } from './HeatingScene'
import { TwoLedSignal } from './TwoLedSignal'
logger.info("Dispatcher starting")
let allLabeledItems : Array<AItem> = new Array()
let allThermostatItems : Array<HasInTopic> = new Array()
let allWindows : Array<HasFeedbackTopic> = new Array()
let allRelevantLights: Array<HasFeedbackTopic> = new Array()
// Anna -----------------------------------------------------------------------------------------------------
@ -51,16 +54,19 @@ aquariumLightCron.start()
let annaBedLight = new M433SwitchItem('1st', 'Anna', 'BedLight', 'Bettlicht Anna', '14668116 24 1', '14668113 24 1')
annaBedLight.start()
allLabeledItems.push(annaBedLight)
allRelevantLights.push(annaBedLight)
let windowContactAnna1st = new MaxWindowContact('1st', 'Anna', 'WindowContact', 'Fenster Anna', 20)
windowContactAnna1st.start()
allLabeledItems.push(windowContactAnna1st)
allWindows.push(windowContactAnna1st)
let thermostatAnna1st = new MaxThermostat('1st', 'Anna', 'Thermostat', 'Thermostat Anna', 21, [windowContactAnna1st])
thermostatAnna1st.start()
thermostatAnna1st.setPresetTemperature(21.0)
allLabeledItems.push(thermostatAnna1st)
allThermostatItems.push(thermostatAnna1st)
let thermostatAnna1stCron = new Cron('thermostatAnna1stCron', thermostatAnna1st, [
{cronTime: '00 05 06 * * *', output: 'ON'},
@ -79,62 +85,82 @@ thermostatAnna1stCron.start()
let matthiasStandLights = new M433SwitchItem('1st', 'Matthias', 'StandLight', 'Stehlampen Matthias', '7 24 1', '6 24 1')
matthiasStandLights.start()
allLabeledItems.push(matthiasStandLights)
allRelevantLights.push(matthiasStandLights)
// Matthias Bett 15 24 1 14 24 1
let matthiasBedLight = new M433SwitchItem('1st', 'Matthias', 'BedLight', 'Bettlicht Matthias', '15 24 1', '14 24 1')
matthiasBedLight.start()
allLabeledItems.push(matthiasBedLight)
allRelevantLights.push(matthiasBedLight)
// Matthias Lautsprecher 11 24 1 10 24 1
let matthiasSpeaker = new M433SwitchItem('1st', 'Matthias', 'Speaker', 'Lautsprecher Matthias', '11 24 1', '10 24 1', 'outlet')
matthiasSpeaker.start()
allLabeledItems.push(matthiasSpeaker)
allRelevantLights.push(matthiasSpeaker)
let windowContactMatthias = new MaxWindowContact('1st', 'Matthias', 'WindowContact', 'Fenster', 24)
windowContactMatthias.start()
allLabeledItems.push(windowContactMatthias)
allWindows.push(windowContactMatthias)
// Esszimmer ------------------------------------------------------------------------------------------------
// Esszimmer kleine Lampe 69653 24 1 69652 24 1
let diningRoomSmallLight = new M433SwitchItem('Gnd', 'DiningRoom', 'SmallLight', 'kleine Lampe Esszimmer', '69653 24 1', '69652 24 1')
diningRoomSmallLight.start()
allLabeledItems.push(diningRoomSmallLight)
allRelevantLights.push(diningRoomSmallLight)
// Esszimmer Stehlampe 86037 24 1 86036 24 1
let diningRoomStandLight = new M433SwitchItem('Gnd', 'DiningRoom', 'StandLight', 'Stehlampe Esszimmer', '86037 24 1', '86036 24 1')
diningRoomStandLight.start()
allLabeledItems.push(diningRoomStandLight)
allRelevantLights.push(diningRoomStandLight)
// Esszimmer Schranklicht 65813 24 1 65812 24 1
let diningRoomCupboardLight = new M433SwitchItem('Gnd', 'DiningRoom', 'CupboardLight', 'Schranklicht Esszimmer', '65813 24 1', '65812 24 1')
diningRoomCupboardLight.start()
allLabeledItems.push(diningRoomCupboardLight)
allRelevantLights.push(diningRoomCupboardLight)
// Esszimmer Regallicht
let diningRoomShelfLight = new UrlSwitchItem('Gnd', 'DiningRoom', 'ShelfLight', 'Regallicht Esszimmer', 'http://regallampe/dv?dv=1023', 'http://regallampe/dv?dv=0')
diningRoomShelfLight.start()
allLabeledItems.push(diningRoomShelfLight)
allRelevantLights.push(diningRoomShelfLight)
let diningRoomNaehkaestchenLight = new HueColorBulbItem('Gnd', 'DiningRoom', 'NaehkaestchenLight', 'Lampe Naehkaestchen', 15)
diningRoomNaehkaestchenLight.start()
allLabeledItems.push(diningRoomNaehkaestchenLight)
allRelevantLights.push(diningRoomNaehkaestchenLight)
// Wohnzimmer -----------------------------------------------------------------------------------------------
// 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')
livingRoomLargeLight.start()
allLabeledItems.push(livingRoomLargeLight)
allRelevantLights.push(livingRoomLargeLight)
// 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')
livingRoomSmallLight.start()
allLabeledItems.push(livingRoomSmallLight)
allRelevantLights.push(livingRoomSmallLight)
// Wohnzimmer Sterne 69909 24 1 69908 24 1
let livingRoomStars = new M433SwitchItem('Gnd', 'LivingRoom', 'Stars', 'Sterne Wohnzimmer', '69909 24 1', '69908 24 1')
livingRoomStars.start()
allLabeledItems.push(livingRoomStars)
allRelevantLights.push(livingRoomStars)
// Wohnzimmer kleine Stehlampe 81941 24 1 81940 24 1
let livingRoomStandLight = new M433SwitchItem('Gnd', 'LivingRoom', 'StandLight', 'Stehlampe Wohnzimmer', '81941 24 1', '81940 24 1')
livingRoomStandLight.start()
allLabeledItems.push(livingRoomStandLight)
allRelevantLights.push(livingRoomStandLight)
// Flur -----------------------------------------------------------------------------------------------------
@ -142,16 +168,19 @@ allLabeledItems.push(livingRoomStandLight)
let hallwayDeskLight = new M433SwitchItem('Gnd', 'Hallway', 'DeskLight', 'Schreibtischlampe Flur', '83221 24 1', '83220 24 1')
hallwayDeskLight.start()
allLabeledItems.push(hallwayDeskLight)
allRelevantLights.push(hallwayDeskLight)
// Flur Stehlampe 8704914 24 5 8793154 24 5
let hallwayStandLight = new M433SwitchItem('Gnd', 'Hallway', 'StandLight', 'Stehlampe Flur', '8704914 24 5', '8793154 24 5')
hallwayStandLight.start()
allLabeledItems.push(hallwayStandLight)
allRelevantLights.push(hallwayStandLight)
// Flur Schranklicht 66581 24 1 66580 24 1
let hallwayWardrobeLight = new M433SwitchItem('Gnd', 'Hallway', 'WardrobeLight', 'Schranklicht Flur', '66581 24 1', '66580 24 1')
hallwayWardrobeLight.start()
allLabeledItems.push(hallwayWardrobeLight)
allRelevantLights.push(hallwayWardrobeLight)
// Küche ----------------------------------------------------------------------------------------------------
@ -159,11 +188,13 @@ allLabeledItems.push(hallwayWardrobeLight)
let kitchenWindowLight = new M433SwitchItem('Gnd', 'Kitchen', 'WindowLight', 'Fensterbanklicht Küche', '66837 24 1', '66836 24 1')
kitchenWindowLight.start()
allLabeledItems.push(kitchenWindowLight)
allRelevantLights.push(kitchenWindowLight)
// 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')
kitchenCeilingLight.start()
allLabeledItems.push(kitchenCeilingLight)
allRelevantLights.push(kitchenCeilingLight)
// Schlafzimmer ---------------------------------------------------------------------------------------------
@ -171,10 +202,12 @@ allLabeledItems.push(kitchenCeilingLight)
let bedRoomWolfgangsSide = new M433SwitchItem('1st', 'BedRoom', 'WolfgangsSide', 'Wolfgangs Seite Schlafzimmer', '13976916 24 1', '13976913 24 1')
bedRoomWolfgangsSide.start()
allLabeledItems.push(bedRoomWolfgangsSide)
allRelevantLights.push(bedRoomWolfgangsSide)
let bedRoomWolfgangBedLight = new HueColorBulbItem('1st', 'BedRoom', 'WolfgangBedLight', 'Bettlicht', 16)
bedRoomWolfgangBedLight.start()
allLabeledItems.push(bedRoomWolfgangBedLight)
allRelevantLights.push(bedRoomWolfgangBedLight)
let bedRoomWolfgangBedLightDimmerAdaptor = new DimmerAdaptor('1st', 'BedRoom', 'WolfgangBedLight')
bedRoomWolfgangBedLightDimmerAdaptor.start()
@ -187,28 +220,34 @@ touchSwitchMultiButtonThing.start()
let bedRoomPattysSide = new M433SwitchItem('1st', 'BedRoom', 'PattysSide', 'Pattys Seite Schlafzimmer', '13980756 24 1', '13980753 24 1')
bedRoomPattysSide.start()
allLabeledItems.push(bedRoomPattysSide)
allRelevantLights.push(bedRoomPattysSide)
// Schlafzimmer Fensterbank 13979988 24 1 13979985 24 1
let bedRoomWindowLight = new M433SwitchItem('1st', 'BedRoom', 'WindowLight', 'Fensterbanklicht Schlafzimmer', '13979988 24 1', '13979985 24 1')
bedRoomWindowLight.start()
allLabeledItems.push(bedRoomWindowLight)
allRelevantLights.push(bedRoomWindowLight)
let windowContactBedroomStreet1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContactStreet', 'Fenster Schlafzimmer Strasse', 17)
windowContactBedroomStreet1st.start()
allLabeledItems.push(windowContactBedroomStreet1st)
allWindows.push(windowContactBedroomStreet1st)
let windowContact1BedroomGarden1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContact1Garden', 'Fenster Schlafzimmer 1 Garten', 18)
windowContact1BedroomGarden1st.start()
allLabeledItems.push(windowContact1BedroomGarden1st)
allWindows.push(windowContact1BedroomGarden1st)
let windowContact2BedroomGarden1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContact2Garden', 'Fenster Schlafzimmer 2 Garten', 22)
windowContact2BedroomGarden1st.start()
allLabeledItems.push(windowContact2BedroomGarden1st)
allWindows.push(windowContact2BedroomGarden1st)
let thermostatBedroom1st = new MaxThermostat('1st', 'Bedroom', 'Thermostat', 'Thermostat Schlafzimmer', 19, [windowContact1BedroomGarden1st, windowContact2BedroomGarden1st, windowContactBedroomStreet1st])
thermostatBedroom1st.start()
thermostatBedroom1st.setPresetTemperature(20.0)
allLabeledItems.push(thermostatBedroom1st)
allThermostatItems.push(thermostatBedroom1st)
let thermostatBedroom1stCron = new Cron('thermostatBedroom1stCron', thermostatBedroom1st, [
{cronTime: '00 01 06 * * 1-5', output: 'ON'},
@ -267,11 +306,13 @@ allLabeledItems.push(morningLightScene)
let windowContactBathroomGnd = new MaxWindowContact('Gnd', 'Bathroom', 'WindowContact', 'Fenster Bad unten', 7)
windowContactBathroomGnd.start()
allLabeledItems.push(windowContactBathroomGnd)
allWindows.push(windowContactBathroomGnd)
let thermostatBathroomGnd = new MaxThermostat('Gnd', 'Bathroom', 'Thermostat', 'Thermostat Bad unten', 4, [windowContactBathroomGnd])
thermostatBathroomGnd.start()
thermostatBathroomGnd.setPresetTemperature(20.0)
allLabeledItems.push(thermostatBathroomGnd)
allThermostatItems.push(thermostatBathroomGnd)
let thermostatBathroomGndCron = new Cron('thermostatBathroomGndCron', thermostatBathroomGnd, [
{cronTime: '00 02 06 * * 1-5', output: 'ON'},
@ -286,11 +327,13 @@ thermostatBathroomGndCron.start()
let windowContactBathroom1st = new MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2)
windowContactBathroom1st.start()
allLabeledItems.push(windowContactBathroom1st)
allWindows.push(windowContactBathroom1st)
let thermostatBathroom1st = new MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st])
thermostatBathroom1st.start()
thermostatBathroom1st.setPresetTemperature(20.0)
allLabeledItems.push(thermostatBathroom1st)
allThermostatItems.push(thermostatBathroom1st)
let thermostatBathroom1stCron = new Cron('thermostatBathroom1stCron', thermostatBathroom1st, [
{cronTime: '00 00 06 * * 1-5', output: 'ON'},
@ -306,21 +349,26 @@ thermostatBathroom1stCron.start()
let windowContactKitchen1 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact1', 'Fenster Küche Garten', 11)
windowContactKitchen1.start()
allLabeledItems.push(windowContactKitchen1)
allWindows.push(windowContactKitchen1)
let windowContactKitchen2 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact2', 'Fenster Küche Terassentür Garten', 10)
windowContactKitchen2.start()
allLabeledItems.push(windowContactKitchen2)
allWindows.push(windowContactKitchen2)
let windowContactKitchen3 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact3', 'Fenster Küche Straße 1', 12)
windowContactKitchen3.start()
allLabeledItems.push(windowContactKitchen3)
allWindows.push(windowContactKitchen3)
let windowContactKitchen4 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact4', 'Fenster Küche Straße 2', 13)
windowContactKitchen4.start()
allLabeledItems.push(windowContactKitchen4)
allWindows.push(windowContactKitchen4)
let thermostatKitchen = new MaxThermostat('Gnd', 'Kitchen', 'Thermostat', 'Thermostat Küche', 14, [
windowContactKitchen1, windowContactKitchen2, windowContactKitchen3, windowContactKitchen4])
thermostatKitchen.start()
thermostatKitchen.setPresetTemperature(20.0)
allLabeledItems.push(thermostatKitchen)
allThermostatItems.push(thermostatKitchen)
let thermostatKitchenCron = new Cron('thermostatKitchenCron', thermostatKitchen, [
{cronTime: '00 00 06 * * 1-5', output: 'ON'},
@ -345,13 +393,19 @@ let relayBox = new RelayBoxThing('base', 'labor', 'relaybox', 'IoT/Command/Relay
relayBox.start()
allLabeledItems.push(relayBox)
// ----------------------------------------------------------------------------------------------------------
let geoFences = new GeoFences()
geoFences.exec()
geoFences.on('change', (attendanceSheet: AttendanceSheetType) => {
logger.info(`geoFences change event: ${JSON.stringify(attendanceSheet)}`)
})
// ----------------------------------------------------------------------------------------------------------
let heatingSceneAll = new HeatingScene('Gnd', 'House', 'Heatings', 'Alle Heizungen', allThermostatItems)
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, [
new HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/Testlight/dimmerIn'),
@ -427,4 +481,3 @@ fs.writeFileSync(config.dict.openhabItemFile, openhabList.join('\n'))
mqttHandler.exec()
logger.info("Dispatcher running")