Thanks for the clarification @chris.
Added a some ikea-bulbs, a float led-panel and some xiaomi motion and windowsensors this weekend, and it seems to be stable so far.
Did you need additional Javascript transformation or were the ones already posted sufficient?
Updated some to reflect other attributes and added one for triggering a low-battery alarm. But they are pretty much the same.
Any tutorial to install and use in openHab?
The openHAB specific configuration is in the first post.
I doubt combining everything in a single install/tutorial makes sense, zigbee2mqtt is pretty well documented, so is the mqtt stuff. It just would be a duplicate.
Do you have any specific question?
Thank you.
One question, devices automatically appear in openHAB under āthingsā?
Now I use zigbee2mqtt in home assistant and Iām considering moving to OH, but I have doubts about how the devices work, I have several
No, the mqtt binding is an old binding, you need to configure your items files with the information from the first post manually.
Oh, btw, you need to install the Javascript and JsonPath transformations as well.
I have started experiencing periodical loss of control over the bulbs now, have reported the issue to zigee2mqtt. Have anybody else experienced this?
I changed the definition of Xiaomi Aqara wireless switch WXKG11LM in the first post. The difference is, that the trigger should now work on received command
instead of changed
.
In addition to that i also corrected the getZigbeeClick.js
transformation.
I added this:
- Xiaomi Aqara temperature, humidity and pressure sensor WSDCGQ11LM
Hello Joachim,
i cannot get my Aqara botton WXKG11LM to work. I defined my button as you did above:
string XB1_CLICK "BUTTON [%s]" <button> {mqtt="<[broker:zigbee2mqtt/XB1_Button:command:JS(getZigbeeClick.js)]"
and placed the āgetZigbeeClick.jsā in the transform-folder. JAVASCRIPT and JSONPATH transformations are activated in OH2, MQTT Binding is also active. When I now press the button I see the following js-error in the openhab2.logfile:
2018-08-14 18:57:21.847 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: An error occurred while executing script.
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [217:org.openhab.core.compat1x:2.2.0]
at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138) [219:org.openhab.binding.mqtt:1.11.0]
at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:556) [220:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:475) [220:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:379) [220:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:183) [220:org.openhab.io.transport.mqtt:1.11.0]
at java.lang.Thread.run(Thread.java:748) [?:?]
2018-08-14 18:57:21.886 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: An error occurred while executing script.
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [217:org.openhab.core.compat1x:2.2.0]
at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138) [238:org.openhab.binding.mqtt:1.11.0]
at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:556) [220:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:475) [220:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:379) [220:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:183) [220:org.openhab.io.transport.mqtt:1.11.0]
at java.lang.Thread.run(Thread.java:748) [?:?]
What iām doing wrong - any hints? Greetings from Hamburg, machnetz
Hi Machnetz,
did you define the battery items as well? If yes, this may be the cause. The click-message does not contain the battery values, thatās whythe message parser runs into exceptions. But my exceptions differ slightly, i am running openHAB 2.3, not 2.2 like you (did you perhaps filter the log for mqtt?). But the click is working nevertheless.
Here is what i get:
2018-08-14 22:37:09.014 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: Invalid path '$.voltage' in '{"click":"single"}'
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [194:org.openhab.core.compat1x:2.3.0]
at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138) [277:org.openhab.binding.mqtt:1.12.0]
at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:574) [278:org.openhab.io.transport.mqtt:1.12.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:475) [278:org.openhab.io.transport.mqtt:1.12.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:379) [278:org.openhab.io.transport.mqtt:1.12.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:183) [278:org.openhab.io.transport.mqtt:1.12.0]
at java.lang.Thread.run(Thread.java:748) [?:?]
2018-08-14 22:37:09.021 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: Invalid path '$.battery' in '{"click":"single"}'
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [194:org.openhab.core.compat1x:2.3.0]
at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138) [277:org.openhab.binding.mqtt:1.12.0]
at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:574) [278:org.openhab.io.transport.mqtt:1.12.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:475) [278:org.openhab.io.transport.mqtt:1.12.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:379) [278:org.openhab.io.transport.mqtt:1.12.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:183) [278:org.openhab.io.transport.mqtt:1.12.0]
at java.lang.Thread.run(Thread.java:748) [?:?]
==> /var/log/openhab2/events.log <==
2018-08-14 22:37:09.031 [vent.ItemStateChangedEvent] - SZKEY1_CLICK changed from NULL to single
Iām thinking of creating a specific OpenHab plugin for the zigbee2mqtt firmware.
The idea is to declare āproperlyā elements & transformations
- to prevent from using javascript calls in the mapping
- to be able to generate/manage the mappings from paperUI, without heavy manual configuration (auto-discovery & so on)
Do you think it should be a good idea ?
For some Inspiration you can have a look into the current ESH development:
No, i donāt think so. It would be better in my opinion to put that effort into the zigbee binding.
Hello Joachim,
sorry for my delayes answer. Yes, the buttons are defined
Iāve seen your posted error-messages in my logfiles too. Yesterday I found out that the extended data (battery, voltage, click) would only be sent if the logon button was pressed on the button:
2018-08-15 09:07:59.286 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: An error occurred while executing script.
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [217:org.openhab.core.compat1x:2.2.0]
at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138) [239:org.openhab.binding.mqtt:1.11.0]
at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:556) [220:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:475) [220:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:379) [220:org.openhab.io.transport.mqtt:1.11.0]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:183) [220:org.openhab.io.transport.mqtt:1.11.0]
at java.lang.Thread.run(Thread.java:748) [?:?]
2018-08-15 09:07:59.319 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: Invalid path ā$.clickā in ā{ābatteryā:ā100.00ā,āvoltageā:3045}ā
And i cannot get my stick properly running. It might be my setup a have to review. Thank you for your reply. Iāll test it againā¦
I donāt use the āZigbee bindingā plugin, because :
- it is NOT compatible with the Zigbee2MQTT firmware
- standard CC2531 firmware (working with the Zigbee binding) are NOT compatible with many items (Xiaomi switches/sensors, Philips Hue, Ikea Tradfri, etc. (whatās why I use zigbee2MQTT)
So I donāt have any interest in developping this plugin (and I donāt either have a dedicated CC2531 key with related zigbee sensors to testā¦).
Oh, i didnāt knew this. I thought it was just a matter of missing implementation, never thought of incompatible firmwares.
Then this is differentā¦ although i wouldnāt be interested in a binding for that, i guess many others would.
Why not look at fixing this? I tend to focus on the Ember dongles so am not particularly familiar with the TI firmware, but given the protocol is largely the same between versions (I think itās completely the same) it is likely to just be configuration. To me, this would make more sense than yet another ZigBee binding.
Are you sure? So TI dongles are not compatible with Hue? This for sure I know is wrong as I have personally tested the TI dongle with these devices you list with the ZigBee binding.