I have received a Sonoff Zigbee bridge as a gift for christmas.
Today i flashed it with Tasmota and im trying to link the mqtt data to items in openhab.
Heres my current setup but it doesnt seem to be working.
Number Kids_Bedroom_Temperature "Temperature [%.2f °C]" <temperature> { channel="mqtt:topic:Kids_Bedroom_Sensor:temperature" }
Number Kids_Bedroom_Humidity "Humidity [%.2f %%]" <humidity> { channel="mqtt:topic:Kids_Bedroom_Sensor:humidity" }
Things
Thing mqtt:topic:Kids_Bedroom_Sensor "Kids Sensor" (mqtt:broker:MQTTBroker) {
Channels:
Type number : temperature [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.Temperature" ]
Type number : humidity [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.Humidity" ]
Type number : voltage [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.voltage" ]
Type number : battery [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.battery" ]
Type number : linkquality [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.linkquality" ]
Sitemap
Text item=Kids_Bedroom_Temperature label="Bedroom Temperature [%.1f °C] " icon="temperature"
Text item=Kids_Bedroom_Humidity label="Humidity [%.1f %%]" icon="humidity"
and so on for your other properties. That would make your Thing
Thing mqtt:topic:Kids_Bedroom_Sensor "Kids Sensor" (mqtt:broker:MQTTBroker) {
Channels:
Type number : temperature [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.ZbReceived.0xB85C.Temperature" ]
Type number : humidity [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.ZbReceived.0xB85C.Humidity" ]
Type number : linkquality [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.ZbReceived.0xB85C.LinkQuality" ]
I have removed battery and voltage because they donāt exist in your JSON stringā¦
Depends on your code editor and plugins, I assume. Iām using Visual Studio Code with the openHAB plugin, and hereās an example from mine:
Iāve just tried your setup
Thing mqtt:topic:Kids_Bedroom_Sensor "Kids Sensor" (mqtt:broker:MQTTBroker) {
Channels:
Type number : temperature [
stateTopic="tele/Zigbee_Bridge/SENSOR",
transformationPattern="JSONPATH:$.ZbReceived.0xB85C.Temperature"
]
Type number : humidity [
stateTopic="tele/Zigbee_Bridge/SENSOR",
transformationPattern="JSONPATH:$.ZbReceived.0xB85C.Humidity"
]
Type number : linkquality [
stateTopic="tele/Zigbee_Bridge/SENSOR",
transformationPattern="JSONPATH:$.ZbReceived.0xB85C.LinkQuality"
]
}
with Items
Number Temperature "Number value" {channel="mqtt:topic:Kids_Bedroom_Sensor:temperature"}
Number Humidity "Number value" {channel="mqtt:topic:Kids_Bedroom_Sensor:humidity"}
Number Linkquality "Number value" {channel="mqtt:topic:Kids_Bedroom_Sensor:linkquality"}
And itās all working fine for me when sending your JSON string to tele/Zigbee_Bridge/SENSOR
something in my setup still is not working correctly and i cant put my finger on it!
i wonder if i need to use the friendly name rather than the device name?
Thing mqtt:topic:Kids_Bedroom_Sensor "Kids Sensor" (mqtt:broker:MQTTBroker) {
Channels:
Type number : temperature [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.0xB85C.Temperature" ]
Type number : humidity [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.Kids_Bedroom_Sensor.0xB85C.Humidity" ]
Type number : voltage [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.BatteryVoltage" ]
Type number : battery [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.BatteryPercentage" ]
Type number : linkquality [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.LinkQuality" ]
}
@Taffy - in your original post the data shown doensāt include any data for āVoltageā or āBatteryā, so if it isnāt in the data being sent by your sensor, you are not going to be able to parse it out of the air. This was mentioned already by @hafniumzincin his first post.
You also still have all of your transformations incorrect. @hafniumzinc showed them correct per your posted data in two different posts. Iād suggest using those.
it sends battery Percentage and voltage on a seperate line. this is why i didnt include it.
i have also tried the transformations @hafniumzinc showed me and they unfortunatly didnt work so i was just trying a few combinations.
heres is my setup after altering fully from what @hafniumzinc said
Number Kids_Bedroom_Temperature "Temperature [%.1f °C]" <temperature> { channel="mqtt:topic:Kids_Bedroom_Sensor:temperature" }
Number Kids_Bedroom_Humidity "Humidity [%.1f %%]" <humidity> { channel="mqtt:topic:Kids_Bedroom_Sensor:humidity" }
Number Kids_Bedroom_LinkQuality "Link Quality [%d]" <network> { channel="mqtt:topic:Kids_Bedroom_Sensor:linkquality" }
Number Kids_Bedroom_Voltage "Voltage [%d mV]" <energy> { channel="mqtt:topic:Kids_Bedroom_Sensor:voltage" }
Number Kids_Bedroom_Battery "Battery [%.1f %%]" <battery> { channel="mqtt:topic:Kids_Bedroom_Sensor:battery" }
things
Thing mqtt:topic:Kids_Bedroom_Sensor "Kids Sensor" (mqtt:broker:MQTTBroker) {
Channels:
Type number : temperature [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.ZbReceived.0xB85C.Temperature" ]
Type number : humidity [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.ZbReceived.0xB85C.Humidity" ]
Type number : voltage [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.ZbReceived.0xB85C.BatteryVoltage" ]
Type number : battery [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.ZbReceived.0xB85C.BatteryPercentage" ]
Type number : linkquality [ stateTopic="tele/Zigbee_Bridge/SENSOR", transformationPattern="JSONPATH:$.ZbReceived.0xB85C.LinkQuality" ]
}
sitemap
Text item=Kids_Bedroom_Temperature label="Bedroom Temperature [%.1f °C] " icon="temperature"
Text item=Kids_Bedroom_Humidity label="Humidity [%.1f %%]" icon="humidity"
still no activity in openhab. using MQTTOOL to make sure messages are being sent and received, which they are so the problem must lie in my configs.
You may be hitting the known bug where Things files arenāt correctly parsed by openHAB, especially as youāre still on OH2.4. Easiest thing to do is restart openHAB.
Thank you for that, it is now showing all relevant data.
im only on 2.4 still because when i tried to update to latest stable version all the mqtt items wouldnt work as id not brought them all upto date, which im currently in the process of doing.
Found myself a new issue now!
I have added additional sensors to the zigbee bridge. All sensors are outputting mqqt data from the bridge. I was reading the tasmota zigbee documentation and it stated by using the command SetOption89 1 each sensor could have its own mqtt topic which is great but now nothing is reporting like it should on the openhab side. nothing even pops up on the log when there is incoming mqqt data.
Number Kids_Bedroom_Temperature "Temperature [%.1f °C]" <temperature> { channel="mqtt:topic:Kids_Bedroom_Sensor:temperature" }
Number Kids_Bedroom_Humidity "Humidity [%.1f %%]" <humidity> { channel="mqtt:topic:Kids_Bedroom_Sensor:humidity" }
Number Kids_Bedroom_LinkQuality "Kids Bedroom Link Quality [%d]" <network> (gALLLinkQuality) { channel="mqtt:topic:Kids_Bedroom_Sensor:linkquality" }
Number Kids_Bedroom_Voltage "Kids Bedroom Voltage [%d mV]" <energy> (gALLBatteryVoltage) { channel="mqtt:topic:Kids_Bedroom_Sensor:voltage" }
Number Kids_Bedroom_Battery "Kids Bedroom Battery [%.1f %%]" <battery> (gALLBatteryPercentage) { channel="mqtt:topic:Kids_Bedroom_Sensor:battery" }
Number Living_Room_Temperature "Temperature [%.1f °C]" <temperature> { channel="mqtt:topic:Living_Room_Sensor:temperature" }
Number Living_Room_Humidity "Humidity [%.1f %%]" <humidity> { channel="mqtt:topic:Living_Room_Sensor:humidity" }
Number Living_Room_LinkQuality "Living Room Link Quality [%d]" <network> (gALLLinkQuality) { channel="mqtt:topic:Living_Room_Sensor:linkquality" }
Number Living_Room_Voltage "Living Room Voltage [%d mV]" <energy> (gALLBatteryVoltage) { channel="mqtt:topic:Living_Room_Sensor:voltage" }
Number Living_Room_Battery "Living Room Battery [%.1f %%]" <battery> (gALLBatteryPercentage) { channel="mqtt:topic:Living_Room_Sensor:battery" }
All sensors output data for all things stated just at different times as stated in an earlier post so i used a regex transformation as explained by @hafniumzinc
I had this working perfectly with just one sensor but since adding the second and using seperate mqqt topics i dont seem to get anything?