07-28-2022, 12:19 PM
I receive data from a remote IO unit which only has on publish topic. I thus get different messages for different data types which the unit publishes every 'x' seconds. For example it will publish Digital input statuses, then digital output statuses, then Analog inputs etc. An example of the Analog input message that gets published is:
{
"devId": "493C220314031120",
"msgType": "aiValueRpt",
"data": {
"AI1": "8580"
},
"timestamp": "1659010523"
}
The topic is /iot/pub
My value for JSON path that I select is data/AI1 and this gives me the correct reading. When a new message comes through without a data/AI1 path, for example the following:
{
"devId": "493C220314031120",
"msgType": "rs485ValueRpt",
"data": "0203140002004E0041000500650000000213EE000300C08051",
"timestamp": "1659010685"
}
My value display goes to 0 because I assume it tries to read the value in each message published to the topic. Is there a way for me to retain the value until a new message gets published which actually contains the data/AI1 path and ignore all other messages if it isn't present?
{
"devId": "493C220314031120",
"msgType": "aiValueRpt",
"data": {
"AI1": "8580"
},
"timestamp": "1659010523"
}
The topic is /iot/pub
My value for JSON path that I select is data/AI1 and this gives me the correct reading. When a new message comes through without a data/AI1 path, for example the following:
{
"devId": "493C220314031120",
"msgType": "rs485ValueRpt",
"data": "0203140002004E0041000500650000000213EE000300C08051",
"timestamp": "1659010685"
}
My value display goes to 0 because I assume it tries to read the value in each message published to the topic. Is there a way for me to retain the value until a new message gets published which actually contains the data/AI1 path and ignore all other messages if it isn't present?