I am (again) not seeing the bigger picture.
I am playing with switch
nodes and it doesn't seem to be behaving.
See nodes inside red boundary.
This is the code:
[{"id":"426ead5c.df267c","type":"switch","z":"a1911aa3.c45be8","name":"","property":"device","propertyType":"msg","rules":[{"t":"eq","v":"TABBYCAT","vt":"str"},{"t":"eq","v":"S5","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":550,"y":1760,"wires":[["715936e0.e7d808","1fcc1e18.2ec63a"],[],[]]},{"id":"a3d05ad9.c7cb3","type":"debug","z":"a1911aa3.c45be8","name":"Power message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":810,"y":1680,"wires":[]},{"id":"715936e0.e7d808","type":"fan","z":"a1911aa3.c45be8","name":"","x":690,"y":1730,"wires":[["a3d05ad9.c7cb3","9507ba32.ac3c38"]]},{"id":"e51e76d4.12bf08","type":"function","z":"a1911aa3.c45be8","name":"","func":"msg.device = msg.payload.device;\nmsg.payload = msg.payload.payload\n\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":1760,"wires":[["426ead5c.df267c","edba70d2.09daa","c1e957f9.54b4a"]]},{"id":"edba70d2.09daa","type":"change","z":"a1911aa3.c45be8","name":"Set device","rules":[{"t":"set","p":"device","pt":"flow","to":"device","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1640,"wires":[[]]},{"id":"9507ba32.ac3c38","type":"function","z":"a1911aa3.c45be8","name":"Set LED","func":"var device = flow.get(\"device\")\nif (device == \"TABBYCAT\")\n{\n //\n msg.led = 2;\n} else\nif (device == \"S5\")\n{\n //\n msg.led = 3;\n} else\nif (device == \"Marvin\")\n{\n //\n msg.led = 4;\n}\nreturn msg;","outputs":1,"noerr":0,"x":840,"y":1730,"wires":[["f6034dc3.774ac"]]},{"id":"1fcc1e18.2ec63a","type":"trigger","z":"a1911aa3.c45be8","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":720,"y":1810,"wires":[[]]},{"id":"c1e957f9.54b4a","type":"debug","z":"a1911aa3.c45be8","name":"LOOK AT ME","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":490,"y":1820,"wires":[]}]
The problem is:
I send messages to it and it seems to not be happy with the second one.
I send in a message (LOOK AT ME) it goes through the SWITCH
node and you see the (POWER MESSAGE).
The trigger
node is to show the message has been sent to that output.
Ok, I'll expand the message:
Now let's look at the switch
node:
So, if msg.device
== "TABBYCAT" it sends it to output 1.
Now, I send a second message:
Yet this time it doesn't send the message to output 1.
Dumb question: Why?
I know the shot was taken after the 5 second trigger
node had expired.
But you can see there are no subsequent messages like before.
I don't really like asking, but I have picked it apart as best I can resolve and I am not getting why it isn't working.