# Only output a msg when the payload is in a different temperature range

**URL:** <https://discourse.nodered.org/t/only-output-a-msg-when-the-payload-is-in-a-different-temperature-range/43501>\
**Category:** General\
**Created:** [1 April 2021 09:49 UTC](https://discourse.nodered.org/t/only-output-a-msg-when-the-payload-is-in-a-different-temperature-range/43501 "2021-04-01T09:49:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulot88](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@paulot88](https://discourse.nodered.org/u/paulot88)\
**Post date:** [1 April 2021 09:49 UTC](https://discourse.nodered.org/t/only-output-a-msg-when-the-payload-is-in-a-different-temperature-range/43501/1 "2021-04-01T09:49:18Z")

</div>

I have a switch node with different output depending on temperature range. Like 0-5, 5-10 and 10+  
Now there is output when the temperature changes from 6 to 7 and 7 to 8. I want outputs only when there is a change in range. When the temperature changes 5 to 6, or 10 to 11. Is this possible?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 April 2021 10:10 UTC](https://discourse.nodered.org/t/only-output-a-msg-when-the-payload-is-in-a-different-temperature-range/43501/2 "2021-04-01T10:10:54Z")

</div>

If you use an RBE you can block messages unless they change.

 ![NvWY9ItxUP](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/8/585b6dc1758adb15985cfd72d1f3c50b411778a8.gif)

```auto
[{"id":"4849338.82dffcc","type":"switch","z":"ecfe2a67.7f7818","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"5","v2t":"num"},{"t":"btwn","v":"5","vt":"num","v2":"10","v2t":"num"},{"t":"gt","v":"10","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":290,"y":320,"wires":[["988aef0c.844df"],["d874ebb4.bbf288"],["27d46647.35a3ea"]]},{"id":"988aef0c.844df","type":"change","z":"ecfe2a67.7f7818","name":"set msg.range 0-5","rules":[{"t":"set","p":"range","pt":"msg","to":"0-5","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":280,"wires":[["ce4d566a.60aed8"]]},{"id":"d874ebb4.bbf288","type":"change","z":"ecfe2a67.7f7818","name":"set msg.range 5-10","rules":[{"t":"set","p":"range","pt":"msg","to":"5-10","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":320,"wires":[["ce4d566a.60aed8"]]},{"id":"27d46647.35a3ea","type":"change","z":"ecfe2a67.7f7818","name":"set msg.range 10+","rules":[{"t":"set","p":"range","pt":"msg","to":"10+","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":360,"wires":[["ce4d566a.60aed8"]]},{"id":"ce4d566a.60aed8","type":"rbe","z":"ecfe2a67.7f7818","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"range","x":700,"y":320,"wires":[["a04035fb.81b718"]]},{"id":"a04035fb.81b718","type":"debug","z":"ecfe2a67.7f7818","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":860,"y":320,"wires":[]},{"id":"b5e826f9.10e908","type":"inject","z":"ecfe2a67.7f7818","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":130,"y":240,"wires":[["4849338.82dffcc"]]},{"id":"e603a3bf.79168","type":"inject","z":"ecfe2a67.7f7818","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"4","payloadType":"num","x":130,"y":280,"wires":[["4849338.82dffcc"]]},{"id":"b1cfb9c3.fc71f8","type":"inject","z":"ecfe2a67.7f7818","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"6","payloadType":"num","x":130,"y":320,"wires":[["4849338.82dffcc"]]},{"id":"1bc41639.05b95a","type":"inject","z":"ecfe2a67.7f7818","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"8","payloadType":"num","x":130,"y":360,"wires":[["4849338.82dffcc"]]},{"id":"95e91880.2fdbe8","type":"inject","z":"ecfe2a67.7f7818","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11","payloadType":"num","x":130,"y":400,"wires":[["4849338.82dffcc"]]},{"id":"799031d4.9c0fc","type":"inject","z":"ecfe2a67.7f7818","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"15","payloadType":"num","x":130,"y":440,"wires":[["4849338.82dffcc"]]}]

```

---

<div class="post-metadata">

**Author:** ![paulot88](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@paulot88](https://discourse.nodered.org/u/paulot88)\
**Post date:** [1 April 2021 10:23 UTC](https://discourse.nodered.org/t/only-output-a-msg-when-the-payload-is-in-a-different-temperature-range/43501/3 "2021-04-01T10:23:20Z")

</div>

Perfect! Exactly what I was looking for.Thank you so much.

---

<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:** [15 April 2021 10:23 UTC](https://discourse.nodered.org/t/only-output-a-msg-when-the-payload-is-in-a-different-temperature-range/43501/4 "2021-04-15T10:23:47Z")

</div>

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