Brain stopped working! (heater failsafe)

I'm having brainblock with this:

The timeout node sends "false" when it doesn''t hear from the temperature sensor for 1minute.

I want this to override the "true" output of the thermostat node, so that the heater goes off.

How is best to make this reliable?

Thanks

why is it not working reliably...what's happening?
My best guess is, that, even a timeout occurs, the sensor will continue to (re-)generate events at some later time., thus switching the power on again?

  • I'd use a stoptimer node to block the "false" message until the thermostat node stops generating events for 1 minute..
  • i'd employ a simlpe-gate node in the "true" stream, keeping it open while thermostat messages arrive and blocking it, when the stoptimer has fired. This way, you will have to re-open the gate manually, even when thermostat messages restart again.

stoptimer: https://flows.nodered.org/node/node-red-contrib-stoptimer
simple-gate: https://flows.nodered.org/node/node-red-contrib-simple-gate

1 Like

Yes you are correct, despite my poor explanation!

I have not used the stoptimer node before, I will have a look now and report back.
Thank you

stoptimer or timeout, both way work for triggering the "false" command.
But in a failsafe situation, once the power has been cut, the heater should stay off until another, external event (i.e. switch, button) initiates a restart, regardless of incoming thermostat sensor messages.
Hence, the recommendation to use a simple-gate..

Close the gate when failsave triggers and heater goes off...and also disable a physical/virtual switch/button.
Do (re-)open the gate when both conditions are met: thermostat events are availlable and physical/virtual button is pressed.

1 Like

Thanks again, it seems a most useful node. I have got as far as setting up the gate and timer nodes, so that if the input is not received in time, the gate closes.

But strangely, when the gate closes, the stoptimer send 'true' to the output, even though it is set to send 'false'.

Update: if I set the 2nd payload to "hello" then it comes through as "hello". Something about setting it to "false" makes it come through as "true". Weird!

Here is my test flow in case you feel like checking it:

