fix MaxSwitch

This commit is contained in:
Wolfgang Hottgenroth
2018-01-12 19:39:04 +01:00
parent c474d22265
commit e88f9d225c
4 changed files with 23 additions and 23 deletions

18
dist/MaxEcoSwitch.js vendored
View File

@ -5,9 +5,9 @@ const AHomematicItem_1 = require("./AHomematicItem");
class MaxEcoSwitch extends AHomematicItem_1.AHomematicItem {
constructor(floor, room, item, label, hmId, mainScene, ecoScene) {
super(floor, room, item, label, hmId);
this.buttonTopic1 = `${this.deviceTopicPre}/1/PRESS`;
this.buttonTopic2 = `${this.deviceTopicPre}/2/PRESS`;
this.subscribeTopics = [this.buttonTopic1, this.buttonTopic2];
this.mainButtonTopic = `${this.deviceTopicPre}/1/PRESS`;
this.ecoButtonTopic = `${this.deviceTopicPre}/2/PRESS`;
this.subscribeTopics = [this.mainButtonTopic, this.ecoButtonTopic];
this.mainTopic = mainScene.getStateTopic();
this.ecoTopic = ecoScene.getStateTopic();
this.state = 'OFF';
@ -15,26 +15,26 @@ class MaxEcoSwitch extends AHomematicItem_1.AHomematicItem {
processMessage(topic, payload) {
switch (this.state) {
case 'OFF':
if (topic == this.mainTopic) {
if (topic == this.mainButtonTopic) {
this.state = 'ON';
}
else if (topic == this.ecoTopic) {
else if (topic == this.ecoButtonTopic) {
this.state = 'ECO';
}
break;
case 'ON':
if (topic == this.mainTopic) {
if (topic == this.mainButtonTopic) {
this.state = 'OFF';
}
else if (topic == this.ecoTopic) {
else if (topic == this.ecoButtonTopic) {
this.state = 'ECO';
}
break;
case 'ECO':
if (topic == this.mainTopic) {
if (topic == this.mainButtonTopic) {
this.state = 'ON';
}
else if (topic == this.ecoTopic) {
else if (topic == this.ecoButtonTopic) {
this.state = 'OFF';
}
break;