Replies: 3 comments
-
I took the liberty to format your question properly - maybe someone is more motivated to look into it when it can actually be read .. |
Beta Was this translation helpful? Give feedback.
-
On my first sight, the JS payload mapping script looks wrong. currentDischargeRate: jsonData.battery.cur - discharge - rate You cannot access fields containing dashes in JavaScript with the "dot notation". currentDischargeRate: jsonData.battery["cur-discharge-rate"] Also this is way to complicated: const jsonString = String.fromCharCode.apply(null, new Uint8Array(bytePayload)); You can simply do: const jsonString = textPayload; |
Beta Was this translation helpful? Give feedback.
-
I have some questions regarding how data is consumed from edge devices. I believe that edge devices may not be aware of the thing IDs in Ditto. How is telemetry data published to a topic with the corresponding thing ID? Is there an intermediate application that handles the twin representation information that connects with device? If so, is there such an application currently integrated with Ditto? |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I'm trying the JS payload mapping for updating my thing using mqtt connection. I have created a mqtt connection with the payload mapping function which maps my incoming message. But however I tried to publish a message to update a thing, but it was not happening. The ditto ui shows the mapped to be successful. I would like your help with this. Thank you.
payload:
mosquitto_pub -h [test.mosquitto.org](http://test.mosquitto.org/) -p 1883 -t ditto-tutorial/{thing-id} -m '{ "battery": { "temp": 35, "vol": 40, "cur": 34, "State": false, "cur-discharge-rate": DE }, "thingId": "{thing-id}" }'
thing Json:
connection Json:
The JS function being:
Beta Was this translation helpful? Give feedback.
All reactions