Compare 2 attributes from same message and trigger 2 actions based on it

Hello,

Sorry for the dumb question in here but I try to set up nodered with home assistant and take care of some automation. The problem that I face is that I need to compare some temperature as it follows: if desired temperature (called temperature) is higher then actual temperature (called current_temperature) I want to trigger a switch action and if the desired temperature is equal or lower then the actual temperature I want to trigger another switch action. The problem is that I don't see how I can compare 2 attributes from the current state message. My message is this:

Thanks lots in advance for the help. Much appreciated

You have written the answer yourself, use a switch node :smiley: , in the debug tab you can copy the path to the value and use it for compering in switch node.

In properties you can declare what will be outputed on output one (<>= etc...)
Use one output for higher and one for lower.
I am on my phone and can't build up the flow but will be happy to help you if you have any problems setting it up...

Thanks for the reply. I am trying with the switch but I would need some more guidance if you would be kind. Thanks lots in advance

Try it like this , output one is for if temperature > current_temperature and output 2 is temperature <= current_temperature

[{"id":"6b8c44a4.697824","type":"switch","z":"4cb4f60b.341b2","name":"","property":"0.new_state.current_temperature","propertyType":"msg","rules":[{"t":"lt","v":"0.new_state.temperature","vt":"msg"},{"t":"gte","v":"0.new_state.temperature","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":380,"y":340,"wires":[[],[]]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.