Blueprint to automate the Aqara Magic Cube using ZHA.
Based on rvaidya ZHA - Aqara Magic Cube (69 actions) .
This blueprint supports rotating the cube per specific side, but in a much more simpler approach. Only 24 actions (6 sides * [rotate, flip, knock and slide]). Rotate returns positive or negative values depending on the direction.
This blueprint adds support for rotating the cube per specific side, by using an Input Text helper to track the side that was last activated by a side-specific action (flip, slide, knock).
Note that since this blueprint uses an input number helper to track which side is active, it will only register side changes from valid side actions (again, flip/knock/slide). If you lift the cube, rotate it freely, and then place it down on a different side, this is not registered as a valid action and the tracking variable won’t be updated.
The input number helper will need to be created independently in HomeAssistant, by going to Configuration → Helpers in the UI and adding a new “Input Text Helper”.
Supported actions
- Slide (6 sides)
- Rotate (6 sides)
- Knock (6 sides)
- Flip (6 sides)
This is an example of an automation. It dims a bulb only from side 1:
alias: Cube actions
use_blueprint:
path: miguellobato84/zha-aqara-magic-cube.yaml
input:
remote: de7540b873b6e241ae1157c155ed1e1f
helper_last_face: input_text.cube_current_side
rotate_1:
- service: light.turn_on
target:
device_id: 48babe39343fa4a3d2f82aed449ffd65
data:
brightness_step: '{{ relative_degrees | float }}'