# Switch nodes problem - change nodes when certain value and reset

**URL:** <https://discourse.nodered.org/t/switch-nodes-problem-change-nodes-when-certain-value-and-reset/84367>\
**Category:** General\
**Created:** [7 January 2024 19:36 UTC](https://discourse.nodered.org/t/switch-nodes-problem-change-nodes-when-certain-value-and-reset/84367 "2024-01-07T19:36:05Z")\
**Posts on this page:** 6\
**Page:** 3

<div class="post-metadata">

**Author:** ![btbr](https://avatars.discourse-cdn.com/v4/letter/b/e19adc/32.png) [@btbr](https://discourse.nodered.org/u/btbr)\
**Post date:** [8 January 2024 00:27 UTC](https://discourse.nodered.org/t/switch-nodes-problem-change-nodes-when-certain-value-and-reset/84367/43 "2024-01-08T00:27:03Z")

</div>

I am trying to flatten this curve.

The chiller comes on at say 65. Takes until nearly 75 to bring it down. Want to stop it chilling when it gets back to 70 and turn heater back on so it flattens the line.

It's got to come on as early as possible as it takes a minute to start working.

I can DM you and explain exactly what it is doing. Just was trying to make it a simple as possible as it gets quite a bit more complex but didn't think that was relevant and would only serve to confuse more.

 ![Screenshot 2024-01-08 at 00.17.36](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/c/bc4af8cbe829288a7fd7a3f80dc108da4f2cc5c0.jpeg)

---

<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:** [8 January 2024 00:40 UTC](https://discourse.nodered.org/t/switch-nodes-problem-change-nodes-when-certain-value-and-reset/84367/44 "2024-01-08T00:40:23Z")

</div>

All you need to do is adjust the values and use the flow that @zenofmud posted.

He has done what I was wanting to do and did it in a nice way.  
(As you can see my replies to the post)

The adjusting of the values is easy.

It is just I was trying to go about it a bit slower and introduce you to the idea.

The only _adjustment_ I'd make to the flow @zenofmud posted would be to use `flow` context to set the temperatures.

Again though I would suggest putting a `change` node in just before the first `switch` node and change it from `msg.payload.test` to `msg.payload.temperature`...... and subsequently in all other nodes too.

And if you want to, also change the `msg.payload.raspberry` to something more descriptive like `mode`.  
But that's up to you.

I know from painful experience that not calling things a descriptive name can cause havoc in the future.

---

<div class="post-metadata">

**Author:** ![btbr](https://avatars.discourse-cdn.com/v4/letter/b/e19adc/32.png) [@btbr](https://discourse.nodered.org/u/btbr)\
**Post date:** [8 January 2024 00:40 UTC](https://discourse.nodered.org/t/switch-nodes-problem-change-nodes-when-certain-value-and-reset/84367/45 "2024-01-08T00:40:57Z")

</div>

Thank you very much for all your help. I'll check your flow again tomorrow. It doesn't look like it works, but might have missed something.

---

<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:** [8 January 2024 00:41 UTC](https://discourse.nodered.org/t/switch-nodes-problem-change-nodes-when-certain-value-and-reset/84367/46 "2024-01-08T00:41:40Z")

</div>

As I just said, use the one @zenofmud posted.  
It is head and shoulders better than mine.

---

<div class="post-metadata">

**Author:** ![btbr](https://avatars.discourse-cdn.com/v4/letter/b/e19adc/32.png) [@btbr](https://discourse.nodered.org/u/btbr)\
**Post date:** [8 January 2024 01:09 UTC](https://discourse.nodered.org/t/switch-nodes-problem-change-nodes-when-certain-value-and-reset/84367/47 "2024-01-08T01:09:35Z")

</div>

Thank you very much for your help. I'll check the flow tomorrow.

---

<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:** [8 March 2024 01:10 UTC](https://discourse.nodered.org/t/switch-nodes-problem-change-nodes-when-certain-value-and-reset/84367/48 "2024-03-08T01:10:16Z")

</div>

Closed on 8 March 2024 01:10 UTC

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

[Previous page](https://discourse.nodered.org/t/switch-nodes-problem-change-nodes-when-certain-value-and-reset/84367.md?page=2)