[{"id":"e3ab753c.82cc18","type":"change","z":"e6b2433b.dd359","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"setCurrent","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":1060,"wires":[["80b9917f.bc91c"]]},{"id":"dc8c5e4b.ec367","type":"comment","z":"e6b2433b.dd359","name":"Set payload/topic","info":"","x":460,"y":1020,"wires":[]},{"id":"80b9917f.bc91c","type":"ramp-thermostat","z":"e6b2433b.dd359","name":"Garage constant temp","profile":"1ac33692.52b5b9","hysteresisplus":"1","hysteresisminus":"1","x":720,"y":1060,"wires":[["803bbc56.c2e4a"],[],[]]},{"id":"4d3fb94f.1fd2c8","type":"comment","z":"e6b2433b.dd359","name":"Thermostat (outputs 'true' or 'false'","info":"","x":720,"y":1020,"wires":[]},{"id":"eb0c8c2b.11342","type":"inject","z":"e6b2433b.dd359","name":"","topic":"","payload":"15","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":1060,"wires":[["e3ab753c.82cc18","34e4204c.bca39"]]},{"id":"293b1ed3.0ea1d2","type":"debug","z":"e6b2433b.dd359","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1190,"y":1240,"wires":[]},{"id":"34e4204c.bca39","type":"stoptimer","z":"e6b2433b.dd359","duration":"10","units":"Second","payloadtype":"str","payloadval":"false","name":"","x":450,"y":1240,"wires":[["2e874afe.6e0be6"],["293b1ed3.0ea1d2"]]},{"id":"803bbc56.c2e4a","type":"gate","z":"e6b2433b.dd359","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":1010,"y":1200,"wires":[["293b1ed3.0ea1d2"]]},{"id":"2e874afe.6e0be6","type":"change","z":"e6b2433b.dd359","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":1200,"wires":[["803bbc56.c2e4a"]]},{"id":"3928ca2.df4b136","type":"comment","z":"e6b2433b.dd359","name":"Send close to gate","info":"","x":750,"y":1160,"wires":[]},{"id":"9f3bed65.37166","type":"comment","z":"e6b2433b.dd359","name":"Some output","info":"","x":1190,"y":1200,"wires":[]},{"id":"18a74836.962058","type":"comment","z":"e6b2433b.dd359","name":"2nd payload = 'false'","info":"","x":450,"y":1200,"wires":[]},{"id":"1ac33692.52b5b9","type":"profile","z":"","name":"Constant temperature 20deg","time1":"00:00","temp1":"20","time2":"23:59","temp2":"20","time3":"","temp3":"","time4":"","temp4":"","time5":"","temp5":"","time6":"","temp6":"","time7":"","temp7":"","time8":"","temp8":"","time9":"","temp9":"","time10":"","temp10":""}]

hmm...yes, looks like the second output has a bug...haven't used it in a while though.

Use the first output and pass it through a change node or your previous timeout node.
What really is important is the gate note in order to make the failsafe stick.
Remember that you will need to (re-)open it by another,event,,,maybe best to start it with default closed, then enable it securely.

Glad it was not just me! I'll try and report it to the maker.

I have a workaround, it's working very well. Thanks for the great idea!
Much appreciated :+1:

[{"id":"e3ab753c.82cc18","type":"change","z":"e6b2433b.dd359","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"setCurrent","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":840,"wires":[["80b9917f.bc91c"]]},{"id":"dc8c5e4b.ec367","type":"comment","z":"e6b2433b.dd359","name":"Set payload/topic","info":"","x":280,"y":800,"wires":[]},{"id":"80b9917f.bc91c","type":"ramp-thermostat","z":"e6b2433b.dd359","name":"Garage constant temp","profile":"1ac33692.52b5b9","hysteresisplus":"1","hysteresisminus":"1","x":540,"y":840,"wires":[["803bbc56.c2e4a"],[],[]]},{"id":"4d3fb94f.1fd2c8","type":"comment","z":"e6b2433b.dd359","name":"Thermostat (outputs 'true' or 'false'","info":"","x":540,"y":800,"wires":[]},{"id":"eb0c8c2b.11342","type":"inject","z":"e6b2433b.dd359","name":"","topic":"","payload":"15","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":90,"y":840,"wires":[["e3ab753c.82cc18","34e4204c.bca39"]]},{"id":"293b1ed3.0ea1d2","type":"debug","z":"e6b2433b.dd359","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1010,"y":1060,"wires":[]},{"id":"34e4204c.bca39","type":"stoptimer","z":"e6b2433b.dd359","duration":"5","units":"Second","payloadtype":"str","payloadval":"","name":"","x":260,"y":1040,"wires":[["2e874afe.6e0be6"],["d21a7fbf.6dc9c"]]},{"id":"803bbc56.c2e4a","type":"gate","z":"e6b2433b.dd359","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":810,"y":1000,"wires":[["293b1ed3.0ea1d2"]]},{"id":"2e874afe.6e0be6","type":"change","z":"e6b2433b.dd359","name":"Failsafe - set gate to close","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":1000,"wires":[["803bbc56.c2e4a"]]},{"id":"9f3bed65.37166","type":"comment","z":"e6b2433b.dd359","name":"Some output","info":"","x":1010,"y":1020,"wires":[]},{"id":"d21a7fbf.6dc9c","type":"change","z":"e6b2433b.dd359","name":"Set msg.payload to 'false'","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":1060,"wires":[["293b1ed3.0ea1d2"]]},{"id":"a3efeda2.1fca3","type":"change","z":"e6b2433b.dd359","name":"Press to re-open gate","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":960,"wires":[["803bbc56.c2e4a"]]},{"id":"9aac0117.853f3","type":"inject","z":"e6b2433b.dd359","name":"Virtual reset button","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":960,"wires":[["a3efeda2.1fca3"]]},{"id":"1ac33692.52b5b9","type":"profile","z":"","name":"Constant temperature 20deg","time1":"00:00","temp1":"20","time2":"23:59","temp2":"20","time3":"","temp3":"","time4":"","temp4":"","time5":"","temp5":"","time6":"","temp6":"","time7":"","temp7":"","time8":"","temp8":"","time9":"","temp9":"","time10":"","temp10":""}]

....glad you got it working.
Maybe you will need to investigate why the thermostat sensor stops sending events for more than a minute but then restarts sometime later ... otherwise you'll going to push that "press to re-open gate" button way too often :sweat_smile:

Yes, it's down to sketchy wifi in the past. But I upgraded to unifi and it's been fine for a while now.
I'm just being paranoid hopefully :laughing:

Thanks again :smiley:

per the node's description

The second output allows you to send an additional payload of a number, string or boolean. If the timer is stopped, the second output will automatically send a payload of stopped .

one thing to note about the node, it hasn't been updated in three years.

1 Like

yes, correct...I checked my deployed flows but none is using the second output of that node.
@877: a simple trigger node can do as well, see: https://cookbook.nodered.org/basic/trigger-timeout

1 Like

Thanks @hominidae that looks promising too.
I never thought to use a trigger that way. Don’t you just love node red! :blush:

@hominidae the trigger node seems to totally replace the stoptimer, there is even a reset message so you can stop it from triggering. Maybe why stoptimer is not maintained.

Here's the latest flow:

[{"id":"3dacd442.8d7dcc","type":"change","z":"e6b2433b.dd359","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"setCurrent","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":940,"wires":[["66496d8b.e22454"]]},{"id":"9e41deff.4f45f","type":"comment","z":"e6b2433b.dd359","name":"Set payload/topic","info":"This node is not required if just receiving  a number.\n\nBut if the input is from e.g. MQTT the topic will\nneed to be changed.","x":440,"y":900,"wires":[]},{"id":"66496d8b.e22454","type":"ramp-thermostat","z":"e6b2433b.dd359","name":"Garage constant temp","profile":"1ac33692.52b5b9","hysteresisplus":"1","hysteresisminus":"1","x":700,"y":940,"wires":[["3148be6f.455e92"],[],[]]},{"id":"1b408dc7.7544c2","type":"comment","z":"e6b2433b.dd359","name":"Thermostat (outputs 'true' or 'false'","info":"node-red-contrib-ramp-thermostat","x":700,"y":900,"wires":[]},{"id":"1faf48c6.2d7cc7","type":"inject","z":"e6b2433b.dd359","name":"","topic":"","payload":"15","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":210,"y":940,"wires":[["6d52b496.b5456c","3dacd442.8d7dcc"]]},{"id":"19dca63b.4ce5ea","type":"debug","z":"e6b2433b.dd359","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1150,"y":1180,"wires":[]},{"id":"3148be6f.455e92","type":"gate","z":"e6b2433b.dd359","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":950,"y":1060,"wires":[["19dca63b.4ce5ea"]]},{"id":"fc6eeda9.f9548","type":"comment","z":"e6b2433b.dd359","name":"Some output","info":"","x":1150,"y":1140,"wires":[]},{"id":"d883802b.72e7","type":"change","z":"e6b2433b.dd359","name":"Set msg.payload to 'false'","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":1180,"wires":[["19dca63b.4ce5ea"]]},{"id":"fec06bb4.5b6878","type":"change","z":"e6b2433b.dd359","name":"Set topic and check for reset","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"open","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"str","to":"open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":1060,"wires":[["3148be6f.455e92"]]},{"id":"6d52b496.b5456c","type":"trigger","z":"e6b2433b.dd359","op1":"","op2":"close","op1type":"nul","op2type":"str","duration":"5","extend":true,"units":"s","reset":"","bytopic":"all","name":"Watchdog","x":420,"y":1180,"wires":[["d883802b.72e7","fec06bb4.5b6878"]]},{"id":"9eada41a.dfb828","type":"comment","z":"e6b2433b.dd359","name":"Temperature","info":"","x":210,"y":900,"wires":[]},{"id":"eeadb63a.b71118","type":"comment","z":"e6b2433b.dd359","name":"readme","info":"Change the topic to 'control' so the gate will\nact on the payload.\n\nCheck for '1' from the reset button to reset the \ngate to open\n\nCheck for '0' from the reset button to reset the \ngate to open.\n\nBoth 1 & 0 states are checked to avoid error\nin node red debug \"illegal command\" by the gate.\n\n","x":710,"y":1020,"wires":[]},{"id":"b0d03781.ef6af8","type":"comment","z":"e6b2433b.dd359","name":"If watchdog triggered, send 'false' to output","info":"","x":780,"y":1140,"wires":[]},{"id":"d6d909.b00146f8","type":"inject","z":"e6b2433b.dd359","name":"Virtual reset button","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":1060,"wires":[["fec06bb4.5b6878"]]},{"id":"1ac33692.52b5b9","type":"profile","z":"","name":"Constant temperature 20deg","time1":"00:00","temp1":"20","time2":"23:59","temp2":"20","time3":"","temp3":"","time4":"","temp4":"","time5":"","temp5":"","time6":"","temp6":"","time7":"","temp7":"","time8":"","temp8":"","time9":"","temp9":"","time10":"","temp10":""}]

1 Like

very cool, thanks for sharing.
I am going to de-commision the old stoptimer instances asap :sunglasses:

1 Like