Created question in FIWARE Q/A platform on 10-08-2022 at 12:08
Please, ANSWER this question AT https://stackoverflow.com/questions/73306361/fiware-iotagent-json-over-mqtt
Question:
FIWARE: IotAgent-json over MQTT
Description:
I'm working on connecting sensors to a FIWARE system.
The sensor can report the monitoring data with MQTT in json payload.
With a public mqtt broker(hivemq), I can get the monitoring data payload as below:
{
"src":"shellyplus1pm-7c87ce64d540",
"dst":"shellyplus1pm-7c87ce64d540/events",
"method":"NotifyStatus",
"params":{
"ts":1659606613.35,
"switch:0":{
"id":0,
"apower":38.04
}
}
}.
my questions are:
(1) the sensor can only publish data on topic DeviceId/events/rpc, but if I use FIWARE IotAgent-json, the IotAgent-json expects subscribing data on topic /json/api-key/device-id/attrs (according https://github.com/yanpengwuIoT/tutorials.IoT-over-MQTT), how can I let the IotAgent-json subscribe data on topic DeviceId/events/rpc, which is sensor firmware defined and can't be changed.
(2) the sensor publishs monitoring payload as a nested multi-level json object as showed above, but the IotAgent-json can only support a single level json object (like '
{"h": 70, "t": 15}
' as described in https://github.com/telefonicaid/iotagent-json/blob/master/docs/usermanual.md), how can I parse the multi-level json object in IotAgent-json?
Any comment, sample or documentation for this are very appreciated! Thank you very much.