[solved] Function node - no repeat signal

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

[{"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":[]}]

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.

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

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