How to pass temperature value to next node

Hi ,

I am new to HA and node red .

I am trying to write a flow as below

  1. Read temperature from a sensor . This is already done as I am using Hue magic .
  2. Based on the temperature value in Fahrenheit, hue light color should change
  3. The switch from the below screenshot should send two values (<69 and >69)
    to other nodes

I am not sure how I can read the temperature in Fahrenheit from sensor node and send it to the next node

Below is a screenshot of work in progress flow

Appreciate any help . Thanks !

Given the coding in the flow is correct:

Put the mouse on the little circle on the right side of the bedroom node (the green one to the left of screen), press and hold the LMB and draw a line from there to the left circle of the switch node (the yellow one) and let go.

There should be a grey line between the two nodes now.

That being said, press the DEPLOY button and see what happens.

Or maybe - add a debug to the output of the "Bedroom" node and show us what the msg sent actually looks like.

Thanks for the response @Trying_to_learn @dceejay

I need to somehow include the Fahrenheit value in the switch
--Switch properties

--Debug info with bedroom node

You shouldn't need to.

The node spits out the temperature as a number. It is named in the message.

So what you do is move the mouse over the fahrenheit field and a bit more to the right. (debug node)
You will see some icons apear. One of them looks like >_ which copies the path to the clipboard.

Click that then open the switch node.

Paste the value where the payload word is and it will instruct the switch node to act on that part of the message.

1 Like

This did not do anything because the values are not passed correctly :frowning:

The switch should now start with 'msg.payload.fahrenheight'

Ok, you nearly have it.

(Sorry I tripped over the replies)

Where you showed the open switch node:
Where it says payload, you paste (or type) fahre...(how ever you spell it) there.

Then, as I said, the switch node will see that part of the message rather than the default payload.

(See what @dceejay just said.)

msg.payload.fahrenheight and not msg.fahrenheight?

I'll believe you, but I didn't see that as a subset of the payload.

The switch node detects if the value is above 69, or below 69.
What will happen if the value is exactly 69?

Maybe you need to change one of the operators to >= or <=.

Also the upper limit is set in the switch as a text value. It should be a number.

1 Like

I was able to get this running by adding "msg.payload.fahrenheit" in the switch

Thank you all for the response

@Paul-Reed Sure, I changed it to <= ,>= and added ==. Appreciate the advice

I am still new to this and learning things from experts like you all :slight_smile:

2 Likes

I may of misread your last post, but can you show us a screenshot of your new switch config, like you did above.

So if the temperature is 69, it seems that all 3 criteria apply...
Maybe it should be;

<69 =1
>=69 =2

Then the criteria would only have one result, not 3.

...also you are still using text as a criteria (a/z) instead of a number (0/9)

Yes you are correct. I made those corrections

Can I ask you another question ? How do I make this flow to run at specific times only

Thanks !

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