🧯 Zigbee2MQTT - Xiaomi Cube Controller

I’ll have to see what I have different on mine…

OK. I have left legacy stuff on. When I look at MQTT-explorer the topic zigbee2mqtt/yertle (which is the cube name and is the topic I’m using to grab the changes) has the angle as an attribute. I see it, mine is working.


What are you seeing?
What topic are you using?
If you are using the equiv of zigbee2mqtt/yertle/action, that won’t work.


This is the script I’m using…

I have turned on all Legacy settings:

It seems that I’m not getting the “angle” payload piece. I get the action_angle though:


I am using the cube name (Cube1) as the topic:

And again, it looks like “angle” isn’t included in the payload as it is in yours.

Maybe I could use “action_angle” as the input?

EDIT: Sure enough, "changing the code to use ‘{{ trigger.payload_json.action_angle }}’ has it working as expected. :man_shrugging:

I’m having the same exact issue.

This is my automation from the blueprint: dpaste/XtSiD (YAML)

home assistant log errors: Imgur: The magic of the Internet

I looked in mqtt explorer and see the mqtt messages showing it working for shake, tap etc. I also see the home assistant actions showing the expected actions. There’s some issue with the blueprint that home assistant doesn’t like and throws those errors in the log.

I just tried the shake action to control an area with light.toggle like you did… it works for me OK

      - service: light.toggle
        data: {}
          area_id: office

The only difference I see from your example is my area is using a friendly name, and my Cube name contains no spaces.

For light.toggle, entity_id is a required parameter…

I don’t see where it talks about area toggles. But if it worked with a name, I would go with that.

What’s your cube model or firmware and version / type of Z2M. If I need to change it I can, trying to figure out exactly why, however. I also have action_angle, but was weird about using it because it goes to null sometimes. Maybe it’s right when it needs to be, but that would need to be tested.

My cube reports as: MFKZQ01LM
I’m not sure how to extract the firmware version.
Z2M running in HASS, directly installed on Raspberry Pi with Sonoff 3.0 USB dongle:


I changed this specific setting in Z2M settings for the cube (it was un-set before):

And suddenly, I get this:


Success! I guess I should leave all the other Legacy things enabled as well? Everything seems to work with my other Zigbee devices.

1 Like

I deleted everything and started fresh and changed the name in z2m to one with no spaces and it all works. Thanks for the help and man what a great blueprint I really appreciate it!

1 Like

Well it’s a good thing to know that a space in the topic is bad. I will add that to the instructions. Thanks for contributing!

OK, so it’s another legacy attribute. I will check it all over and adjust things. Thanks for contributing. I will have another version in a day or 2 . All the changes likely to be documentation.

Thank you so much James! I’m happy to help however I can :slight_smile:

Added bug fixes from above 2 problems
Profile - brainhig - Home Assistant Community
Profile - bharvey88 - Home Assistant Community

  • 2022-12-22: Change instances of the attribute angle to action_angle to fix non-legacy bug.
    • Add note not to use spaces and non alpha in MQTT topics.
1 Like

Hi sorry, I’ve been scanning this thread for weeks and trying to figure this out.

  1. I have zigbee2mqtt and the aqara cube is shown

  2. I installed the blueprint.

but literally nothing happens. I’m trying to keep it simple with just 1 thing ; to see how this works.
How can I further investigate this to provide helpful questions for experts here ?

The blueprint has had 3 revisions since 2022-12-01, so I don’t know what version you are running.
I also need to see your automation yaml to know anything.
There is an extensive write-up about how it works and what is needed to get you started. This is literally a switch with a hundred places to toggle it.
Also there is the description about the event sensor that I wrote in here to help you get oriented on using the cube. Have you tried setting that up?

I need more info to help you.

Hi @Sir_Goodenough , thx for all the work you have put into this Blueprint. I have an issue I am hoping you can help me with.

Imported the latest version of blueprint
Created Automation (added my cube MQTT topic) and just Group 1 action Double tab the cube with gace 0 up
It is to activate a scene

When I double tap the Cube, I see this in the Logs:
Error while executing automation automation.magic_cube_automations: TemplateError: Must provide a device or entity ID

Here is my Automation yml

alias: Magic Cube Automations
description: Automatons related to Magic Cube
  path: SirGoodenough/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml
    topic: zigbee2mqtt/Magic_Cube
      - service: scene.turn_on
          entity_id: scene.all_lights_off
        metadata: {}

Thank you!

I have not used scenes in my set-up at all, but I would expect that they work.
The complication here is, is the scene working. I would test that the scene command you are using works outside of the blueprint, maybe call it up in developer tools. Open your Home Assistant instance and show your service developer tools.
I would also test things by using light / switch toggle to control a single light / switch, just to get you going.

I changed the action to call service with light off , still get the same error in the logs. TemplateError: Must provide a device or entity ID

Removed the Automation and BluePrint, re added BP, then automation with call service, even changed the automation name(just in case) still same error in Logs !

@Sir_Goodenough got it working!!! lool, It was the device name, after seeing your note about spaces, I changed it to “Magic_Cube” … I guess “_” is still a no, changed device to Magic and everything is working now!!!

I thought underscore would be fine. I guess not… Good catch.
I did some further testing, and found if the friendly_name in HA doesn’t match the friendly_name and topic in Z2M, you get this error.
Therefore I added some pictures and text to show how to fix and avoid this problem. I also cleaned up a little of the discovery code…

  • 2022-12-28: Code cleanup.
    • Add note to fix configuration conflict template error:
    • Error while executing automation automation.friendly_name_automations: TemplateError: Must provide a device or entity ID