NOT WORKING CONSISTENTLY -- Xiaomi Cube Controller (ZHA)

Mind sending an example zha_event?

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "00:15:8d:00:02:9b:a0:98",
        "unique_id": "00:15:8d:00:02:9b:a0:98:2:0x0012",
        "device_id": "ca8d53a4350a45f3985b8e3c6d6d21a5",
        "endpoint_id": 2,
        "cluster_id": 18,
        "command": "knock",
        "args": {
            "value": 517,
            "description": "aqara logo facing user upside down",
            "activated_face": 3
        }
    },
    "origin": "LOCAL",
    "time_fired": "2021-01-10T16:18:25.554817+00:00",
    "context": {
        "id": "3c2733c6cc7326746ab6a32918449b6f",
        "parent_id": null,
        "user_id": null
    }
}

Seems identical ?

You and I have the same issue here. My event looks exactly like yours and Iā€™ve copied @vbfloā€™s blueprint, but still get nothing.

Do any of the actions work? I know you sent a knock example but can you try rotate since that is not face specific. See if we can try and narrow down the issue.

I used the ā€œany faceā€ option, but iā€™ve also tried with other action with the same resultā€¦

Odd, I donā€™t use any ā€œAny Faceā€ actions myself but all of my Knock, Flip and Rotate actions work fine. Trying to see if I added and system specific changes by mistake but I am at a bit of a loss. Any errors in the logs?

Another Question : I see that the people who use Deconz instead of ZHA have the ability to know wich face is up when rotating, itā€™s not possible with ZHA ?

1 Like

The rotate and shake work with me but the ā€˜flipped_any_faceā€™ doesnā€™t.
IThe face_side_x do work though.

For those who want extra actions for rotate depending on face, you can always create an input_number automation helper, and then have the flip actions set the number within that helper. The rotate action can then be a choice based on what face is up within the input_number.

Overall though, I also canā€™t really get all of this to work. Rotate events donā€™t seem to be firing and in general, before blueprints, I had lots of issues with ZHA and the cube.

Tried a bunch of different ways and have given up on flip any side. Best I can offer is to say and the same action to all flip events.

Hey there, still no time to dig into why this isnā€™t working, but I at least updated the subject of the post to indicate itā€™s not working. Hopefully Iā€™ll find time later.

Hi, I just ran into the same problem as everybody here as it seems. I rewrote it and its now also working with the recognition with side is up. I am using the current version of ZHA. Feel free to try it out and give me feedback. This was quite quick and dirty. https://gist.github.com/AlexKnowsIt/ef0aac7f11892b7273e8b07dcec1b4d6

Hi there,

great stuff and right around the corner. I presume you cannot have flip any side and the specific sides in one go. Iā€™s one or the other. The chooser will stop when crossing the first that matches.

Plus I donā€™t know if itā€™s dealbreaker but I reckon it is, multiple conditions need a condition: and/or statement.

Three changes in total:

  • removed faced variants
  • removed {} at the actions
  • added condition statements to represent AND

Adapted the version from above and hooray works very consistently now. If you want to have side specific slides, flips, knocks and whatever switch them out for the any variant and multiply.

blueprint:
  name: Aqara Magic Cube (ZHA)
  description: Control anything using Aqara Magic Cube (ZHA)
  domain: automation
  input:
    remote:
      name: Remote
      description: Magic Cube to use
      selector:
        device:
          integration: zha
          manufacturer: LUMI
          model: lumi.sensor_cube
    knocked_any_face:
      name: Knock the cube with any face up
      default: []
      selector:
        action:
    shake:
      name: Shake the cube
      default: []
      selector:
        action:
    flipped_90_any_face:
      name: 90 Flip the cube to any face
      default: []
      selector:
        action:
    flipped_180_any_face:
      name: 180 Flip the cube to any face
      default: []
      selector:
        action:
    slide_any_face:
      name: Slide the cube with any face up
      default: []
      selector:
        action:
    drop:
      name: Drop the cube
      default: []
      selector:
        action: {}
    rotate_cw:
      name: Rotate cube clockwise
      default: []
      selector:
        action:
    rotate_ccw:
      name: Rotate cube counter clockwise
      default: []
      selector:
        action:
mode: restart
max_exceeded: silent
trigger:
- platform: event
  event_type: zha_event
  event_data:
    device_id: !input 'remote'
action:
- variables:
    event: '{{ trigger.event.data.command }}'
    activated_face: '{{ trigger.event.data.args.activated_face }}'
    flip_degrees: '{{ trigger.event.data.args.flip_degrees }}'
    relative_degrees: '{{ trigger.event.data.args.relative_degrees }}'
- choose:
  - conditions:
    - '{{ event == "knock" }}'
    sequence: !input 'knocked_any_face'
  - conditions:
    - '{{ event == "shake" }}'
    sequence: !input 'shake'
  - conditions:
    - condition: and
      conditions:     
        - '{{ event == "flip" }}'
        - '{{ flip_degrees == 90 }}'
    sequence: !input 'flipped_90_any_face'
  - conditions:
    - condition: and
      conditions:   
        - '{{ event == "flip" }}'
        - '{{ flip_degrees == 180 }}'
    sequence: !input 'flipped_180_any_face'
  - conditions:
    - '{{ event == "slide" }}'
    sequence: !input 'slide_any_face'
  - conditions:
    - '{{ event == "drop" }}'
    sequence: !input 'drop'
  - conditions:
    - '{{ event == "rotate_right" }}'
    sequence: !input 'rotate_cw'
  - conditions:
    - '{{ event == "rotate_left" }}'
    sequence: !input 'rotate_ccw'

Thanks for the Feedback! I did not know about using multiple conditions like this in HA.
And youā€™re right you have to decide if you want it to be able to use all sides at once or a specific side. Nonetheless why do you think its not making sense to address the sides speicifically in the blueprint? For me personally this was one of the key benefits of using the cube instead of a remote and I think people who donā€™t know YAML could struggle to implement it by themselves.

And another question, what is the drop event? I was not able to reproduce this action.

I like to use the cube blindly. For instance in the bedroom of the kids. And to have faces work in practice you need mark the sides and then really look at it.
Guess itā€™s personal though.

Never used it. Seems very impractical. At what point would dropping the cube be helpful in remote controlling something.

For the ā€œdropā€ event to register the cube needs to fall about 12 inches I believe. You can toss it into the air and catch it with your hand or simply drop the cube into your lap while youā€™re sitting down.

But yeah that gesture is kind of gimmicky and impractical.

working alternative: Aqara Magic Cube ZHA (51 actions)

1 Like