Blueprint to support the Xiaomi Cube Controller using ZHA. Thanks to @wmn79 for this inspiration.
Supported actions:
- Slide without respect to which face is up
- Slide with respect to which of the six faces are up
- Knock without respect to which face is up
- Knock with respect to which of the six faces are up
- Flip to any face
- Shake
- Drop
- Rotate clockwise
- Rotate counter-clockwise
Blueprint
Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)
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
# --------------------------- SLIDE ANY FACE ----------------------------
slide_any_face:
name: Slide the cube with any face up
default: []
selector:
action: {}
# --------------------------- SLIDE FACE 1 UP ----------------------------
slide_face_1:
name: Slide the cube with face 1 up
default: []
selector:
action: {}
# --------------------------- SLIDE FACE 2 UP ----------------------------
slide_face_2:
name: Slide the cube with face 2 up
default: []
selector:
action: {}
# --------------------------- SLIDE FACE 3 UP ----------------------------
slide_face_3:
name: Slide the cube with face 3 up
default: []
selector:
action: {}
# --------------------------- SLIDE FACE 4 UP ----------------------------
slide_face_4:
name: Slide the cube with face 4 up
default: []
selector:
action: {}
# --------------------------- SLIDE FACE 5 UP ----------------------------
slide_face_5:
name: Slide the cube with face 5 up
default: []
selector:
action: {}
# --------------------------- SLIDE FACE 6 UP ----------------------------
slide_face_6:
name: Slide the cube with face 6 up
default: []
selector:
action: {}
# --------------------------- KNOCK ANY FACE ----------------------------
knocked_any_face:
name: Knock the cube with any face up
default: []
selector:
action: {}
# --------------------------- KNOCK FACE 1 UP ----------------------------
knocked_face_1:
name: Knock the cube with face 1 up
default: []
selector:
action: {}
# --------------------------- KNOCK FACE 2 UP ----------------------------
knocked_face_2:
name: Knock the cube with face 2 up
default: []
selector:
action: {}
# --------------------------- KNOCK FACE 3 UP ----------------------------
knocked_face_3:
name: Knock the cube with face 3 up
default: []
selector:
action: {}
# --------------------------- KNOCK FACE 4 UP ----------------------------
knocked_face_4:
name: Knock the cube with face 4 up
default: []
selector:
action: {}
# --------------------------- KNOCK FACE 5 UP ----------------------------
knocked_face_5:
name: Knock the cube with face 5 up
default: []
selector:
action: {}
# --------------------------- KNOCK FACE 6 UP ----------------------------
knocked_face_6:
name: Knock the cube with face 6 up
default: []
selector:
action: {}
# --------------------------- FLIP ANY FACE ----------------------------
flipped_any_face:
name: Flip the cube to any face
default: []
selector:
action: {}
# --------------------------- FLIP FACE 1 UP ----------------------------
flipped_face_1:
name: Flip the cube to face 1
default: []
selector:
action: {}
# --------------------------- FLIP FACE 2 UP ----------------------------
flipped_face_2:
name: Flip the cube to face 2
default: []
selector:
action: {}
# --------------------------- FLIP FACE 3 UP ----------------------------
flipped_face_3:
name: Flip the cube to face 3
default: []
selector:
action: {}
# --------------------------- FLIP FACE 4 UP ----------------------------
flipped_face_4:
name: Flip the cube to face 4
default: []
selector:
action: {}
# --------------------------- FLIP FACE 5 UP ----------------------------
flipped_face_5:
name: Flip the cube to face 5
default: []
selector:
action: {}
# --------------------------- FLIP FACE 6 UP ----------------------------
flipped_face_6:
name: Flip the cube to face 6
default: []
selector:
action: {}
# -------------------------- SHAKE ----------------------------
shake:
name: Shake the cube
default: []
selector:
action: {}
# -------------------------- DROP ----------------------------
drop:
name: Drop the cube
default: []
selector:
action: {}
# ------------------------- ROTATE CLOCKWISE --------------------
rotate_cw:
name: Rotate cube clockwise
default: []
selector:
action: {}
# ---------------------------- ROTATE COUNTER CLOCKWISE ----------------------------
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.event }}'
sub_event: '{{ trigger.event.data.args.subtype }}'
- choose:
# ---------------------------- SLIDE ANY FACE ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ sub_event == "face_any" }}'
sequence: !input 'slide_any_face'
# ---------------------------- SLIDE FACE 1 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ sub_event == "face_1" }}'
sequence: !input 'slide_face_1'
# ---------------------------- SLIDE FACE 2 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ sub_event == "face_2" }}'
sequence: !input 'slide_face_2'
# ---------------------------- SLIDE FACE 3 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ sub_event == "face_3" }}'
sequence: !input 'slide_face_3'
# ---------------------------- SLIDE FACE 4 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ sub_event == "face_4" }}'
sequence: !input 'slide_face_4'
# ---------------------------- SLIDE FACE 5 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ sub_event == "face_5" }}'
sequence: !input 'slide_face_5'
# ---------------------------- SLIDE FACE 6 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ sub_event == "face_6" }}'
sequence: !input 'slide_face_6'
# ---------------------------- KNOCK ANY FACE ----------------------------
- conditions:
- '{{ event == "device_knocked" }}'
- '{{ sub_event == "face_any" }}'
sequence: !input 'knocked_any_face'
# ---------------------------- KNOCK FACE 1 ----------------------------
- conditions:
- '{{ event == "device_knocked" }}'
- '{{ sub_event == "face_1" }}'
sequence: !input 'knocked_face_1'
# ---------------------------- KNOCK FACE 2 ----------------------------
- conditions:
- '{{ event == "device_knocked" }}'
- '{{ sub_event == "face_2" }}'
sequence: !input 'knocked_face_2'
# ---------------------------- KNOCK FACE 3 ----------------------------
- conditions:
- '{{ event == "device_knocked" }}'
- '{{ sub_event == "face_3" }}'
sequence: !input 'knocked_face_3'
# ---------------------------- KNOCK FACE 4 ----------------------------
- conditions:
- '{{ event == "device_knocked" }}'
- '{{ sub_event == "face_4" }}'
sequence: !input 'knocked_face_4'
# ---------------------------- KNOCK FACE 5 ----------------------------
- conditions:
- '{{ event == "device_knocked" }}'
- '{{ sub_event == "face_5" }}'
sequence: !input 'knocked_face_5'
# ---------------------------- KNOCK FACE 6 ----------------------------
- conditions:
- '{{ event == "device_knocked" }}'
- '{{ sub_event == "face_6" }}'
sequence: !input 'knocked_face_6'
# ---------------------------- FLIP ANY FACE ----------------------------
- conditions:
- '{{ event == "device_flipped" }}'
- '{{ sub_event == "face_any" }}'
sequence: !input 'flipped_any_face'
# ---------------------------- FLIP FACE 1 ----------------------------
- conditions:
- '{{ event == "device_flipped" }}'
- '{{ sub_event == "face_1" }}'
sequence: !input 'flipped_face_1'
# ---------------------------- FLIP FACE 2 ----------------------------
- conditions:
- '{{ event == "device_flipped" }}'
- '{{ sub_event == "face_2" }}'
sequence: !input 'flipped_face_2'
# ---------------------------- FLIP FACE 3 ----------------------------
- conditions:
- '{{ event == "device_flipped" }}'
- '{{ sub_event == "face_3" }}'
sequence: !input 'flipped_face_3'
# ---------------------------- FLIP FACE 4 ----------------------------
- conditions:
- '{{ event == "device_flipped" }}'
- '{{ sub_event == "face_4" }}'
sequence: !input 'flipped_face_4'
# ---------------------------- FLIP FACE 5 ----------------------------
- conditions:
- '{{ event == "device_flipped" }}'
- '{{ sub_event == "face_5" }}'
sequence: !input 'flipped_face_5'
# ---------------------------- FLIP FACE 6 ----------------------------
- conditions:
- '{{ event == "device_flipped" }}'
- '{{ sub_event == "face_6" }}'
sequence: !input 'flipped_face_6'
# ---------------------------- SHAKE ----------------------------
- conditions:
- '{{ event == "device_shake" }}'
- '{{ sub_event == "turn_on" }}'
sequence: !input 'shake'
# ---------------------------- DROP ----------------------------
- conditions:
- '{{ event == "device_dropped" }}'
- '{{ sub_event == "turn_on" }}'
sequence: !input 'drop'
# ---------------------------- ROTATE CLOCKWISE ----------------------------
- conditions:
- '{{ event == "device_rotated" }}'
- '{{ sub_event == "right" }}'
sequence: !input 'rotate_cw'
# ---------------------------- ROTATE COUNTER CLOCKWISE ----------------------------
- conditions:
- '{{ event == "device_rotated" }}'
- '{{ sub_event == "left" }}'
sequence: !input 'rotate_ccw'