OS+Platform: Raspbian on a Raspberry Pi 3 Model B Rev 1.2 OH: openHAB 2.5.1-2 (Release Build) Switch: Aqara Xiaomi WXKG11LM Rev.2, Version 20180525
I’m struggling with the setup of a multi switch (Aqara WXKG11LM) to react on a button click in a rule. I’m using the switch via the deConz binding (the switch is a supported device) over conBee2. It is connected fine via the Phoscon app:
:
I am able to get the button events via the REST-api. In my case the button events are 1002 (click) 1003 (long press) and 1004 (double click). Therefore I assume, it’s working in general:
Unfortunately, I’m not able to get this mapped to a rule in OH. Maybe I really miss the obvious…
I’ve installed the deConz binding, created the Bridge and added the item (based on the binding documentation: https://www.openhab.org/addons/bindings/deconz/): Thing:Thing switch xiaomi-ffagent-button "deCONZ FFAgent Button" @ "Flur" [ id="6" ] Items: Number FFAgent_Button "Button" { channel="deconz:switch:conbee2server:xiaomi-ffagent-button:button" } Switch FFAgent_ButtonEvent "Buttonevent" { channel="deconz:switch:conbee2server:xiaomi-ffagent-button:buttonevent" } DateTime FFAgent_LastUpdate "Letztes Update" { channel="deconz:switch:conbee2server:xiaomi-ffagent-button:last_updated" } Number FFAgent_BatteryLevel "Batterieladezustand [%.0f%%]" { channel="deconz:switch:conbee2server:xiaomi-ffagent-button:battery_level" } Switch FFAgent_BatteryLow "Batterie FFAgent leer?" { channel="deconz:switch:conbee2server:xiaomi-ffagent-button:battery_low" }
It shows up as connected, except the greyed out “Button Trigger”:
Finally the rule script looks like: rule "FFAgent Button pressed" when Channel "deconz:switch:conbee2server:xiaomi-ffagent-button:buttonevent" triggered 1002 then //do somehting
I cant find any error in the logs. For example, I can see some events for FFAgent_LastUpdate in the event log but that’s it. No errors in any other log related to this. No indication whether the button was clicked or whether something went wrong. The rule (the WHEN statement looks like it’s never true).
Did someone already get this constellation working? I appreciate any inputs.
I used a cube example for the my cube rule. I bet it would work for you. Search xiamoi cube on openHAB forum. I still have a few intermittent issues I am trying to work though. I think the rule I have used the http binding to poll the deconz rest api.
I used IKEA switch with deConz. All configuration was done by paperUi.
My rule looks like next:
rule “remote_switched”
when
Channel “deconz:switch:91716378:14b457fffe73b5de011000:buttonevent” triggered
then
var eventValue = receivedEvent.getEvent()
switch (eventValue) {
case “1002”: …
}
Check if this channel was triggered at all - for example, remove value 1002 after word triggered and try to output to log the received value
@Itzamna I see the same issue. I need to trouble shoot more but I can confirm the rule does not trigger as you have it. Other forum post suggest it should so I am confused also.
Thanks. I still having trouble but I think I get closer to the issue. It looks like that I’ve a gap in my .things configuration for the sensors. I don’t have only this switch but also at least 6 Xiaomi Multi Sensors (Temperature) defined.
It might be related to the [id="x"] parameter for each defined Thing in the file. It’s the first time I came across such a parameter at all and I can’t find any documentation about it. Neither in the common openHAB documentation (https://www.openhab.org/docs/configuration/things.html - there, it’s just a lightId="x" with no explanation) nor in the deCONZ binding documentation.
All I know is, that if I remove this parameter for each Thing in the bridge, all Things show up as “OFFLINE Configuration Pending” in PaperUI. So it must be somehow important. Therefore my next question is:
Where does this [id="x"] parameter belongs to? Is this related to the sensor type (i.e. all temperaturesensor's must have [id="2"] (based on Full Things File example on https://www.openhab.org/addons/bindings/deconz/)? Or must this be a unique id over all Things in this file?
For reference, this is my current .things configuration file. I’ve set up a unique id for each sensor. With this, all xiaomi-xm06 Things are OFFLINE in PaperUI. However, even if I setup the id based on the sensor types it doesn’t work. Then everything is Online but the button channel is not triggered.
The id = xx can be obtained from the deconz rest api. When you go to the link: deconzip/api/apikey/sensors/xx where xx is the sensor number in the api. You want your things file to match these numbers based on description of sensor in api.
Have a look in the api it should line up. If not I can give more explanation.
OMG
This is the obvious point I mixed up. The id is the mapping part and not the name (like FFAgent)… I’ve changed it and all is working fine now The channel of the switch is triggered and even some unexpected issues with some temperature sensors are now gone.
Thank you very much for your help on that!!!
I would like to integrate the Xiaomi Smart Switch WXKG01LM into my OH 2.5 9.
I already have a ZigBee network with 7 sensors.
My ZigBee network is set up via USB stick deConz and Lumi and Osram sockets as repeater.
So far, everything is largely stable.
As an extension, the Xiaomi Smart Switch WXKG01LM is now to be added.
The botton was parameterized by the system and Thing and the items could be created via VSCode without problems and communication is also running, but the interface does not seem to be correct.
The button only knows one change, but it cannot be undone.
But if I send a command from OH to the button via Rule then this change is accepted
As far as I know there are also double clicks and other commands that I really wanted to use
The trigger is also not addressed.
Date of change and battery is received correctly