Hello all,
I’ve been working with Sonoff ZigBee Bridge running Tasmota 12.4.0. My current version of openHAB is 3.3.0 Release Build. I am able to get the data I need from the connected sensors. However, I get “Executing the JSONPATH-transformation failed: Invalid path” in the log. See below. For the SNZB-02:Temp/Hum sensor, when the bridge reports the “Humidity” a [Warn] message is generated in the log for “Temperature”. The reverse is true when “Temperature” is reported. I’ve tried several things, but I cannot seem to solve my problem. Any help would be very much appreciated.
Thank you,
Bob
Connected Sensors:
SNZB-02:Temp/Hum
SNZB-03: Motion
SNZB-04: Door Sensor
SNZB-01 Button
Thank you, @hafniumzinc, I think I get the concept, but I fail on the syntax/application. For my code above:
stateTopic: tele/ZbBridge/Temp_Bob_BedRM/SENSOR
transformationPattern: JSONPATH:$.ZbReceived.Temp_Bob_BedRM.Humidity
Do I add the REGEX before the transformationPattern like this:
transformationPattern: **REGEX (.Humidity.)**JSONPATH:$.ZbReceived.Temp_Bob_BedRM.Humidity
I have lots of door/window sensors SNZB-04 but I am using zigbee2mqtt.
I am using mosquitto as the mqtt.
My json looks like this:
{“battery”:100,“battery_low”:false,“contact”:true,“last_seen”:“2023-03-15T19:47:28+11:00”,“linkquality”:93,“tamper”:false,“voltage”:3100}
My mqtt topic is: zigbee2mqtt/door-back
My JSONPATH is JSONPATH:$.contact for the open close.
UID: mqtt:topic:mqttbroker:0bc8c6461a
label: Zigbee door back sensor
thingTypeUID: mqtt:topic
configuration:
payloadNotAvailable: offline
availabilityTopic: zigbee2mqtt/door-back/availability
payloadAvailable: online
bridgeUID: mqtt:broker:mqttbroker
location: Kitchen small deck
channels:
- id: zigbeedoorback
channelTypeUID: mqtt:contact
label: Zigbee door back
description: ""
configuration:
stateTopic: zigbee2mqtt/door-back
transformationPattern: JSONPATH:$.contact
off: "true"
on: "false"
- id: zigbeedoorbackbattery
channelTypeUID: mqtt:number
label: Zigbee door back battery
description: ""
configuration:
stateTopic: zigbee2mqtt/door-back
transformationPattern: JSONPATH:$.battery
unit: "%"
I am using OH3.
I didn’t need any REGEX to get it to work.
Hope this may help. I did have a sonoff zigbee bridge and it did take a bit if trial and error to get the syntax to work.
I think it pretty much came down to you put a dot for any { in your data payload and then the item you want the value.
EG {“ZbReceived”:{“0x2B14”:{“Device”:“0x2B14”,“Contact”:1,“Endpoint”:1,“LinkQuality”:42}}}
Hello @ubeaut.
I have some SNZB-04 and they work fine with no errors in the log. The issue I am having is with the SNZB-02:Temp/Hum. These have both temperature and humidity. However, only report one at a time.
tail -f /var/log/openhab/openhab.log /var/log/openhab/events.log
Error in log for temperature:
2023-03-13 17:31:43.041 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path '$.ZbReceived.Temp_Bob_BedRM.Temperature ’ in ‘{“ZbReceived”:{“Temp_Bob_BedRM”:{“Device”:“0xC6AB”,“Name”:“Temp_Bob_BedRM”,“Humidity”:30.03,“Endpoint”:1,“LinkQuality”:120}}}’
The event in Log confirming the change in Humidity
2023-03-13 17:31:43.117 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Bobs_Bedroom_Humidity’ changed from 31.1 to 30.03
The reverse is true. When ZigBee Bridge sends the Temperature, an error for Humidity shows up in the log along with an event for Temperature. You can see my JSONPATH in the code of my original post.
My goal is to eliminate the error “Executing the JSONPATH-transformation failed: Invalid path” in both cases.
Thanks for your support, @ubeaut . This is not working for me. I am missing something and will need to dig deeper. The warning only happens with the ZigBee devices with multiple parameters reporting separately. I will need to experiment with Tasmota’s SetOptions commands. I update the thread with what I come up with.