From a8761a68b62fb87b0c22c5d124ec3ce6de60dd34 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 17 Apr 2018 13:58:50 +0200 Subject: [PATCH] heating scenes added --- dist/HeatingScene.js | 14 ++++++++++++++ dist/MaxThermostat.js | 4 ++++ dist/main.js | 10 ++++++++++ src/HeatingScene.ts | 16 ++++++++++++++++ src/MaxThermostat.ts | 3 +++ src/main.ts | 14 ++++++++++++-- 6 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 dist/HeatingScene.js create mode 100644 src/HeatingScene.ts diff --git a/dist/HeatingScene.js b/dist/HeatingScene.js new file mode 100644 index 0000000..05dab7c --- /dev/null +++ b/dist/HeatingScene.js @@ -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 \ No newline at end of file diff --git a/dist/MaxThermostat.js b/dist/MaxThermostat.js index a5dbf63..d2610d4 100644 --- a/dist/MaxThermostat.js +++ b/dist/MaxThermostat.js @@ -62,6 +62,10 @@ class MaxThermostat extends AHomegearItem_1.AHomegearItem { 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'); diff --git a/dist/main.js b/dist/main.js index dab6c21..987b1f9 100644 --- a/dist/main.js +++ b/dist/main.js @@ -20,8 +20,10 @@ const Cron_1 = require("./Cron"); const HueColorBulbItem_1 = require("./HueColorBulbItem"); const TouchSwitchMultiButtonThing_1 = require("./TouchSwitchMultiButtonThing"); const RelayBox_1 = require("./RelayBox"); +const HeatingScene_1 = require("./HeatingScene"); logger.info("Dispatcher starting"); let allLabeledItems = new Array(); +let allThermostatItems = 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'); @@ -46,6 +48,7 @@ let thermostatAnna1st = new MaxThermostat_1.MaxThermostat('1st', 'Anna', 'Thermo 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' }, @@ -165,6 +168,7 @@ let thermostatBedroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bedroom', ' 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' }, @@ -211,6 +215,7 @@ let thermostatBathroomGnd = new MaxThermostat_1.MaxThermostat('Gnd', 'Bathroom', 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' }, @@ -226,6 +231,7 @@ let thermostatBathroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bathroom', 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' }, @@ -252,6 +258,7 @@ let thermostatKitchen = new MaxThermostat_1.MaxThermostat('Gnd', 'Kitchen', 'The 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' }, @@ -271,6 +278,9 @@ let relayBox = new RelayBox_1.RelayBoxThing('base', 'labor', 'relaybox', 'IoT/Co relayBox.start(); allLabeledItems.push(relayBox); // ---------------------------------------------------------------------------------------------------------- +let heatingSceneAll = new HeatingScene_1.HeatingScene('Gnd', 'House', 'Heatings', 'Alle Heizungen', allThermostatItems); +heatingSceneAll.start(); +// ---------------------------------------------------------------------------------------------------------- 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/DeskLight/timerIn'), diff --git a/src/HeatingScene.ts b/src/HeatingScene.ts new file mode 100644 index 0000000..637785d --- /dev/null +++ b/src/HeatingScene.ts @@ -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) + } + +} diff --git a/src/MaxThermostat.ts b/src/MaxThermostat.ts index 96ae426..8dc01fe 100644 --- a/src/MaxThermostat.ts +++ b/src/MaxThermostat.ts @@ -87,6 +87,9 @@ export class MaxThermostat extends AHomegearItem implements HasInTopic { } 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') diff --git a/src/main.ts b/src/main.ts index 70f77b9..2d5fe7a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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 } from './AItem' import { HomekitExportType, ExportType } from './Export' import { M433SwitchItem } from './M433SwitchItem' import { HomematicFourButtonThing, HomematicFourButtonSingleItem } from './HomematicFourButtonThing' @@ -22,12 +22,13 @@ import { Cron } from './Cron' import { HueColorBulbItem } from './HueColorBulbItem' import { TouchSwitchMultiButtonThing, TouchSwitchButtonSingleItem } from './TouchSwitchMultiButtonThing' import { RelayBoxThing } from './RelayBox' +import { HeatingScene } from './HeatingScene' logger.info("Dispatcher starting") let allLabeledItems : Array = new Array() - +let allThermostatItems : Array = new Array() // Anna ----------------------------------------------------------------------------------------------------- // Anna Aquarium 14665044 24 1 14665041 24 1 @@ -60,6 +61,8 @@ let thermostatAnna1st = new MaxThermostat('1st', 'Anna', 'Thermostat', 'Thermost thermostatAnna1st.start() thermostatAnna1st.setPresetTemperature(21.0) allLabeledItems.push(thermostatAnna1st) +allThermostatItems.push(thermostatAnna1st) + let thermostatAnna1stCron = new Cron('thermostatAnna1stCron', thermostatAnna1st, [ {cronTime: '00 05 06 * * *', output: 'ON'}, @@ -212,6 +215,7 @@ let thermostatBedroom1st = new MaxThermostat('1st', 'Bedroom', 'Thermostat', 'Th 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'}, @@ -275,6 +279,7 @@ let thermostatBathroomGnd = new MaxThermostat('Gnd', 'Bathroom', 'Thermostat', ' 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'}, @@ -294,6 +299,7 @@ let thermostatBathroom1st = new MaxThermostat('1st', 'Bathroom', 'Thermostat', ' 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'}, @@ -324,6 +330,7 @@ let thermostatKitchen = new MaxThermostat('Gnd', 'Kitchen', 'Thermostat', 'Therm 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'}, @@ -349,6 +356,9 @@ relayBox.start() allLabeledItems.push(relayBox) +// ---------------------------------------------------------------------------------------------------------- +let heatingSceneAll = new HeatingScene('Gnd', 'House', 'Heatings', 'Alle Heizungen', allThermostatItems) +heatingSceneAll.start() // ---------------------------------------------------------------------------------------------------------- let testFourButton = new HomematicFourButtonThing('Gnd', 'Hallway', 'TestButton', 9, [