some changes

This commit is contained in:
Wolfgang Hottgenroth
2018-01-15 21:24:53 +01:00
parent 85cab38058
commit f362c90b91
8 changed files with 61 additions and 18 deletions

25
dist/MaxThermostat.js vendored
View File

@ -27,8 +27,14 @@ class MaxThermostat extends AHomematicItem_1.AHomematicItem {
});
}
processMessage(topic, payload) {
if ((topic == this.temperatureTopic) || (topic == this.deviceFeedbackTopic)) {
let setTemperature = false;
if (topic == this.temperatureTopic) {
this.temperature = parseFloat(payload);
setTemperature = true;
}
else if (topic == this.deviceFeedbackTopic) {
// this.temperature = parseFloat(payload)
setTemperature = false;
}
else if (topic in this.windowContactMap) {
this.windowContactMap[topic].state = payload;
@ -38,14 +44,17 @@ class MaxThermostat extends AHomematicItem_1.AHomematicItem {
this.windowOpen = true;
}
});
setTemperature = true;
}
if (!this.windowOpen) {
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${this.temperature}`);
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${this.temperature}`);
}
else {
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${WINDOW_OPEN_TEMPERATURE}`);
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${WINDOW_OPEN_TEMPERATURE}`);
if (setTemperature) {
if (!this.windowOpen) {
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${this.temperature}`);
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${this.temperature}`);
}
else {
MqttDispatcher_1.mqttHandler.send(this.temperatureFeedbackTopic, `${WINDOW_OPEN_TEMPERATURE}`);
MqttDispatcher_1.mqttHandler.send(this.actionTopic, `${WINDOW_OPEN_TEMPERATURE}`);
}
}
}
}