Since the Zigbee bindings are working or not working at all with Openhab, I try now to use ZigBee2MQTT. ZigBee2MQTT was setup in less than half an hour.
It outputs: zigbee2mqtt:info 2020-01-12 00:18:53: MQTT publish: topic 'zigbee2mqtt/AqaraButton', payload '{"battery":100,"voltage":3075,"linkquality":113,"click":"single"}'
With MQTTfx I see this message.
How I’m really trying for hours to get it in Openhab work.
I have the MQTT Binding installed.
Thingsfile:
Bridge mqtt:broker:myUnsecureBroker [ host="127.0.0.1", secure=false ]
{
Thing topic AqaraButton "Aqara Button" @ "Somewhere" {
Channels:
Type string : button "Button" [stateTopic="zigbee2mqtt/AqaraButton", transformationPattern="JSONPATH:$.click"]
Type number : signalqualitaet "Signalqualität" [stateTopic="zigbee2mqtt/AqaraButton", transformationPattern="JSONPATH:$.linkquality"]
Type number : spannung "Spannung" [stateTopic="zigbee2mqtt/AqaraButton", transformationPattern="JSONPATH:$.voltage"]
Type number : batterie "Batterie" [stateTopic="zigbee2mqtt/AqaraButton", transformationPattern="JSONPATH:$.battery"]
}
}
Item-File
Items-File: Number AqaraButtonBatterie "Batterielevel [%d %%]" { channel="mqtt:topic:AqaraButton:batterie" }
However when pressing the button nothing happens in Openhab. I see MQTT message in MQTTfx but in LogViewer I see no output that any value changed.
Thanks. But still not working.
Log shows “2020-01-12 09:54:23.090 [.ItemChannelLinkAddedEvent] - Link ‘AqaraButtonBatterie-mqtt:topic:myUnsecureBroker:batterie’ has been added.”
Hast this name “myUnsecureBroker” to be related somehow with the MQTT Plugin? I don’t think so because in the config is the IP defined.
That would not have happened if you had used the PaperUI to create your Things
Yeah. But it also would take long, because I have to link every channel and I want to add some more devices. So the approach with the config files. Once it runs multiple devices can be added fast by search and replace.
Thanks for the hint. With Number AqaraButtonBatterie "Batterielevel [%d %%]" { channel="mqtt:topic:myUnsecureBroker:AqaraButton:batterie" }
it is working now.
The first button works now correctly. Now I’ve tried to add a Aqara Zigbee Temperature, Humidity and Pressure sensor. Item is shown correctly, but values get mixed up.
Bridge mqtt:broker:myUnsecureBroker [ host="127.0.0.1", secure=false ]
{
Thing topic AqaraButton "Aqara Button" @ "Somewhere" {
Channels:
Type string : aktion "Aktion" [stateTopic="zigbee2mqtt/AqaraButton", transformationPattern="JSONPATH:$.action"]
Type string : button "Button" [stateTopic="zigbee2mqtt/AqaraButton", transformationPattern="JSONPATH:$.click"]
Type number : signalqualitaet "Signalqualität" [stateTopic="zigbee2mqtt/AqaraButton", transformationPattern="JSONPATH:$.linkquality"]
Type number : spannung "Spannung" [stateTopic="zigbee2mqtt/AqaraButton", transformationPattern="JSONPATH:$.voltage"]
Type number : batterie "Batterie" [stateTopic="zigbee2mqtt/AqaraButton", transformationPattern="JSONPATH:$.battery"]
}
Thing topic AqaraTemperatursensor1 "Aqara Temperatursensor" @ "SecondLocation" {
Channels:
Type number : luftdruck "Luftdruck" [stateTopic="zigbee2mqtt/AqaraTemperatursensor1", transformationPattern="JSONPATH:$.pressure"]
Type number : luftfeuchtigkeit "Luftfeuchtigkeit" [stateTopic="zigbee2mqtt/AqaraTemperatursensor1", transformationPattern="JSONPATH:$.humidity"]
Type number : temperatur "Temperatur" [stateTopic="zigbee2mqtt/AqaraTemperatursensor1", transformationPattern="JSONPATH:$.temperature"]
Type number : signalqualitaet "Signalqualität" [stateTopic="zigbee2mqtt/AqaraTemperatursensor1", transformationPattern="JSONPATH:$.linkquality"]
Type number : spannung "Spannung" [stateTopic="zigbee2mqtt/AqaraTemperatursensor1", transformationPattern="JSONPATH:$.voltage"]
Type number : batterie "Batterie" [stateTopic="zigbee2mqtt/AqaraTemperatursensor1", transformationPattern="JSONPATH:$.battery"]
}
}
Itemsfile
Number AqaraTemperatursensor1Batterie "Batterielevel [%d %%]" { channel="mqtt:topic:myUnsecureBroker:AqaraTemperatursensor1:batterie" }
Number AqaraTemperatursensor1Signalqualitaet "Signalqualität [%d]" { channel="mqtt:topic:myUnsecureBroker:AqaraTemperatursensor1:signalqualitaet" }
Number AqaraTemperatursensor1Spannung "Spannung [%d mV]" { channel="mqtt:topic:myUnsecureBroker:AqaraTemperatursensor1:spannung" }
Number AqaraTemperatursensor1Luftfeuchtigkeit "Luftfeuchtigkeit [%d]" { channel="mqtt:topic:myUnsecureBroker:AqaraTemperatursensor1:luftfeuchtigkeit" }
However these values shown are from the button and the humidity isn’t shown at all.
Problem was that with copy and paste the old values of the Button were within that file. So it loaded the wrong channels and never corrected that mistake. Only a restart of Openhab could solve that issue. Is there an easier way to solve without restarting whole Openhab?
Did not work. It would be really nice to know. Because to really work with the button you need a trigger channel by Type string : button “Button” [stateTopic=“zigbee2mqtt/AqaraButton”, transformationPattern=“JSONPATH:$.click”, trigger=true]
However this setting is also only accepted when Openhab is restarted.