remove state for switch actors
This commit is contained in:
14
dist/M433SwitchItem.js
vendored
14
dist/M433SwitchItem.js
vendored
@ -26,7 +26,6 @@ class M433SwitchItem extends AItem_1.AItem {
|
||||
this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`;
|
||||
this.actionTopic = 'IoT/Mqtt433Gateway/Message';
|
||||
this.state = 'OFF';
|
||||
this.oldState = undefined;
|
||||
this.onCode = onCode;
|
||||
this.offCode = offCode;
|
||||
this.type = type;
|
||||
@ -37,14 +36,11 @@ class M433SwitchItem extends AItem_1.AItem {
|
||||
processMessage(topic, payload) {
|
||||
this.state = payload;
|
||||
MqttDispatcher_1.mqttHandler.send(this.stateFeedbackTopic, this.state);
|
||||
if (this.state != this.oldState) {
|
||||
if (this.state == 'ON') {
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, this.onCode);
|
||||
}
|
||||
else {
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, this.offCode);
|
||||
}
|
||||
this.oldState = this.state;
|
||||
if (this.state == 'ON') {
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, this.onCode);
|
||||
}
|
||||
else {
|
||||
MqttDispatcher_1.mqttHandler.send(this.actionTopic, this.offCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user