๐Ÿ”˜

Aqara-Magic-Cube-T1-Pro-(CTP-R01) - 2024-06-04 by SirGoodenough

This Blueprint uses a Zigbee2MQTT built sensor to sort out the 58+ unique commands (118+ total) available from the Xiaomi Magic Cube Remote. (Some unique commands listed as + are not counted & available thru templating only. See the related document.)
NOTE: This blueprint is for the PRO cube version ONLY and is not fully compatible with the original version of the cube. Links for those are in my GIT repository.
This cube has an 'Action' mode (Shown below with this graphic: ๐Ÿซณ ACTION MODE ONLY ๐Ÿซณ )
and a 'Scene' mode (Shown below with this graphic: ๐Ÿ‘€ SCENE MODE ONLY ๐Ÿ‘€ ).
Make sure the cube is in the mode you think it is in when triggering it. The functions are separate. IE 'Action - slide' will do something different from 'Scene - slide'.
The split out of functions gives you the ability to assign local scripts or functions to do the things you want the remote to do.
Functions that are left empty will simply do nothing.

๐ŸŽ There is a set of 36 + 18 actions that will trigger on specific actions on specific sides that are listed as Group 1 ๐ŸŽ

๐Ÿ’ There is a set of 6 + 3 actions that will trigger on specific actions on ANY side that are listed as Group 2 ๐Ÿ’

๐Ÿ There is a set of 30 + 30 event functions that will trigger on cube flips to & from specific sides that are listed as Group 3 ๐Ÿ

๐Ÿ• There are 5 actions (shake & throw for each mode & hold in scene mode) that only occur once in each mode & are OK to be combined with any other group in that mode. Listed as Group 4 sections ๐Ÿ•.

Please be aware that ALL actions except the 4 listed above, ๐Ÿ• will trigger an action in ALL 3 groups in the matching mode at the same time every time. Therefore I suggest if you just have a couple of things you want this remote to do that you choose the ANY / Group 2 / ๐Ÿ’ events. Action events and Scene events are separate from each other.
If you want more than a few events, you should select actions in Group 1 / ๐ŸŽ OR Group 3 / ๐Ÿ.
With careful selection you can use mixed groups, but you run the risk of a single cube action triggering more than 1 Home Assistant action and making a mess of things ๐Ÿฑ.

NOTICE: This cube can be triggered 124 ways, but only 38(+54) of them are unique (with templating).

This blueprint has been known to freak out when there are spaces or odd characters in the MQTT Topic. Make sure there are no spaces, ONLY a single word, and ONLY A thru Z, a thru z, and 0 thru 9 in the topic. ( / is ok between device and topic) If there are, you will need to change the name of the cube to remove those characters.

IF YOU SEE --> TemplateError: Must provide a device or entity ID

If you get an error like that, The friendly_name in Z2M likely does not match the friendly_name on HA. To fix go into the Z2M Open web UI and set the friendly_name there. Setting this in just HA or in Z2M without ticking the update HA box will cause this. See the blueprint documentation page for details.

There is sample code to make the template sensor in the help file on GitHib named Zigbee2MQTT - Xiaomi Cube Controller MQTT Triggered.md & in the community page related to this.

Within this blueprint there is an event handler that will latch the last command that the blueprint finds and sends that to the event buss. From there a simple Template sensor can grab it and show you the last action sent. Thie will help when setting up new functions and to troubleshoot strange behaviours.

This was forked from https://community.home-assistant.io/t/z2m-xiaomi-cube-controller/263006 1.2 project authored by luckypoppy and the friends he pulled together to create the base. I sincerely thank Him (Them) for their work. I felt there needed to be more documentation for rookie users to properly set this up. I had quite a few questions and when I saw a few questions in that chat from people struggling, I wanted to help. I also had a better idea for troubleshooting info.

Community link for this blueprint

๐Ÿ—ฟNotice๐Ÿ‘ฎ๐Ÿฟโ€โ™‚๏ธ:

  • Copies of the original Blueprint that were converted via the 'Take Control' feature or other means are officially not supported by me.

  • I may or may not be able to support you when you have a problem after you make changes to my code, as some of the code is no longer mine.

  • I & my license also require attribution as a link back to the original should you use this code in your own creation.

  • Here is a link to my license & the original github post expected to be followed & referenced as attribution should you use this code elsewhere.

200
Stars
1.0K
Views
3.8K
Imports

Import to Home Assistant

Click to import this blueprint directly into your Home Assistant instance.

Configuration

Requires 30 inputs to configure

Source Code

