diff --git a/dist/Export.js b/dist/Export.js index d50899a..89f4397 100644 --- a/dist/Export.js +++ b/dist/Export.js @@ -16,6 +16,14 @@ function SwitchExport(itemId, label, stateTopic, stateFeedbackTopic, type) { return { 'homekit': homekitOut, 'openhab': openhabOut }; } exports.SwitchExport = SwitchExport; +function ThermostatExport(itemId, label, temperatureTopic, temperatureFeedbackTopic) { + return { 'homekit': ThermostatHomekitExport(itemId, label, temperatureTopic, temperatureFeedbackTopic), 'openhab': '' }; +} +exports.ThermostatExport = ThermostatExport; +function ContactExport(itemId, label, status) { + return { 'homekit': ContactHomekitExport(itemId, label, status), 'openhab': '' }; +} +exports.ContactExport = ContactExport; function SwitchHomekitBulbExport(id, label, setOn, statusOn) { let o = { "id": id, @@ -53,6 +61,34 @@ function SwitchHomekitOutletExport(id, label, setOn, statusOn) { }; return { 'id': id, 'object': o }; } +function ThermostatHomekitExport(id, label, setTemperature, statusTemperature) { + let o = { + "id": id, + "name": label, + "service": "Thermostat", + "topic": { + "setTargetTemperature": setTemperature, + "statusTargetTemperature": statusTemperature, + "statusCurrentTemperature": statusTemperature + }, + "payload": {} + }; + return { 'id': id, 'object': o }; +} +function ContactHomekitExport(id, label, status) { + let o = { + "id": id, + "name": label, + "service": "ContactSensor", + "topic": { + "statusContactSensorState": status + }, + "payload": { + "conContactDetected": "CLOSED" + } + }; + return { 'id': id, 'object': o }; +} function SwitchOpenHABExport(id, label, setOn, statusOn) { // Switch windowLightKitchen {mqtt=">[localbroker:nodered/items/windowLightKitchen:command:*:default]", mqtt="<[localbroker:nodered/items/windowLightKitchen/feedback:state:default]"} return `Switch ${id} {mqtt=">[localbroker:${setOn}:command:*:default],<[localbroker:${statusOn}:state:default]"}`; diff --git a/dist/MaxThermostat.js b/dist/MaxThermostat.js index 3af8235..213ed0e 100644 --- a/dist/MaxThermostat.js +++ b/dist/MaxThermostat.js @@ -2,13 +2,16 @@ Object.defineProperty(exports, "__esModule", { value: true }); const MqttDispatcher_1 = require("./MqttDispatcher"); const AHomematicItem_1 = require("./AHomematicItem"); -// import { SwitchExport, ExportType } from './Export' +const Export_1 = require("./Export"); const WINDOW_OPEN_TEMPERATURE = 4.5; class MaxThermostat extends AHomematicItem_1.AHomematicItem { // Thermostat: homegear/instance1/set/3/1/SET_TEMPERATURE getInTopic() { return this.temperatureTopic; } + exportItem() { + return Export_1.ThermostatExport(this.itemId, this.label, this.temperatureTopic, this.temperatureFeedbackTopic); + } constructor(floor, room, item, label, hmId, windowContacts) { super(floor, room, item, label, hmId); this.temperatureTopic = `${this.topicFirstPart}/temperature`; diff --git a/dist/MaxWindowContact.js b/dist/MaxWindowContact.js index 1d0f289..ee6cd6c 100644 --- a/dist/MaxWindowContact.js +++ b/dist/MaxWindowContact.js @@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const MqttDispatcher_1 = require("./MqttDispatcher"); const AHomematicItem_1 = require("./AHomematicItem"); -// import { SwitchExport, ExportType } from './Export' +const Export_1 = require("./Export"); class MaxWindowContact extends AHomematicItem_1.AHomematicItem { getStateFeedbackTopic() { return this.stateFeedbackTopic; @@ -17,6 +17,9 @@ class MaxWindowContact extends AHomematicItem_1.AHomematicItem { this.deviceFeedbackTopic ]; } + exportItem() { + return Export_1.ContactExport(this.itemId, this.label, this.stateFeedbackTopic); + } processMessage(topic, payload) { if (payload == 'true') { this.state = 'OPEN'; diff --git a/dist/main.js b/dist/main.js index bea9207..b12d862 100644 --- a/dist/main.js +++ b/dist/main.js @@ -150,8 +150,10 @@ allLabeledItems.push(morningLightScene); // ---------------------------------------------------------------------------------------------------------- let windowContactBathroomGnd = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Bathroom', 'WindowContact', 'Fenster Bad unten', 7); windowContactBathroomGnd.start(); +allLabeledItems.push(windowContactBathroomGnd); let thermostatBathroomGnd = new MaxThermostat_1.MaxThermostat('Gnd', 'Bathroom', 'Thermostat', 'Thermostat Bad unten', 4, [windowContactBathroomGnd]); thermostatBathroomGnd.start(); +allLabeledItems.push(thermostatBathroomGnd); let thermostatBathroomGndCron = new Cron_1.Cron('thermostatBathroomGndCron', thermostatBathroomGnd, [ { cronTime: '00 00 06 * * 1-5', output: '21.0' }, { cronTime: '00 00 08 * * 6-7', output: '21.0' }, @@ -162,8 +164,10 @@ let thermostatBathroomGndCron = new Cron_1.Cron('thermostatBathroomGndCron', the thermostatBathroomGndCron.start(); let windowContactBathroom1st = new MaxWindowContact_1.MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2); windowContactBathroom1st.start(); +allLabeledItems.push(windowContactBathroom1st); let thermostatBathroom1st = new MaxThermostat_1.MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st]); thermostatBathroom1st.start(); +allLabeledItems.push(thermostatBathroom1st); let thermostatBathroom1stCron = new Cron_1.Cron('thermostatBathroom1stCron', thermostatBathroom1st, [ { cronTime: '00 00 06 * * 1-5', output: '21.0' }, { cronTime: '00 00 08 * * 6-7', output: '21.0' }, @@ -174,16 +178,21 @@ let thermostatBathroom1stCron = new Cron_1.Cron('thermostatBathroom1stCron', the thermostatBathroom1stCron.start(); let windowContactKitchen1 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact1', 'Fenster Küche Garten', 11); windowContactKitchen1.start(); +allLabeledItems.push(windowContactKitchen1); let windowContactKitchen2 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact2', 'Fenster Küche Terassentür Garten', 10); windowContactKitchen2.start(); +allLabeledItems.push(windowContactKitchen2); let windowContactKitchen3 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact3', 'Fenster Küche Straße 1', 12); windowContactKitchen3.start(); +allLabeledItems.push(windowContactKitchen3); let windowContactKitchen4 = new MaxWindowContact_1.MaxWindowContact('Gnd', 'Kitchen', 'WindowContact4', 'Fenster Küche Straße 2', 13); windowContactKitchen4.start(); +allLabeledItems.push(windowContactKitchen4); let thermostatKitchen = new MaxThermostat_1.MaxThermostat('Gnd', 'Kitchen', 'Thermostat', 'Thermostat Küche', 14, [ windowContactKitchen1, windowContactKitchen2, windowContactKitchen3, windowContactKitchen4 ]); thermostatKitchen.start(); +allLabeledItems.push(thermostatKitchen); let thermostatKitchenCron = new Cron_1.Cron('thermostatKitchenCron', thermostatKitchen, [ { cronTime: '00 00 06 * * 1-5', output: '21.0' }, { cronTime: '00 00 08 * * 6-7', output: '21.0' }, diff --git a/src/Export.ts b/src/Export.ts index 8172d0a..582b085 100644 --- a/src/Export.ts +++ b/src/Export.ts @@ -98,7 +98,7 @@ function ContactHomekitExport(id: string, label: string, status: string) : Homek "statusContactSensorState": status }, "payload": { - "onContactDetected": "CLOSED"s + "conContactDetected": "CLOSED" } }