Hi John,
thank you for your reply. here is the data format example which was sent from our gateway:
Topic: /edge/mqttsn001/20249ED38CBF48B385B776906A52D55C/rtgQoS: 0 {"devs":[{"d":[{"dq":192,"m":"FanC","ts":1706596835,"v":1},{"dq":192,"m":"SN","ts":1706596835,"v":0},{"dq":192,"m":"FanMA","ts":1706596835,"v":0},{"dq":192,"m":"FanAml","ts":1706596835,"v":0},{"dq":192,"m":"FanS","ts":1706596835,"v":0},{"dq":192,"m":"T","ts":1706596835,"v":0.000},{"dq":192,"m":"H","ts":1706596835,"v":0.000},{"dq":192,"m":"Valve","ts":1706596835,"v":-198656.000},{"dq":192,"m":"TSP","ts":1706596835,"v":0.000}],"dev":"Device"}],"pKey":"mqttsn001","sn":"20249ED38CBF48B385B776906A52D55C","ts":1706596835,"ver":"2.0.0"}
and we had edited a function from an example in finstack's website, which could only parse one point's data in Desigo Optic, below is the code for function: (msg,params: null) => do
jsonData: ioReadJson(msg)
jds:jsonData->devs.get(0)
ename:jds->dev
jd:jds->d
tags:{}
tags = tags.set("curVal",jd.get(0)->v)
tags = tags.set("curStatus","ok")
end
as we try to pass an parameter to the function, but the function did not work, here is the rewrited function code: (msg,params: null,x) => do
jsonData: ioReadJson(msg)
jds:jsonData->devs.get(0)
ename:jds->dev
jd:jds->d
tags:{}
tags = tags.set("curVal",jd.get(x)->v)
tags = tags.set("curStatus","ok")
end
any fault in this function?
Regards, William