ZHA - Aqara Magic Cube (57 actions)

I’m not able to import this blueprint, it says that it’s not formatted correctly.

No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax.

Fixed. The parser apparently didn’t like having anything after the blueprint code block. Moved the changelog to before. Thanks!

1 Like

Would it be possible to make ‘side 1 up’ and rotate left / right ??
And that for all sides possible??

So based on what side is up, and rotate left / right to trigger an action??

Thnx

Nope, unfortunately not. That information isn’t sent with the rotation event. See here.

I know, but isn’t it possible to set the state (side up) to a memory , and then add the rotation to the side up ?? I’m also trying to figure this out in node red …
So I can use like ‘side one’ to set volume of Sonos
Side 2 to to dim lights etc

2 Likes

I made some comments on that in a previous reply as well. In short: yes, it’s possible, no, it probably isn’t reliable. It’s at least not something that I think would be appropriate for the blueprint.

Setting different actions to rotate the cube on each side would be a really useful feature. Therefore, we bother you so much :sweat_smile:
I have no experience in programming, otherwise I would try to do everything myself. :slightly_smiling_face:
I noticed that many people manage to implement this function for example in deCONZ. It would be cool to implement it in zha too.
Since ZHA is easy to understand for novice users.

Here is an example of code in deCONZ.
The site was translated from RU to EN using google.

Here is the original RU page.

Maybe this will help someone to implement it also in ZHA.

Thank you for your patience and your efforts and sorry for the intrusiveness.

1 Like

I couldn’t find this mapping originally (didn’t search hard enough :stuck_out_tongue:) – maybe it’s worthwhile to put in the main post?

Aqara cube layout (sides):
         _______
        |       |
        |  #3   |
 _______|_______|_______
|       | AQARA |       |
|  #5   |  #1   |  #2   |
|_______|_______|_______|
        |       |
        |  #6   |
        |_______|
        |       |
        |  #4   |
        |_______|
3 Likes

I can’t get the face-specific knocks to work. It adds the correct YAML in automations.yaml, the zha_event is also correctly registered, but when knocking on the respective side - nothing happens.
The log output only has:

2021-08-01 10:24:55 INFO (MainThread) [homeassistant.components.automation.aqara_magic_cube_57_actions] Aqara Magic Cube (57 actions): Restarting
2021-08-01 10:24:55 INFO (MainThread) [homeassistant.components.automation.aqara_magic_cube_57_actions] Aqara Magic Cube (57 actions): Running automation actions
2021-08-01 10:24:55 INFO (MainThread) [homeassistant.components.automation.aqara_magic_cube_57_actions] Aqara Magic Cube (57 actions): Executing step setting variables

Compared with e.g. flip to a specific side:

2021-08-01 10:24:25 INFO (MainThread) [homeassistant.components.automation.aqara_magic_cube_57_actions] Aqara Magic Cube (57 actions): Restarting
2021-08-01 10:24:25 INFO (MainThread) [homeassistant.components.automation.aqara_magic_cube_57_actions] Aqara Magic Cube (57 actions): Running automation actions
2021-08-01 10:24:25 INFO (MainThread) [homeassistant.components.automation.aqara_magic_cube_57_actions] Aqara Magic Cube (57 actions): Executing step setting variables
2021-08-01 10:24:25 INFO (MainThread) [homeassistant.components.automation.aqara_magic_cube_57_actions] Aqara Magic Cube (57 actions): Choose at step 2: choice 8: Running automation actions
2021-08-01 10:24:25 INFO (MainThread) [homeassistant.components.automation.aqara_magic_cube_57_actions] Aqara Magic Cube (57 actions): Choose at step 2: choice 8: Choose at step 1: choice 1: Running automation actions
2021-08-01 10:24:25 INFO (MainThread) [homeassistant.components.automation.aqara_magic_cube_57_actions] Aqara Magic Cube (57 actions): Choose at step 2: choice 8: Choose at step 1: choice 1: Executing step call service

What am I missing? :thinking:

EDIT: Have looked into the actual “events” from the cube send. There is no trigger events when “turned arround in hand”, hence no way the blueprint can detect it. Sorry for not checking first.

This blueprint is perfect, however I have a issue with “people using the cube”

Im intending to use the “faceup” as a input for a number of other automations, like “daytime setting”, “Night time setting” and other “states the house can be in”. A small icon on each side and it will be easy for everybody to set the setting of the house. Even non-normal guests.

However, the cube does not always show the “flip to side”. It works if you flip to a side, however if people have the cube in the hand, turns it around to find the right side and then sets it on the table it does not work consistently.

The problem is that the cube sends a drop or turn command instead, and the “flip to side x” is not triggered.

Have anybody figured out how to remove all the other options, and only have a
“face side up” trigger. The flip to is perfect for this, if consistent.

EDIT: Have looked into the actual “events” from the cube send. There is no trigger events when “turned arround in hand”, hence no way the blueprint can detect it. Sorry for not checking first.

Great idea, and thank you! I’ve put it in the main post.

What am I missing? :thinking:

You’re missing absolutely nothing. I didn’t use that feature from the blueprint I extended, so I didn’t test it. Turns out that part was a bit buggy. I’ve fixed it and tested.

Hi, I have a question related to this blueprint. I want to fire an event when the cube is rotated, and in event_data for this event pass relative_degress to use it somewhere else. Is it possible and how to achieve it?

Good idea!

I just updated the blueprint to populate the relative_degrees variable from the event_data. You can use it in any service template. It’s a float, so it will have the full decimal precision from the zha event.

1 Like

Does anyone have this working with zigbee2mqtt?

1 Like

I have extended this blueprint to allow for per-side rotation actions using an input number helper to track the active side from the last flip action (so it does suffer from the shortcomings that brent mentioned).
This also includes an example for how to use relative_degrees in an automation.

1 Like

Hi, by using rvaidya blueprint I have developed another one, but in a much more simpler approach (only 24 actions, 6 sides * [rotate, flip, knock and slide])

ZHA - Aqara Magic Cube (24 actions)

Hi there,
I’ve an issue with creating an automation with this blueprint. I use MQTT. I paired the cube and it appears in my device list. I also see the events if I manipulate the cube.

But when I try to make an automation with the BP, I cannot select the cube for some reason. So far I never made an automation via a BP, so no idea what to do now.

Any suggestions?

I just setup my cube. Exact same thing. I have the cube in Home Assistant via Zigbee2MQTT. But i cannot select the cube in the blueprint.

This is made for ZHA, not Zigbee2MQTT.

ZHA performs checkin events for devices (see the ‘Logbook’), and when it does that for the Magic Cube, the automation using this blueprint is triggered. The cube itself is not generating events, and checkins for other devices exit fine.

When ZHA is checking for the cube however, there is an error in the core log at the exact same time:

Error in ‘choose[0]’ evaluation: In ‘template’ condition: TypeError: unsupported operand type(s) for +: ‘int’ and ‘str’

Do you see the same behavior?