I'm using the node-red-contrib-basic-thermostat node to control a relay output on my raspberry pi. With this setup the node starts looking at the input temps and gives an output as soon as node-red is started on my pi. Is it possible to implement a start and stop button on the dashboard so the thermostat only starts when the start button is pressed and can be stopped anytime. I'm fairly new to node-red and would appreciate some assistance.
Hi darrenra10 and welcome to the forum.
Yes, you could do what you want, but there are problems depending on which way you do it.
To over-ride the node you will have to change the flow you have.
The first thing you should do is work out how you are going to over-ride the output of the node.
Because depending on that there are a lot of ways to get what you want done.
But a question that is sticking out for me is:
If you have the flow set up to turn things on/off depending on the temperature, and: every time you turn on the computer and run node-red it is turned on, is the temperatures you have set wrong?
If it is turning on the heater because it thinks it is too cold..... and you don't want the heater on, there seems to be an underlying problem there.
I have a flow on another machine that controls a fan that is used to cool the RasPi.
There are a few modes. it can be in Automatic or Manual mode.
But if it is in Manual mode and things get too hot, there are provisions that the fan is turned on anyway.
And if it keeps getting too hot: the machine can be shut down.
But that may be beyond your needs.
I'd maybe suggest leaving that flow as is, and writing another one which can turn the thing on/off manually.
Get that working so you have two flows working.
This may help you see problems with having them - not saying there is a magic answer with no problems.
It is just dependant on how they interact with one another.
Thanks for the reply. I'm trying to control an egg incubator and I don't want the heater turning on as soon as I boot the pi and node red, I'd like to have the start button there to start the heating when ready. Currently I don't have any modes for its operation.
So how is the incubator controlled when the computer is turned off?
There must be something else running all the time to turn it on and off as needed.
Well I'm using the pi along with node-red to control the incubator I have 2 temp sensors whose average goes to the thermostat node which turns the heater on/off. If the pi is off the incubator is off.
Oh...
Ok.
So if the thermostat is set to turn on at a low temperature and turn off when it is warm enough...
I'm confused why you are worried that when you turn on the Pi and run node-red the relay turns on. I would have thought that is/was because it (the temperature) it too low.
Anyway...
So now you need to make a second flow to do just that but with two buttons. One to turn it on and one to turn it off.
Don't connect it to the actual GPIO node yet. Just stick a debug
node there to make sure it is working.
The rest will come after you have done that.
But you still need to consider HOW the over-ride is going to happen.
Will it be possible to turn the relay on if it really gets too cold, and likewise turn it off if things get too hot.
The thing is I have no idea how to build this flow. I tried using the interrupt flow node but when I interrupt the flow the thermostat keeps its last recorded temp and remains in whatever state it was in.
How did you get the first flow with the thermostat working?
Leave the existing flow as is.
Don't touch it.
You need to make a new flow. It may be an idea to make it on a new tab to help with the demarcation between then. Though a bit extreme it may help.
You will need (to start with) two inject
nodes - to get the idea across - and a debug
node.
Oh, but before you can do all this it may be a good idea to put a debug
node in parallel with the GPIO
node to determine what message is being sent to turn the relay on/off.
Ok...
Stick a debug
node out of the invert
node and find out what is coming out of there to signal the heater to be on
and off
.
We'll work from there.
It may take some time to get both signals.
Ok, so now all you need to do (FOR TESTING PURPOSES ONLY) is get TWO inject
nodes.
One of them set to send true
(select from the drop down in the node's edit window)
and one to send false
.
Connect them to the Heater
node - remove the wire from the invert
node when doing this.
Press one, see if the relay turns on.
Press the other one and see it turn off.
When you have that working we can move to the next step.
(All of that given you DEPLOY
once all it is done before pressing the inject
nodes to test.`)
When I inject false the relay turns on when true the relay goes off
Yup. That should work - but also given that the connection from the other inverter
node is not there.
One should turn the relay on
and the other should turn it off
.
Okay I don't think I understand your approach. What I need is to keep the flow but implement something that would only allow the thermostat and heater to function after I push a start button.
So you want an over-riding "GO/NO GO" for things....
And this will determine if the existing flow turns the relay on or off as needed.
Yes that's exactly it, sorry for my poor explanations.
That's ok.
Here are two ways of doing it.
I hope you know how to import stuff.
There is a foreign node here.
node-red-contrib-simple-gate
See if you can understand what they are doing.
One is an easy way to see how things are working.
The other (second) needs a bit more understanding of how Node-red works.
Not rocket science, but also not intuitive if you are new.
[{"id":"b444a0fc38e450fe","type":"inject","z":"7e987ddf260bdf0d","name":"Stop","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"stop","payloadType":"str","x":260,"y":3450,"wires":[["46e0098845a5e7ec"]]},{"id":"4f64ae6f5335f34a","type":"inject","z":"7e987ddf260bdf0d","name":"Go","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","payload":"go","payloadType":"str","x":260,"y":3490,"wires":[["46e0098845a5e7ec"]]},{"id":"eda8ff856eaa0a27","type":"debug","z":"7e987ddf260bdf0d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":3550,"wires":[]},{"id":"2c1ace6b519af552","type":"inject","z":"7e987ddf260bdf0d","name":"existing stuff","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":270,"y":3550,"wires":[["46e0098845a5e7ec"]]},{"id":"46e0098845a5e7ec","type":"gate","z":"7e987ddf260bdf0d","name":"","controlTopic":"control","defaultState":"open","openCmd":"go","closeCmd":"stop","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":420,"y":3550,"wires":[["eda8ff856eaa0a27"]]},{"id":"4cd39153ce4d99c7","type":"inject","z":"7e987ddf260bdf0d","name":"Stop","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"stop","payloadType":"str","x":250,"y":3600,"wires":[["7a30fcaa82d1f41e"]]},{"id":"757a190398377eaa","type":"inject","z":"7e987ddf260bdf0d","name":"Go","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"go","payloadType":"str","x":250,"y":3640,"wires":[["7a30fcaa82d1f41e"]]},{"id":"d24650868b66acef","type":"debug","z":"7e987ddf260bdf0d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":3700,"wires":[]},{"id":"d0c59526418f856f","type":"inject","z":"7e987ddf260bdf0d","name":"existing stuff","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":260,"y":3700,"wires":[["e055f65538399ecb"]]},{"id":"7a30fcaa82d1f41e","type":"change","z":"7e987ddf260bdf0d","name":"Set context","rules":[{"t":"set","p":"state","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":3620,"wires":[[]]},{"id":"e055f65538399ecb","type":"switch","z":"7e987ddf260bdf0d","name":"","property":"state","propertyType":"flow","rules":[{"t":"eq","v":"go","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":410,"y":3700,"wires":[["d24650868b66acef"]]}]
The existing stuff
is the invert
node and the debug
is the GPIO
node.
And ok, this isn't at the GUI stage. We are nearly there.
One more step.
I'll work on these and get back to you.