Function If Node get not triggert | "21:30" =="21:30" | msg.mytime == msg.payload.topic1

Why get the function node not triggerd?

Here is the Flow:

[{"id":"d64b87be.5f7ca8","type":"function","z":"a7004483.d00c88","name":"am pm","func":"if (msg.mytime == msg.payload.topic1) {\n    msg.payload = \"Good morning\";\n} \nelse if (msg.mytime == msg.payload.topic2){\n    msg.payload = \"good evening\";\n}\n","outputs":1,"noerr":0,"x":578.6775894165039,"y":247.25756072998047,"wires":[["153b812b.55fa3f"]]}]

Are they in different messages?
If so a function has no memory of past messages
you need to look to join the messages together
or use a context value. Some of the examples in the cookbook might help.

1 Like