# How to pass temperature value to next node

**URL:** <https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975>\
**Category:** General\
**Created:** [16 April 2020 21:48 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975 "2020-04-16T21:48:17Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [16 April 2020 21:48 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/1 "2020-04-16T21:48:17Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/97885ecd2f1c4ea3c2714a253daecc0a5f14f814.png)

Appreciate any help . Thanks !

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [16 April 2020 22:14 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/2 "2020-04-16T22:14:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [16 April 2020 22:17 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/3 "2020-04-16T22:17:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [16 April 2020 22:39 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/4 "2020-04-16T22:39:15Z")

</div>

Thanks for the response @Trying_to_learn @dceejay

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/d/adc18c48e37a9fc5b3eca40459d9313f0871d66f.png)

--Debug info with bedroom node

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/f/4fdb536c2ab4a2016f514d6b2adc3cc8af6fe23d.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [16 April 2020 22:42 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/5 "2020-04-16T22:42:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [16 April 2020 22:43 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/6 "2020-04-16T22:43:11Z")

</div>

This did not do anything because the values are not passed correctly ☹

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/a/ba043903e6cb9608ab47f7a7e71cb5805ab64661.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [16 April 2020 22:45 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/7 "2020-04-16T22:45:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [16 April 2020 22:46 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/8 "2020-04-16T22:46:20Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [16 April 2020 22:47 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/9 "2020-04-16T22:47:46Z")

</div>

`msg.payload.fahrenheight` and not `msg.fahrenheight`?

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

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [16 April 2020 23:00 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/10 "2020-04-16T23:00:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [16 April 2020 23:06 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/11 "2020-04-16T23:06:09Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [16 April 2020 23:13 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/12 "2020-04-16T23:13:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [16 April 2020 23:15 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/13 "2020-04-16T23:15:32Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/1/71c4bd3b27ec040f74910c5cc6ad2184436e5af8.png)

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [16 April 2020 23:22 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/14 "2020-04-16T23:22:35Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Auto101](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/auto101/32/20157_2.png) [@Auto101](https://discourse.nodered.org/u/Auto101)\
**Post date:** [16 April 2020 23:28 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/15 "2020-04-16T23:28:05Z")

</div>

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 !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 April 2020 23:28 UTC](https://discourse.nodered.org/t/how-to-pass-temperature-value-to-next-node/24975/16 "2020-04-30T23:28:07Z")

</div>

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