remove state for switch actors
This commit is contained in:
5
dist/HomematicSwitchItem.js
vendored
5
dist/HomematicSwitchItem.js
vendored
@ -31,7 +31,6 @@ class HomematicSwitchItem extends AHomegearItem_1.AHomegearItem {
|
|||||||
this.deviceFeedbackTopic
|
this.deviceFeedbackTopic
|
||||||
];
|
];
|
||||||
this.state = 'OFF';
|
this.state = 'OFF';
|
||||||
this.oldState = undefined;
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
exportItem() {
|
exportItem() {
|
||||||
@ -42,15 +41,12 @@ class HomematicSwitchItem extends AHomegearItem_1.AHomegearItem {
|
|||||||
case this.stateTopic:
|
case this.stateTopic:
|
||||||
this.state = payload;
|
this.state = payload;
|
||||||
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
||||||
if (this.state != this.oldState) {
|
|
||||||
if (this.state == 'ON') {
|
if (this.state == 'ON') {
|
||||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, 'true');
|
MqttDispatcher_1.mqttHandler.send(this.actionTopic, 'true');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, 'false');
|
MqttDispatcher_1.mqttHandler.send(this.actionTopic, 'false');
|
||||||
}
|
}
|
||||||
this.oldState = this.state;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case this.deviceFeedbackTopic:
|
case this.deviceFeedbackTopic:
|
||||||
if (payload == 'true') {
|
if (payload == 'true') {
|
||||||
@ -59,7 +55,6 @@ class HomematicSwitchItem extends AHomegearItem_1.AHomegearItem {
|
|||||||
else {
|
else {
|
||||||
this.state = 'OFF';
|
this.state = 'OFF';
|
||||||
}
|
}
|
||||||
this.oldState = this.state;
|
|
||||||
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
4
dist/M433SwitchItem.js
vendored
4
dist/M433SwitchItem.js
vendored
@ -26,7 +26,6 @@ class M433SwitchItem extends AItem_1.AItem {
|
|||||||
this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`;
|
this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`;
|
||||||
this.actionTopic = 'IoT/Mqtt433Gateway/Message';
|
this.actionTopic = 'IoT/Mqtt433Gateway/Message';
|
||||||
this.state = 'OFF';
|
this.state = 'OFF';
|
||||||
this.oldState = undefined;
|
|
||||||
this.onCode = onCode;
|
this.onCode = onCode;
|
||||||
this.offCode = offCode;
|
this.offCode = offCode;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@ -37,15 +36,12 @@ class M433SwitchItem extends AItem_1.AItem {
|
|||||||
processMessage(topic, payload) {
|
processMessage(topic, payload) {
|
||||||
this.state = payload;
|
this.state = payload;
|
||||||
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
||||||
if (this.state != this.oldState) {
|
|
||||||
if (this.state == 'ON') {
|
if (this.state == 'ON') {
|
||||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, this.onCode);
|
MqttDispatcher_1.mqttHandler.send(this.actionTopic, this.onCode);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, this.offCode);
|
MqttDispatcher_1.mqttHandler.send(this.actionTopic, this.offCode);
|
||||||
}
|
}
|
||||||
this.oldState = this.state;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.M433SwitchItem = M433SwitchItem;
|
exports.M433SwitchItem = M433SwitchItem;
|
||||||
|
@ -46,7 +46,6 @@ export class HomematicSwitchItem extends AHomegearItem implements HasStateAndFee
|
|||||||
this.deviceFeedbackTopic
|
this.deviceFeedbackTopic
|
||||||
]
|
]
|
||||||
this.state = 'OFF'
|
this.state = 'OFF'
|
||||||
this.oldState = undefined
|
|
||||||
this.type = type
|
this.type = type
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,14 +58,11 @@ export class HomematicSwitchItem extends AHomegearItem implements HasStateAndFee
|
|||||||
case this.stateTopic:
|
case this.stateTopic:
|
||||||
this.state = payload
|
this.state = payload
|
||||||
mqttHandler.send(this.stateFeedbackTopic, this.state)
|
mqttHandler.send(this.stateFeedbackTopic, this.state)
|
||||||
if (this.state != this.oldState) {
|
|
||||||
if (this.state == 'ON') {
|
if (this.state == 'ON') {
|
||||||
mqttHandler.send(this.actionTopic, 'true')
|
mqttHandler.send(this.actionTopic, 'true')
|
||||||
} else {
|
} else {
|
||||||
mqttHandler.send(this.actionTopic, 'false')
|
mqttHandler.send(this.actionTopic, 'false')
|
||||||
}
|
}
|
||||||
this.oldState = this.state
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
case this.deviceFeedbackTopic:
|
case this.deviceFeedbackTopic:
|
||||||
if (payload == 'true') {
|
if (payload == 'true') {
|
||||||
@ -74,7 +70,6 @@ export class HomematicSwitchItem extends AHomegearItem implements HasStateAndFee
|
|||||||
} else {
|
} else {
|
||||||
this.state = 'OFF'
|
this.state = 'OFF'
|
||||||
}
|
}
|
||||||
this.oldState = this.state
|
|
||||||
mqttHandler.send(this.stateFeedbackTopic, this.state)
|
mqttHandler.send(this.stateFeedbackTopic, this.state)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ export class M433SwitchItem extends AItem implements HasStateAndFeedbackTopicAnd
|
|||||||
this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`
|
this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`
|
||||||
this.actionTopic = 'IoT/Mqtt433Gateway/Message'
|
this.actionTopic = 'IoT/Mqtt433Gateway/Message'
|
||||||
this.state = 'OFF'
|
this.state = 'OFF'
|
||||||
this.oldState = undefined
|
|
||||||
this.onCode = onCode
|
this.onCode = onCode
|
||||||
this.offCode = offCode
|
this.offCode = offCode
|
||||||
this.type = type
|
this.type = type
|
||||||
@ -54,14 +53,11 @@ export class M433SwitchItem extends AItem implements HasStateAndFeedbackTopicAnd
|
|||||||
processMessage(topic: string, payload: string) {
|
processMessage(topic: string, payload: string) {
|
||||||
this.state = payload;
|
this.state = payload;
|
||||||
mqttHandler.send(this.stateFeedbackTopic, this.state);
|
mqttHandler.send(this.stateFeedbackTopic, this.state);
|
||||||
if (this.state != this.oldState) {
|
|
||||||
if (this.state == 'ON') {
|
if (this.state == 'ON') {
|
||||||
mqttHandler.send(this.actionTopic, this.onCode);
|
mqttHandler.send(this.actionTopic, this.onCode);
|
||||||
} else {
|
} else {
|
||||||
mqttHandler.send(this.actionTopic, this.offCode);
|
mqttHandler.send(this.actionTopic, this.offCode);
|
||||||
}
|
}
|
||||||
this.oldState = this.state;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user