Custom json parser for z2m DIY sensor


I’ve been makin custom DIY sensors using firmware for CC2530 zigbee modules. It has very nice UART interface, however it’s not without glitches.

I would use default json format, however it’s not possible to send a hyphenation mark, as the escape char \ is always added to the string. So, sending " results \" in the json and home assistant doesn’t seem to be able to parse it.

Also, the serial data very often is missing a single character from any position of the string. This renders json parsing even more obsolete.

I would like to send a string with CRC checksum at the end, and parse the data if there are no errors in the transmission. However my programming skills are not sufficient for this. The Arduino part for the sensor I can handle :smiley:.

Because the firmware has a limit how large string can be sent, I would prefer a parser that would check all readable words and assign the following numeral data into that parameter. This would enable reading e.g. a MODBUS device with many registers so, that not all data would have to be read and sent in every data packet.

E.g. the following payload:
“action”: “Value1 15.10 Value2 4000 CRC 8437”,
“last_seen”: “2024-02-17T14:29:11+02:00”,
“linkquality”: 90

The “action” would need to CRC checked and parsed.

Any help is most welcome!

Kind regards, Esa

Probably way too early for it but you might want post questions to the developer of “Zigbee Home”, see:

Thanks Hedda for this! I’ll look into it!

Kind regards, Esa