FUXA icon indicating copy to clipboard operation
FUXA copied to clipboard

Add JSONPATH exstraction from MQTT topic to define tags

Open wonka929 opened this issue 1 year ago • 4 comments

Describe the feature Most of the data loggers that send data to MQTT do that with a structured message. Example: { "node": "modbus", "group": "CNC", "timestamp": 1702552760680, "values": {"A": 1, "B": 5, "C": 0, "D": 0, "E": 0}, "errors": {}, "metas": {} }

I think it could be very useful to introduce the possibility to enter inside the "values" sub-json to be able to parse A, B, C etc as Tags-values.

Describe the solution you'd like This can be easily done introducing the JSONPATH (https://www.npmjs.com/package/jsonpath) utility in the MQTT parsing page. We could like introduce a jsonpath box in which one can write the query (like, "$.values") to be able to exstract tags from the topic.

wonka929 avatar Dec 14 '23 11:12 wonka929

I also looked at this expecting BCV/Service_Water[values] to return the sub JSON. Luckily i am in control of my publisher and was able to change to a single level JSON

robbudge avatar Dec 14 '23 17:12 robbudge

Yep, but if you'r for example taking over a job done by others just for the interface or HMI you need to have a little of room for manoeuvre in what you'r reading.

wonka929 avatar Dec 14 '23 18:12 wonka929

I have played around many a time with mqtt, and message formatting has always caused a headache.

robbudge avatar Dec 14 '23 18:12 robbudge

Just shove it through something like node red and make your edits there.

lewsut avatar Dec 14 '23 22:12 lewsut