# \[solved\] Function node - no repeat signal

**URL:** <https://discourse.nodered.org/t/solved-function-node-no-repeat-signal/44522>\
**Category:** General\
**Created:** [22 April 2021 05:50 UTC](https://discourse.nodered.org/t/solved-function-node-no-repeat-signal/44522 "2021-04-22T05:50:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![steinerma](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinerma/32/37666_2.png) [@steinerma](https://discourse.nodered.org/u/steinerma)\
**Post date:** [22 April 2021 05:50 UTC](https://discourse.nodered.org/t/solved-function-node-no-repeat-signal/44522/1 "2021-04-22T05:50:52Z")

</div>

Hi,  
from "link in", I get the result of a cyclic query (every 5 seconds). This result I convert from on/off to true/false. However, the output of the "function node" should only send the value at the output when the state has gchanged.  
Example:  
off changes to on --\> output "function node" true  
on changes to off --\> output "function node" false  
off is detected again --\> output "function node" no new output of false

Can someone here give me a hint how this can be intercepted for example with the function node?

```auto
[{"id":"8d9be1bc.ac135","type":"link in","z":"1b695a49.dbe296","name":"","links":[],"x":1405,"y":200,"wires":[["7fbe3638.7779e8"]]},{"id":"7fbe3638.7779e8","type":"function","z":"1b695a49.dbe296","name":"true/false","func":"if (msg.payload == \"on\") {\n msg.payload = true;\n} else {\n msg.payload = false;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1560,"y":200,"wires":[["6239b4b3.2b374c"]]},{"id":"6239b4b3.2b374c","type":"debug","z":"1b695a49.dbe296","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1750,"y":200,"wires":[]}]

```

 ![flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/f/1f50501b3a755982db1f66cc7442030eccdd8ba4.png)

---

<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:** [22 April 2021 05:57 UTC](https://discourse.nodered.org/t/solved-function-node-no-repeat-signal/44522/2 "2021-04-22T05:57:40Z")

</div>

You can do this in a function node using context to remember the last value however it is far easier to use an RBE node after the function.

---

<div class="post-metadata">

**Author:** ![steinerma](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinerma/32/37666_2.png) [@steinerma](https://discourse.nodered.org/u/steinerma)\
**Post date:** [22 April 2021 07:52 UTC](https://discourse.nodered.org/t/solved-function-node-no-repeat-signal/44522/3 "2021-04-22T07:52:50Z")

</div>

Thanks a lot! RBE - this is exactly what I was looking for

---

<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:** [6 May 2021 07:53 UTC](https://discourse.nodered.org/t/solved-function-node-no-repeat-signal/44522/4 "2021-05-06T07:53:43Z")

</div>

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