Zigbee2MQTT - invalid JSON path (value not included in every message)?

Hi all,
is there a way to “ignore” errors that happen due to a THING on a zigbee2mqtt device that has a JSON value for the battery (.battery). The problem is that not every message includes the JSON value for battery. so an error happens, like this…

2024-03-26 22:51:59.762 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path '$.battery' in '{"battery_low":false,"linkquality":72,"tamper":false,"water_leak":false}'

I understand the problem, but is there any way smarter to better handle this so its not enforced to look and alarm if this parameter is not included with every message received from MOSQUITTO.

Cheers, Thanks Norbert

Do a REGEX transform before that, and chain it to the jsonpath.

Oh, alternatively, just set zigbee2mqtt to send data not as json. That’s the best way rather than using REGEX+jsonpath.

output: attribute

1 Like