This is the flow (cut down)
[{"id":"54dcbdbf.2fe7a4","type":"inject","z":"c56bddee.ca0a18","name":"test","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":520,"y":1810,"wires":[["37f3cedd.fe71da"]]},{"id":"37f3cedd.fe71da","type":"function","z":"c56bddee.ca0a18","name":"Name of database & Time Stamp","func":"var time = new Date().toLocaleString();\nvar status;\nif (msg.payload === true)\n{\n //\n status = \"Online\";\n} else\n{\n //\n status = \"Offline\";\n}\nmsg.payload = \"Test message \" + time + ' - ' + status;\nmsg.payload.wap = \"Test message2\";\nmsg.wap = \"Test message1\";\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":1810,"wires":[["de1c59ea.b5bcb8"]]},{"id":"de1c59ea.b5bcb8","type":"function","z":"c56bddee.ca0a18","name":"","func":"//msg.payload = msg.payload + \" CHANGED \" + msg.wap;\nmsg.payload = msg.payload + \" CHANGED \";\nnode.warn(msg.wap);\nnode.warn(msg.payload.wap);\n\n//msg = {payload: msg.payload + \" CHANGED \" + msg.wap,wap: msg.wap};\n\nreturn msg;","outputs":1,"noerr":0,"x":960,"y":1810,"wires":[["c1abb565.b2e5f"]]},{"id":"d534bd32.c384","type":"mqtt out","z":"c56bddee.ca0a18","name":"Wap change","topic":"STATUS/WAP_CHANGE","qos":"0","retain":"","broker":"1ecd3a9e.dc5bfd","x":1350,"y":1810,"wires":[]},{"id":"219bc168.f4e5e6","type":"debug","z":"c56bddee.ca0a18","name":"Sent out MQTT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1360,"y":1770,"wires":[]},{"id":"30a47e80.24cbc2","type":"mqtt in","z":"c56bddee.ca0a18","name":"Wap Change","topic":"STATUS/WAP_CHANGE","qos":"2","datatype":"auto","broker":"f4182f7.9ec475","x":720,"y":1890,"wires":[["53f94133.9997b"]]},{"id":"53f94133.9997b","type":"debug","z":"c56bddee.ca0a18","name":"MQTT received","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":920,"y":1890,"wires":[]},{"id":"c1abb565.b2e5f","type":"function","z":"c56bddee.ca0a18","name":"DUMMY","func":"\nreturn msg;","outputs":1,"noerr":0,"x":1190,"y":1810,"wires":[["d534bd32.c384","219bc168.f4e5e6"]]},{"id":"1ecd3a9e.dc5bfd","type":"mqtt-broker","z":"","name":"MQTT host","broker":"192.168.0.99","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"SOM","birthQos":"0","birthPayload":"TelePi comms up","closeTopic":"EOM","closePayload":"TelePi shutting down","willTopic":"EOM","willQos":"0","willPayload":"TelePi Comms Failure"},{"id":"f4182f7.9ec475","type":"mqtt-broker","z":"","name":"MQTT host","broker":"192.168.0.99","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"2","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
something happens, and I create a message.
It is time stamped and sent off.
I made the payload "Test message" for the sake of making it obvious it was a test.
I then want to get the "device name" sent in the message as an easily get-able thing.
So I included a msg.wap
to contain the device. Ok, in this case it is also "test message".
But for the sake of double checking I made msg.wap
"test message1".
This is what is sent:
{"_msgid":"1d1faca7.2b4453","topic":"","payload":"Test message 2019-6-8 12:13:28 - Offline CHANGED ","wap":"Test message1"}
This is what is received:
{"topic":"STATUS/WAP_CHANGE","payload":"Test message 2019-6-8 12:13:28 - Offline CHANGED ","qos":0,"retain":false,"_msgid":"5feeb89e.2108b8"}
The msg.wap
has been lost.
Adding a json
node before the MQTT doesn't help. I don't get any thing being sent to the MQTT node, so it is a loss.
I am missing something but am just not getting it.
Sorry for the (again) dumb question. I just hope that one day all the pieces will fall into place and I will get it then.