Skip to content

Commit

Permalink
Merge pull request #87 from Chrischi-/master
Browse files Browse the repository at this point in the history
Keep node state updates consistent.
  • Loading branch information
Caprico85 committed Jan 7, 2021
2 parents 41f63e9 + 4146e6d commit 2849a35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions devices/outlet.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ module.exports = function(RED) {
RED.log.debug("OutletNode(updated): states = " + JSON.stringify(states));

this.updateStatusIcon(states);

this.states.on = device.states.on;
this.states.online = device.states.online;

let msg = {
topic: this.topicOut,
Expand Down
5 changes: 4 additions & 1 deletion devices/thermostat.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ module.exports = function(RED) {
this.states = this.clientConn.register(this, 'thermostat', config.name);

this.status({fill: "yellow", shape: "dot", text: "Ready"});

this.on('input', this.onInput);
this.on('close', this.onClose);
}

registerDevice(client, name) {
Expand Down Expand Up @@ -91,7 +94,7 @@ module.exports = function(RED) {
}

updateStatusIcon(states) {
this.status({fill: "green", shape: "dot", text: states.thermostatTemperatureSetpoint + " °C"});
this.status({fill: "green", shape: "dot", text: "T: " + states.thermostatTemperatureAmbient + " °C | S: " + states.thermostatTemperatureSetpoint + " °C"});
}

/******************************************************************************************************************
Expand Down

0 comments on commit 2849a35

Please sign in to comment.