View on GitHub

Details

Complexity
Complex
Author
SirGoodenough
Last Updated
Nov 4, 2025

Related Blueprints

More button actions automations you might like

View all
๐Ÿ”˜
Button Actions
complex
17 inputs

Send a mobile notification when add-on update is available

Send a mobile notification when add-on update is available

Send a notification to the provided mobile devices whenever an update for the given Home Assistant add-on is available. Supports full notification customization, notification groups, auto-dismissal when the add-on is updated and button for starting the update directly from your notification tray, with optional notification after the update completed succesfully. ๐Ÿ“• Full documentation regarding this blueprint is available here. ๐Ÿš€ This blueprint is part of the Awesome HA Blueprints project. โ„น๏ธ Version 2021.10.26
addon
text
entity
+2
1.2K1.6K2.5K
๐Ÿ”˜
Button Actions
complex
37 inputs

Controller - IKEA E1524/E1810 TRร…DFRI Wireless 5-Button Remote

Controller - IKEA E1524/E1810 TRร…DFRI Wireless 5-Button Remote

Controller automation for executing any kind of action triggered by the provided IKEA E1524/E1810 TRร…DFRI Wireless 5-Button Remote. Allows to optionally loop an action on a button long press. Supports deCONZ, ZHA, Zigbee2MQTT. Automations created with this blueprint can be connected with one or more Hooks supported by this controller. Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more. See the list of Hooks available for this controller for additional details.

More Info

โ„น๏ธ Version 2025.04.19 ๐Ÿ“ Changelog ๐Ÿ“• Full documentation regarding this blueprint is available here. ๐Ÿš€ This blueprint is part of the Awesome HA Blueprints project. Please consider leaving a star on GitHub! ๐ŸŒŸ
select
device
entity
+3
1.2K9.2K702
๐Ÿ”˜
Button Actions
complex
19 inputs

Controller - IKEA E1743 TRร…DFRI On/Off Switch & Dimmer

Controller - IKEA E1743 TRร…DFRI On/Off Switch & Dimmer

Controller automation for executing any kind of action triggered by the provided IKEA E1743 TRร…DFRI On/Off Switch & Dimmer. Allows to optionally loop an action on a button long press. Supports deCONZ, ZHA, Zigbee2MQTT. Automations created with this blueprint can be connected with one or more Hooks supported by this controller. Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more. See the list of Hooks available for this controller for additional details.

More Info

โ„น๏ธ Version 2025.04.19 ๐Ÿ“ Changelog ๐Ÿ“• Full documentation regarding this blueprint is available here. ๐Ÿš€ This blueprint is part of the Awesome HA Blueprints project. Please consider leaving a star on GitHub! ๐ŸŒŸ
select
device
entity
+3
1.2K1.7K786
๐Ÿ”˜
Button Actions
complex
15 inputs

Controller - IKEA E1744 SYMFONISK Rotary Remote

Controller - IKEA E1744 SYMFONISK Rotary Remote

Controller automation for executing any kind of action triggered by the provided IKEA E1744 SYMFONISK Rotary Remote. Allows to optionally loop a custom action during controller rotation. Supports deCONZ, ZHA, Zigbee2MQTT. Automations created with this blueprint can be connected with one or more Hooks supported by this controller. Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more. See the list of Hooks available for this controller for additional details.

More Info

โ„น๏ธ Version 2025.04.19 ๐Ÿ“ Changelog ๐Ÿ“• Full documentation regarding this blueprint is available here. ๐Ÿš€ This blueprint is part of the Awesome HA Blueprints project. Please consider leaving a star on GitHub! ๐ŸŒŸ
select
device
entity
+3
1.2K6.0K4.8K
๐Ÿ”˜
Button Actions
complex
13 inputs

Controller - IKEA E1766 TRร…DFRI Open/Close Remote

Controller - IKEA E1766 TRร…DFRI Open/Close Remote

Controller automation for executing any kind of action triggered by the provided IKEA E1766 TRร…DFRI Open/Close Remote. Supports deCONZ, ZHA, Zigbee2MQTT. Automations created with this blueprint can be connected with one or more Hooks supported by this controller. Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more. See the list of Hooks available for this controller for additional details.

More Info

โ„น๏ธ Version 2025.04.19 ๐Ÿ“ Changelog ๐Ÿ“• Full documentation regarding this blueprint is available here. ๐Ÿš€ This blueprint is part of the Awesome HA Blueprints project. Please consider leaving a star on GitHub! ๐ŸŒŸ
select
device
entity
+3
1.2K10.6K4.0K