🧯 Zigbee2MQTT - Xiaomi Cube Controller

Hi all,

I can not find the sensor: sensor.xxYour_Hamexx_action
I can only see :

  • action side
  • action to side
  • action from side
  • action angle

How can I create a custom sensor with only action?

Make sure the action sensor is enabled.

Maybe my z2m config but I don’t understand why only 4 sensors are present and not 5

Above is looking at the Device in Home assistant. That is where you enable or disable entities for the device. I have the action enabled, and I have the other 4 disabled as I don’t use them.

You can’t really make one. It should be part of the presets for the Device as Z2M finds it.
I am assuming you are using current version of Z2m.
Does the firmware on your device match mine?

I am using the addon,

I’m not using add-on but docker version of Z2M

Is that docker container up to date?
Otherwise not sure what to say, your Z2M is not creating the sensor.
There is something called ‘action’ in that 2nd picture, I don’t know what that screen is however.

Z2M ui probably…

I have Legacy API enabled. Sometimes that setting messes with devices differently.


Same configuration for Legacy API.

Thank you very very much. fifth sensor is present now.

1 Like

What was it, may I ask.
In case others find the problem.

enabling of legacy API. It was disabled on my Z2M config.

I’ve just forgot to add “now” in my previous message about “Legacy API”

1 Like

I have fixed the Documentation to prevent this problem in the future. It is fixed on the Git Repo but I have not pushed it up to here yet because I anticipate other changes this week related to today’s 2022.4 release and the multiple entity selector.

Don’t forget to click the :orange_heart: in the top document if you find this useful.

2022-04-11: No Code Change. Added guidance to solve missing Action Sensor condition in this document.

In the Dimmer Control example, I think the second line above should be {% if new_brightness < 5 %}, right? I found that if the light was off (cb == 0), I couldn’t turn it on, until I made that change.

Setting it up to control my home theater lights, volume, and a few other things. Only issue I’m running into is if I pick up the cube and rotate it to a face (e.g. face #2 for volume control) and then put it down to rotate it, often it doesn’t pick up the face change, and thinks it’s still on face #1 (lights). I guess the cube expects to be “flipped” to a face while on a table, not picked up, rotate, and put back down.

Thanks for the blueprint fork! Having lots of fun with it…

Good catch. I’ll fix that right away.

Yes, my solution is to set it on another side and 90-it to the correct side. There is the 1 second delay so you can’t be too quick, though. Pop the entity sensor somewhere in a dashboard and move the cube around, you will see what works and what doesn’t

I did see a de-bounce setting in Z2M but haven’t played with it yet, that may help here. One of these days.

UPDATE: done…

  • Example code bug fix from Michael Fischer
    2022-04-17 - Added new blueprint link to the family
    2022-04-26 - Re-configure to add 30 Action Methods 74 total now…

!!NOTICE!! If you are upgrading the Blueprint, upgrade the template sensor as well. The variables are different…

New Update today… (27-APR-2022)

NO Blueprint CODE changes…

Just some scripts to show you how to add 24 more actions using some template magic. LOOK HERE…

  • 2022-04-26 update-A UPDATE: No code changes. Added examples to provide 24 more ways to trigger something using the rotate sensor as a device toggle, both long and short for each rotate sensor.

New Update today… (29-APR-2022)

NO Blueprint CODE changes…

WE ARE NOW AT ABOUT 128 WAYS TO TRIGGER, ( at least 128, maybe more… )

Just some scripts to show you how to add 30 more actions using some template magic. LOOK HERE…

  • 2022-04-26 update-B UPDATE: No code changes. Added examples to provide another 30 more ways to trigger something using conditionals in Group 3 :pear:,

Please Click the :orange_heart: at the end of the Top Post if you find this Useful


I got problem with importing blueprints. This is what I get:


looking into into it now.
Sorry, sir. I just imported it 2x and cannot replicate.

I am betting you have an old version of HA that does not know what the multiple is.
I just noticed that I did not lock out versions older than

    min_version: 2022.4.0

So I am adding that now. You should now get an error that you need to update HA…

Hello, I can’t get the automation to work.

The trace shows that it fails at the condition template at the beginning but I don’t understand why, here is the “Changed variable” information :

  entity_id: automation.aqara_magic_cube_zigbee2mqtt_2022_04_26
  state: 'on'
    last_triggered: '2022-05-05T23:40:18.659537+00:00'
    mode: single
    current: 0
    id: '1651792422338'
    friendly_name: Aqara Magic Cube Zigbee2MQTT - 2022-04-26
  last_changed: '2022-05-05T23:58:00.273312+00:00'
  last_updated: '2022-05-05T23:58:00.273312+00:00'
    id: 018096a8b451b854700e524ea4e71690
    parent_id: null
    user_id: null
  id: '0'
  idx: '0'
  platform: state
  entity_id: sensor.aqara_cube_salon_action
    entity_id: sensor.aqara_cube_salon_action
    state: ''
      icon: mdi:gesture-double-tap
      friendly_name: Aqara Cube - Salon action
    last_changed: '2022-05-06T00:06:37.296813+00:00'
    last_updated: '2022-05-06T00:06:37.296813+00:00'
      id: 018096b097f05413d086c4b94da96997
      parent_id: null
      user_id: null
    entity_id: sensor.aqara_cube_salon_action
    state: rotate_right
      icon: mdi:gesture-double-tap
      friendly_name: Aqara Cube - Salon action
    last_changed: '2022-05-06T00:06:37.785562+00:00'
    last_updated: '2022-05-06T00:06:37.785562+00:00'
      id: 018096b099d920ccc36cf85229c67c2d
      parent_id: null
      user_id: null
  for: null
  attribute: null
  description: state of sensor.aqara_cube_salon_action

There are some hints above. Legacy needs to be on so that the action sensor is available. Also you need at least HA Version 2022.4.0 for some of the other stuff to work.
Check over the issues that others had above and let me know if you still have a problem.

WOW… I spent all afternoon fighting this thing… Tearing my hair out I did…

There was a bug. I’m about to load 2022.5.1 and see if it’s fixed.


I had the same issues as above and updated to 2022.5.0 and checked legacy API in z2m (v1.25.0) before posting here.

I updated to 2022.5.1 now but same issue.

Not sure if I can get more debug information, that’s my first time using a blueprint.

Thank you for your time.

There’s another patch out today with another fix for it.
My HA has been in limbo fo 24hrs now due to ssl problems, I have not been able to test anything. But I assure you, if you copy the blueprint from the repo and paste it into a file manually, it will work. This is a HA problem causing everyone with selectors and some other items that have enum’s to not import… At least that’s that the release notes said today.