Aqara Cube Smart Home Controller / Event Rule not triggered

Hi,

i´m trying configure my Aqara Cube Smart Home Controller.

My Setup:

  • OH 2.4
  • Deconz binding 2.5

Deconz things are configuerd and work fine. Now i created this rule, because it seems the Aquara Cube via Deconz has a different behavier to the rule described in the Xiaomi Mi Smart Home Binding.
I receive Numbers and no Events like “FLIP180”

rule "Aquara Magic Cube"
when
    Channel "deconz:switch:Rpi-Phoscon-GW:MagicCube:buttonevent" triggered
then
    var actionName = receivedEvent.getEvent()
    switch(actionName) {
        if actionName in [1000, 2000, 3000, 4000, 5000, 6000] {
            logInfo(filename, "Magic Cube: slide")
        } else if actionName in [1001, 2002, 3003, 4004, 5005, 6006] {
           logInfo(filename, "Magic Cube: double tap")
        } else if actionName in [1006, 2005, 3004, 4003, 5002, 6001] {
            logInfo(filename, "Magic Cube: flip180")
        } else if actionName in [1002, 1003, 1004, 1005, 2001, 2003, 2004, 2006, 3001, 3002, 3005, 3006, 4001, 4002, 4005, 4006, 5001, 5003, 5004, 5006, 6002, 6003, 6004, 6005] {
            logInfo(filename, "Magic Cube: flip90")
        } else if actionName == 7007 {
            logInfo(filename, "Magic Cube: shake")
        } else if actionName == 7008 {
            logInfo(filename, "Magic Cube: free fall")
        } else if actionName == 7000 {
            logInfo(filename, "Magic Cube: wakeup")
        }
    }
end

I can see the event numbers in the OH log, but the rule is not fired.

Any ideas?
THX

Don’t know how you do it with the Deconz Binding but it works perfect with the Xiaomi Smart home binding:

@rule("Mijia & Aqara Cube Controller")
@when("Channel "mihome:sensor_switch:<GwID>:<ID>:button" triggered")
def cubeControllerRule(event):
event = event.event
    if "MOVE" in str(event):
	<ACTION>
    elif "ROTATE_RIGHT" in str(event):
	<ACTION>
    elif "ROTATE_LEFT" in str(event):
	<ACTION>
    elif "FLIP90" in str(event2):
        <ACTION>
    elif "FLIP180" in str(event2):
        <ACTION>
    elif "TAP_TWICE" in str(event):
        <ACTION>
    elif "SHAKE_AIR" in str(event):
        <ACTION>
    elif "FREE_FALL" in str(event):
        <ACTION>
    elif "ALERT" in str(event):
        <ACTION>

Hi Nico,

via the Deconz Binding i don´t get “ROTATE_RIGHT” or “FREE_FALL”. example for free fall i receive “7008”. So i´m fine with the numbers.

The question is why this does not work

if actionName in [1000, 2000, 3000, 4000, 5000, 6000] {
logInfo(filename, “Magic Cube: slide”)
I don´t want to out every single number into a CASE like this:

var actionName = receivedEvent.getEvent()
switch(actionName) {
case “1001”: {

}
case “1002”: {

}

Yeah, you can use it as a backup if the deconz way doesnt work.
Does the number represent the zwave/Zigbee command?
is getEvent() returning a string? you could .toString it.

yeah, the number represent the Zigbee command. yes it´s a string.

So tried this:

rule “Aqara Cube Controller”
when
Channel ‘deconz:switch:Rpi-Phoscon-GW:MagicCube:buttonevent’ triggered
then
var actionName = receivedEvent.getEvent()
switch(actionName) {
case “7007”: {
logInfo(filename, “Magic Cube: shake”)
}
case “7008”: {
logInfo(filename, “Magic Cube: free fall”)
}
case “7000”: {
logInfo(filename, “Magic Cube: wake”)
}
}
end

Works!

so it seem to be a problem with the:

if actionName in [1000, 2000, 3000, 4000, 5000, 6000] {
logInfo(filename, “Magic Cube: slide”)
}