I am trying to use the change node.
I usually/normally use a function node and do it that way, but I am trying to get used to using the change node.
This packet is coming in:
{"topic":"STATUS/ADSL_Link_Status","payload":{"Who":"TelePi","Modem":"Online","Uplink":"Online"},"qos":2,"retain":false,"_msgid":"7cc00bf.510a0f4"}
And this is going out:
{"topic":"TelePi","payload":{"Who":"TelePi","Modem":"Online","Uplink":"Online"},"qos":2,"retain":false,"_msgid":"7cc00bf.510a0f4","Modem":"Online","Uplink":"Online"}
And this is the node code:
[{"id":"4e10a2f6.ff28bc","type":"change","z":"15af81c5.64999e","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.Who","tot":"msg"},{"t":"set","p":"Modem","pt":"msg","to":"payload.Modem","tot":"msg"},{"t":"set","p":"Uplink","pt":"msg","to":"payload.Uplink","tot":"msg"},{"t":"set","p":"who","pt":"msg","to":"payload.who","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":4340,"wires":[["58a93b83.c6602c","21fb196.22199e6","983bb5dc.ae1ea8","6f170c9f.0a9d34"]]}]
Now, I can see that the msg.topic has been set.
And that msg.payload.Modem has become msg.Modem, and msg.payload.Uplink has become msg.Uplink
I am saying that I created those two: msg.Uplink and msg.Modem.
So why hasn't msg.who being created too?
(And as if that was all my problems.)
I then try to process this message through more switch nodes.
This is the flow part:
[{"id":"f4be63e.a8ced2","type":"json","z":"15af81c5.64999e","name":"","property":"payload","action":"","pretty":false,"x":540,"y":4340,"wires":[["fe3c0baf.e90bf8","4e10a2f6.ff28bc"]]},{"id":"4e10a2f6.ff28bc","type":"change","z":"15af81c5.64999e","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.Who","tot":"msg"},{"t":"set","p":"Modem","pt":"msg","to":"payload.Modem","tot":"msg"},{"t":"set","p":"Uplink","pt":"msg","to":"payload.Uplink","tot":"msg"},{"t":"set","p":"who","pt":"msg","to":"payload.who","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":4340,"wires":[["58a93b83.c6602c","21fb196.22199e6","983bb5dc.ae1ea8","6f170c9f.0a9d34"]]},{"id":"6f170c9f.0a9d34","type":"switch","z":"15af81c5.64999e","name":"Modem","property":"payload.Modem","propertyType":"msg","rules":[{"t":"cont","v":"Online","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":920,"y":4430,"wires":[["6a39103f.86a898"],["dddff52e.7420a"]]},{"id":"6a39103f.86a898","type":"debug","z":"15af81c5.64999e","name":"msg5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1050,"y":4420,"wires":[]},{"id":"dddff52e.7420a","type":"debug","z":"15af81c5.64999e","name":"msg6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1050,"y":4460,"wires":[]}]
I have tired editing the switch node to be either msg.Modem or msg.payload.Modem.
Neither seem to get through.
You will see that in that switch I test if the value is (or contains) "Online" and otherwise it goes to output 2.
Nothing comes out of either output of the switch.
I've been over it and over it and over it.
I don't get why the new "name" (msg.who) isn't being created when the other two are, and why the switch node isn't spitting the message out of output 2 - though I would have thought that as it says "Online" it would come out of #1.


