Aqara Magic Cube ZHA (51 actions)

Tags: #<Tag:0x00007fc3ff81aef0> #<Tag:0x00007fc3ff81ad38> #<Tag:0x00007fc3ff81aba8> #<Tag:0x00007fc3ff81aa40>

none of the specific side action works for me. but if I check any side it will work.

I’m fairly new to ZHA and home assistant and I am just trying to understand your blueprint from reverse engineering.

I suspect the issue might be the conditions when you are specifying value == slide but it should be command == ‘slide’ ?

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "00:15:8d:00:05:7b:00:4c",
        "unique_id": "00:15:8d:00:05:7b:00:4c:2:0x0012",
        "device_id": "dff5a27387297af7023e41b959706dd3",
        "endpoint_id": 2,
        "cluster_id": 18,
        "command": "slide",
        "args": {
            "value": 257,
            "description": "aqara logo facing user rotated 90 degrees right",
            "activated_face": 2
        }
    },
    "origin": "LOCAL",
    "time_fired": "2021-02-19T05:06:36.246734+00:00",
    "context": {
        "id": "0592ed21f8a6307c7add7d56c4e33c65",
        "parent_id": null,
        "user_id": null
    }
}

I’m sorry, but it has to be a different issue as specific site automations works for me without any problems using this blueprint.

Somebody know why with z2m and deconz its possible to know which face is up when rotating but not with ZHA?
This is the only thing missing for me to make my cube working.

i testes out all of the triggers with service toggle light while watching zha_event.

knock, slide only works on side 1 even when “slide any side” and “knock on any side” are set to false.

when performing the action, zha_event are register and logbook shows automation triggered by zha event, however the service is not called.

im not sure if this is related to my config or only tie to this blueprint.

Where do I have to remove the lumi.sensor_cube statement? Can’t find it in the blueprint…

Is there side specific rotate options or am I missing something? Was thinking rotate could be used for light brightness with the light chosen by side facing up?

1 Like

looking for the same feature. if ever you found it

It looks like the deconz blueprint has a double tap automation. Does ZHA not support that?

This blueprint supports double tap, its a double knock or what is listed as simply “knock” in the bullets.

I am Looking for a way to limit rotate left/right based on the activated face.
So that with face 1 rotate left/right will increase/decrease light brightness, and face 2 will change color or volume etc…

Right now the rotate trigger is global, regardless of active face.
I thought to add conditions but only battery is available as a condition.

Any hints?

2 Likes

@Necromancer I’ve added an input_select helper and when I put the cube down on a face, it changes the input_select to some text value (eg. Lights, Music). Then in rotate left/right triggers I’ve used a choose action. Depending on what the active face is (in the input_select), it switches between different actions.
Some sample code:

Face select
four_to_one:
      - service: input_select.select_option
        data:
          option: Music
        entity_id: input_select.active_cube_side

You’ve got to set it up for all x_to_y parts. Here’s the rotation part:

Rotate
rotate_right:
      - choose:
        - conditions:
          - condition: state
            entity_id: input_select.active_cube_side
            state: Music
          sequence:
          - service: media_player.volume_up
            data: {}
            entity_id: media_player.player_name
        - conditions:
          - condition: state
            entity_id: input_select.active_cube_side
            state: Lights
          sequence:
          - service: light.turn_on
            data:
              brightness_step_pct: 15
            entity_id: light.light_name

Hope this helps

2 Likes

@makistane
How do you check which face the cube is on to update the input_select helper to keep track of the active face?
In automation the only available triggers is “device slid/knocked/flipped with face 1 activated”

Quite happy that there is a blueprint for this device. So kuddos for making this!

I have owned this device since my Hubitat days and never really could find a good use-case scenario for this. Can folks share how they are using the cube in their home automations? Suggestions is appreciated!

I use the blueprint’s “From side x to side y” input to call the input_select.select_option service and change the input_select value. It sounds like you tried to make a new automation to handle this, but there is no need, everything can be done in the blueprint.

oh right, need to use automation through the blueprint.
did it a few days ago and already forgot i about it :smiley:

@makistane
Do you run all of cube functions from one automation? or do you split each function to its own different automation?

1 Like

I extended this to add actions for flipping to a specific side regardless of the side it was on before: ZHA - Aqara Magic Cube (57 actions)

Please help i really want to use this blueprint template but i have cc2531.

I have succesfully added aqara cube to Ha and i see the integration and maked some manual automation and it is workimg fine.

What do i replace thinks on this template to work all actions also with cc2531 ???

1 Like

(thank you for this blueprint)

I’m reporting that my logs fill up with warning messages like the one below every time a rotate event happens:

WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'flip_degrees' when rendering '{{ trigger.event.data.args.flip_degrees }}'

Correspondigly, the same log-warning is issued but for the relative_degrees key, when the cube is flipped.

The culprit is the blanket access of those trigger.event.data.args keys when setting up the initial variables.

A fix would be to check first that the key exists, like this:

action:

  - variables:
      ...
      flip_degrees:   ' {{ trigger.event.data.args.flip_degrees | default }}'
      relative_degrees: '{{ trigger.event.data.args.relative_degrees | default }}'

[edit: for a period of time i had suggested a conditional code, above, but reverted back to default filter after testing it]

Is there any possiblity that this fix can be applied?
(and if yes, do i need then to refresh my blueprints, somehow?)

1 Like

I am getting following error on trace
Error: UndefinedError: ‘dict object’ has no attribute ‘event’
I am using zha integration , device name LUMI lumi.sensor_cube
what I am missing ?

I believe this blueprint has a way to control what rotate does with respect to the side it’s on, but I could be wrong?