Watson IoT Message Structure

Hello, I am trying to send data to the Watson IoT Platform, but am having some difficulty having the data parsed correctly? I have created a very simple flow to simulate temperature and humidity as follows:

[{"id":"a4595cfa.591e2","type":"tab","label":"Watson IoT Test","disabled":false,"info":""},{"id":"1f40ab70.c3e485","type":"Number","z":"a4595cfa.591e2","name":"Temperature","minimum":"0","maximum":"100","roundTo":"2","Floor":true,"x":370,"y":680,"wires":[["79ee7e88.3894"]]},{"id":"c8bf5efc.2b9b3","type":"inject","z":"a4595cfa.591e2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":680,"wires":[["1f40ab70.c3e485"]]},{"id":"79ee7e88.3894","type":"function","z":"a4595cfa.591e2","name":"","func":"flow.set('random1',msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":800,"wires":[["b9f30228.82f67"]]},{"id":"b9f30228.82f67","type":"Number","z":"a4595cfa.591e2","name":"Humidity","minimum":"50","maximum":"100","roundTo":"2","Floor":true,"x":360,"y":920,"wires":[["cb848455.76ec98"]]},{"id":"cb848455.76ec98","type":"function","z":"a4595cfa.591e2","name":"","func":"flow.set('random2',msg.payload);\n//msg.payload={'random2':msg.payload};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":1040,"wires":[["ab0d59b5.142bb8"]]},{"id":"ab0d59b5.142bb8","type":"function","z":"a4595cfa.591e2","name":"","func":"// Create MQTT message in JSON\n/*msg = {\n    payload: JSON.stringify(\n        {\n            d:{\n                \"temp\" : flow.get('random1'),\n                \"humidity\" : flow.get('random2'),\n            }\n        }\n    )\n};\nreturn msg;*/\nmsg.payload = {d:{\"temperature\" : flow.get('random1'), \"humidity\":flow.get('random2')}};\nmsg.headers = {\"Content-type\":\"application/json\"};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":540,"y":1040,"wires":[["ac02b705.48c1a8","746e8fe4.66492"]]},{"id":"ac02b705.48c1a8","type":"wiotp out","z":"a4595cfa.591e2","authType":"d","qs":"false","qsDeviceId":"","deviceKey":"f198dc15.86929","deviceType":"","deviceId":"","event":"update","format":"json","qos":"0","name":"IBM IoT","x":760,"y":1120,"wires":[]},{"id":"746e8fe4.66492","type":"debug","z":"a4595cfa.591e2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":780,"y":980,"wires":[]},{"id":"f198dc15.86929","type":"wiotp-credentials","z":"","name":"","org":"0hjl6n","serverName":"","devType":"WL2000_IOT","devId":"AIT_001","keepalive":"60","cleansession":true,"tls":"","usetls":false}]

The data is seen by Watson with the following payload:
image
When I try to add a dashboard gauge, the event name, temperature or humidity values are not available.
If I simulate the device using the watson system, it generates the following payload:
image
The event_1 and randomNumber fields are then available when I create a gauge card?
It would appear as though my message being sent from NodeRed is not being recognised as a JSON object when it arrives at the Watson platform. All of the info I can find on the internet seems to be out of date and using an older "wiotp out" node??

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