Trying to figure out the xiaomi aqara cube

I can’t figure out if the aqara cube via deconz is working yet or not, reading the posts in the forum.

I have it configured via deConz and if I monitor deconz_event I can see the events happening.
I can get a reaction on the ‘rotation’ by using device automations. But I can’t seem to get a reaction on the other motions.
I can see all the ‘go from 1 to 2’ etc. events in the automations setup for the device, but I don’t see any reaction when I try to set up automations using that.

1 Like

Hello, I’m not sure if I can help. I also have an Aqara Cube, it was also connected to HA via deconz. However, I had problems setting it up in deconz. I had to do the setup several times until the cube was integrated correctly. Only now could I see all the triggers of the cube (tilting, tapping, turning …) Then i started the automation via NodeRed … I am currently not using the cube, and I also no longer have the NodeRED Flow, sorry…

1 Like

Did you try to watch this?
I do not use deconz but this guy did pretty deep dive

1 Like

here I wrote this

3 Likes

if my pr get merged, the easiest way is to configure it via the device page.
https://github.com/home-assistant/core/pull/32108

this is how the event will look like.

    (CONF_ROTATE_FROM_SIDE_1, CONF_SIDE_2): {CONF_EVENT: 2001},
    (CONF_ROTATE_FROM_SIDE_1, CONF_SIDE_3): {CONF_EVENT: 3001},
    (CONF_ROTATE_FROM_SIDE_1, CONF_SIDE_4): {CONF_EVENT: 4001},
    (CONF_ROTATE_FROM_SIDE_1, CONF_SIDE_5): {CONF_EVENT: 5001},
    (CONF_ROTATE_FROM_SIDE_1, CONF_SIDE_6): {CONF_EVENT: 6001},
    (CONF_ROTATE_FROM_SIDE_2, CONF_SIDE_1): {CONF_EVENT: 1002},
    (CONF_ROTATE_FROM_SIDE_2, CONF_SIDE_3): {CONF_EVENT: 3002},
    (CONF_ROTATE_FROM_SIDE_2, CONF_SIDE_4): {CONF_EVENT: 4002},
    (CONF_ROTATE_FROM_SIDE_2, CONF_SIDE_5): {CONF_EVENT: 5002},
    (CONF_ROTATE_FROM_SIDE_2, CONF_SIDE_6): {CONF_EVENT: 6002},
    (CONF_ROTATE_FROM_SIDE_3, CONF_SIDE_1): {CONF_EVENT: 1003},
    (CONF_ROTATE_FROM_SIDE_3, CONF_SIDE_2): {CONF_EVENT: 2003},
    (CONF_ROTATE_FROM_SIDE_3, CONF_SIDE_4): {CONF_EVENT: 4003},
    (CONF_ROTATE_FROM_SIDE_3, CONF_SIDE_5): {CONF_EVENT: 5003},
    (CONF_ROTATE_FROM_SIDE_3, CONF_SIDE_6): {CONF_EVENT: 6003},
    (CONF_ROTATE_FROM_SIDE_4, CONF_SIDE_1): {CONF_EVENT: 1004},
    (CONF_ROTATE_FROM_SIDE_4, CONF_SIDE_2): {CONF_EVENT: 2004},
    (CONF_ROTATE_FROM_SIDE_4, CONF_SIDE_3): {CONF_EVENT: 3004},
    (CONF_ROTATE_FROM_SIDE_4, CONF_SIDE_5): {CONF_EVENT: 5004},
    (CONF_ROTATE_FROM_SIDE_4, CONF_SIDE_6): {CONF_EVENT: 6004},
    (CONF_ROTATE_FROM_SIDE_5, CONF_SIDE_1): {CONF_EVENT: 1005},
    (CONF_ROTATE_FROM_SIDE_5, CONF_SIDE_2): {CONF_EVENT: 2005},
    (CONF_ROTATE_FROM_SIDE_5, CONF_SIDE_3): {CONF_EVENT: 3005},
    (CONF_ROTATE_FROM_SIDE_5, CONF_SIDE_4): {CONF_EVENT: 4005},
    (CONF_ROTATE_FROM_SIDE_5, CONF_SIDE_6): {CONF_EVENT: 6005},
    (CONF_ROTATE_FROM_SIDE_6, CONF_SIDE_1): {CONF_EVENT: 1006},
    (CONF_ROTATE_FROM_SIDE_6, CONF_SIDE_2): {CONF_EVENT: 2006},
    (CONF_ROTATE_FROM_SIDE_6, CONF_SIDE_3): {CONF_EVENT: 3006},
    (CONF_ROTATE_FROM_SIDE_6, CONF_SIDE_4): {CONF_EVENT: 4006},
    (CONF_ROTATE_FROM_SIDE_6, CONF_SIDE_5): {CONF_EVENT: 5006},
    (CONF_MOVE, CONF_SIDE_1): {CONF_EVENT: 1000},
    (CONF_MOVE, CONF_SIDE_2): {CONF_EVENT: 2000},
    (CONF_MOVE, CONF_SIDE_3): {CONF_EVENT: 3000},
    (CONF_MOVE, CONF_SIDE_4): {CONF_EVENT: 4000},
    (CONF_MOVE, CONF_SIDE_5): {CONF_EVENT: 5000},
    (CONF_MOVE, CONF_SIDE_6): {CONF_EVENT: 6000},
    (CONF_DOUBLE_TAP, CONF_SIDE_1): {CONF_EVENT: 1001},
    (CONF_DOUBLE_TAP, CONF_SIDE_2): {CONF_EVENT: 2002},
    (CONF_DOUBLE_TAP, CONF_SIDE_3): {CONF_EVENT: 3003},
    (CONF_DOUBLE_TAP, CONF_SIDE_4): {CONF_EVENT: 4004},
    (CONF_DOUBLE_TAP, CONF_SIDE_5): {CONF_EVENT: 5005},
    (CONF_DOUBLE_TAP, CONF_SIDE_6): {CONF_EVENT: 6006},
    (CONF_AWAKE, ""): {CONF_GESTURE: 0},
    (CONF_SHAKE, ""): {CONF_GESTURE: 1},
    (CONF_FREE_FALL, ""): {CONF_GESTURE: 2},
    (CONF_FLIP_90, ""): {CONF_GESTURE: 3},
    (CONF_FLIP_180, ""): {CONF_GESTURE: 4},
    (CONF_MOVE_ANY, ""): {CONF_GESTURE: 5},
    (CONF_DOUBLE_TAP_ANY, ""): {CONF_GESTURE: 6},
    (CONF_TURN_CW, ""): {CONF_GESTURE: 7},
    (CONF_TURN_CCW, ""): {CONF_GESTURE: 8},
