Hi
I just bought a Sonoff Zigbee bridge that I flashed with Tasmota and sending the result of multiple sensors over MQTT to OpenHAB. I have several other devices configured and updating items with MQTT but they all have there own topic. I’m struggelning to parse out the date from the new Sonoff Bridge since all the connected sensors are under the same topic.
mosquitto_sub -h 192.168.1.xx -u mqttuser -P -t tele/tasmota_D9B354/STATE/#
tele/tasmota_D9B354/SENSOR {"ZbReceived":{"0xDB69":{"Device":"0xDB69","Name":" P1-Garage","0500<00":"010000000000","ZoneStatusChange":1,"Endpoint":1,"LinkQuality":66}}}
tele/tasmota_D9B354/SENSOR {"ZbReceived":{"0xDB69":{"Device":"0xDB69","Name":" P1-Garage","0500<00":"000000000000","ZoneStatusChange":0,"Endpoint":1,"LinkQuality":81}}}
tele/tasmota_D9B354/SENSOR {"ZbReceived":{"0x72E3":{"Device":"0x72E3","Name":" P2-Backyard","0500<00":"010000000000","ZoneStatusChange":1,"Endpoint":1,"LinkQuality":76}}}
tele/tasmota_D9B354/SENSOR {"ZbReceived":{"0x2B77":{"Device":"0x2B77","Name":" P3w-Lekrum","0500<00":"000000000000","ZoneStatusChange":0,"Endpoint":1,"LinkQuality":60}}}
I tried with this to get out a given endpoint:
Number Zigbee_P1_GarageDoor "GarageDoor" {mqtt="<[mosquitto:tele/tasmota_D9B354/SENSOR:state:JSONPATH($.ZbReceived[0x72E3].ZoneStatusChange)]"}
But its trowing parsing errors in the log:
org.openhab.core.transform.TransformationException: An error occurred while transforming JSON expression.
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:71) ~[bundleFile:?]
at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:137) [bundleFile:?]
at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:574) [bundleFile:?]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:475) [org.eclipse.paho.client.mqttv3-1.1.0.jar:?]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:379) [org.eclipse.paho.client.mqttv3-1.1.0.jar:?]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:183) [org.eclipse.paho.client.mqttv3-1.1.0.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
Please advice
Thanks!
A little closer to the solution, one item is updated but it throws MQTT errors in the log for all my other items so the parsing is not mathing the ID if the sensor and tries to update all the items…
Number Zigbee_P1_GarageDoor "GarageDoor" {mqtt="<[mosquitto:tele/tasmota_D9B354/SENSOR:state:JSONPATH($.ZbReceived.0xDB69.ZoneStatusChange)]"}
Number Zigbee_P1_FrontDoor "FrontDoor" {mqtt="<[mosquitto:tele/tasmota_D9B354/SENSOR:state:JSONPATH($.ZbReceived.0x76DB.ZoneStatusChange)]"}
Output of the logfile:
020-09-15 06:35:14.322 [vent.ItemStateChangedEvent] - Zigbee_P1_GarageDoor changed from 0 to 1
==> /var/log/openhab2/openhab.log <==
2020-09-15 06:35:16.414 [WARN ] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: Invalid path ‘$.ZbReceived.0x76DB.ZoneStatusChange’ in ‘{“ZbReceived”:{“0xDB69”:{“Device”:“0xDB69”,“Name”:" P1-Garage",“0500<00”:“000000000000”,“ZoneStatusChange”:0,“Endpoint”:1,“LinkQuality”:63}}}’
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:71) ~[bundleFile:?]
at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:137) [bundleFile:?]
at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:574) [bundleFile:?]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:475) [org.eclipse.paho.client.mqttv3-1.1.0.jar:?]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:379) [org.eclipse.paho.client.mqttv3-1.1.0.jar:?]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:183) [org.eclipse.paho.client.mqttv3-1.1.0.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]*