1 Like

@argo Yes, I know @DrZzs, very cool guy, and I’ve also watched his video.
@myle, Yes I can see the events in the deconz_event.

I found that some of the actions are working, and quite a lot are not working.
These are the triggers that are defined for the magic cube as a device in the Lovelace editor.
Turn (counter)-clockwise: works
Shake: works
double-tap: does NOT work
Rotate from side to side: does NOT work
Free fall: does NOT work

Hi @Dorzel107 so what you are writing is that the events have changed, and that might be why it isn’t working, and it won’t work until the PR gets merged in?

here is my double tap

- alias: 'SquareBox double tap'
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: magic_cube
  condition:
    condition: template
    value_template: >
      {% set valid_events = [1001, 2002, 3003, 4004, 5005, 6006] %}
      {{ trigger.event.data.event in valid_events }}
  action:   
  - data_template:
      payload: double tap {{ trigger.event.data.event }}
      topic: home/magic_cube
    service: mqtt.publish 

if i double side 2

i get

double tap 2002

my free fall

- alias: 'SquareBox fall'
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: magic_cube
  condition:
    condition: template
    value_template: >
      {% set valid_events = [7008] %}
      {{ trigger.event.data.event in valid_events }}
  action:   
  - data_template:
      payload: fall
      topic: home/magic_cube
    service: mqtt.publish 

here working on the rotate one now ill be back

1 Like

the device page has no logic in how to handle the cube, according the discriptions.
also double tap on side 2 had the wrong event.
so i made a pr to change this. the code_owner has aproved the changes, and it only needs to be merged.

but if you configure an automation trigger on the automation page in yaml you can make it like this
this is how double tap on side 1 would look like
EXAMPLE

event_data:
  event: 1001
 id: mi_magic_cube_2
event_type: deconz_event
platform: event
1 Like

the events on denveloper tools don’t change
only on the device page.

1 Like

Ok, looking in the deconz_event I see this:

    "event_type": "deconz_event",
    "data": {
        "id": "lians_magic_cube",
        "unique_id": "00:15:8d:00:02:e9:75:82",
        "event": 1001,
        "gesture": 6

I’ve made an automation like this:

- id: '1583177296889'
  alias: Kitchen - Magic Cube double-tap - goodnight
  description: ''
  trigger:
  - event_data:
      event: 1001
      id: lians_magic_cube
    event_type: deconz_event
    platform: event
  condition: []
  action:
  ...

But nothing happens, hmmm…

I have been looking for the same update and I want t include with it that I am Unable to connect my Xiomi phone with Arlo Ultra to view the live footage of home from arlo app for pc.Guide us what to do for the resolution?

Eh? Not sure how that relates in any way to Home Assistant and Aqara Cube?

your automation looks good, and home assistant can read the events.
i asume that you have a action configured.

did you try a restart of home assistant ??
cause i cant see anything wrong.

1 Like

Yes, I have a row of actions of course :slight_smile:
I have had it rebooted, I’ll keep at it. At least I got the shaking working, so now the wife has a goodnight routine :wink: (Google assistant in Danish doesn’t have routines, and she’s not friends with google).

Ok, so after the 0.106.6 and the deconz update nothing worked.
But I’ve redone them, choosing the same, and now it works again, weird? An undocumented breaking change.

When including the cube in phoscon addon, one have to rotate/flip/shake etc. during the include process to get it to include correctly so you get the 2 sensors/switch. My first time I only got one (missing the rotate analog sensor) so I had to reinclude it. The weird thing is only one shows in dev tools entities as sensor.magiccube_battery_level the other can be discovered by listening to deconz_event in dev tools, mine is switch_11.

Great tip! My first include I also didn’t get the rotate ability. I’ve since added about 5 times and have yet to get tap/double tap to work, but now rotate works pretty reliably. Maybe I’ll try adding it another dozen or so times to see if I can get tap/double tap to work.

ScreenShot_20200531213122

ConBee :grinning:
Home Assistant 0.110.4 :grinning:

1 Like

I got my new Aqara Cube to fully work today, with Home Assistant (0.116.2) and a Conbee II (with deCONZ 6.4.0 add-on).

I initially had similar issues when “pairing”: It would get detected, but then I would only get the edge flipping to display a changed state, even the Phoscon page. Then I re-added and the shaking also worked, but not the rotating.

What seems to have done the trick each time for me was to make sure to perform all possible actions with the Cube while it was being detected by Phoscon!

The time I re-added it while shaking it, the shaking movement was then being properly detected, but not the rotation clockwise/counterclockwise. When re-re-adding while flipping, shaking and turning, all of them were then being properly detected and shown!

The detection seems to enable only what it’s able to see changing while the device is being added. That’s my wild guess at least.

Matthias

2 Likes