Skip to content

Instantly share code, notes, and snippets.

@AlexKnowsIt
Last active January 19, 2021 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexKnowsIt/ef0aac7f11892b7273e8b07dcec1b4d6 to your computer and use it in GitHub Desktop.
Save AlexKnowsIt/ef0aac7f11892b7273e8b07dcec1b4d6 to your computer and use it in GitHub Desktop.
Control your Aqara Cube via Blueprints
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.command }}'
sub_event: '{{ trigger.event.data.args.description }}'
face: '{{ trigger.event.data.args.activated_face }}'
- choose:
# ---------------------------- SLIDE ANY FACE ----------------------------
- conditions:
- '{{ event == "slide" }}'
sequence: !input 'slide_any_face'
# ---------------------------- SLIDE FACE 1 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ face == "1" }}'
sequence: !input 'slide_face_1'
# ---------------------------- SLIDE FACE 2 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ face == "2" }}'
sequence: !input 'slide_face_2'
# ---------------------------- SLIDE FACE 3 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ face == "3" }}'
sequence: !input 'slide_face_3'
# ---------------------------- SLIDE FACE 4 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ face == "4" }}'
sequence: !input 'slide_face_4'
# ---------------------------- SLIDE FACE 5 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ face == "5" }}'
sequence: !input 'slide_face_5'
# ---------------------------- SLIDE FACE 6 ----------------------------
- conditions:
- '{{ event == "slide" }}'
- '{{ face == "6" }}'
sequence: !input 'slide_face_6'
# ---------------------------- KNOCK ANY FACE ----------------------------
- conditions:
- '{{ event == "knock" }}'
sequence: !input 'knocked_any_face'
# ---------------------------- KNOCK FACE 1 ----------------------------
- conditions:
- '{{ event == "knock" }}'
- '{{ face == "1" }}'
sequence: !input 'knocked_face_1'
# ---------------------------- KNOCK FACE 2 ----------------------------
- conditions:
- '{{ event == "knock" }}'
- '{{ face == "2" }}'
sequence: !input 'knocked_face_2'
# ---------------------------- KNOCK FACE 3 ----------------------------
- conditions:
- '{{ event == "knock" }}'
- '{{ face == "3" }}'
sequence: !input 'knocked_face_3'
# ---------------------------- KNOCK FACE 4 ----------------------------
- conditions:
- '{{ event == "knock" }}'
- '{{ face == "4" }}'
sequence: !input 'knocked_face_4'
# ---------------------------- KNOCK FACE 5 ----------------------------
- conditions:
- '{{ event == "knock" }}'
- '{{ face == "5" }}'
sequence: !input 'knocked_face_5'
# ---------------------------- KNOCK FACE 6 ----------------------------
- conditions:
- '{{ event == "knock" }}'
- '{{ face == "6" }}'
sequence: !input 'knocked_face_6'
# ---------------------------- FLIP ANY FACE ----------------------------
- conditions:
- '{{ event == "flip" }}'
sequence: !input 'flipped_any_face'
# ---------------------------- FLIP FACE 1 ----------------------------
- conditions:
- '{{ event == "flip" }}'
- '{{ face == "1" }}'
sequence: !input 'flipped_face_1'
# ---------------------------- FLIP FACE 2 ----------------------------
- conditions:
- '{{ event == "flip" }}'
- '{{ face == "2" }}'
sequence: !input 'flipped_face_2'
# ---------------------------- FLIP FACE 3 ----------------------------
- conditions:
- '{{ event == "flip" }}'
- '{{ face == "3" }}'
sequence: !input 'flipped_face_3'
# ---------------------------- FLIP FACE 4 ----------------------------
- conditions:
- '{{ event == "flip" }}'
- '{{ face == "4" }}'
sequence: !input 'flipped_face_4'
# ---------------------------- FLIP FACE 5 ----------------------------
- conditions:
- '{{ event == "flip" }}'
- '{{ face == "5" }}'
sequence: !input 'flipped_face_5'
# ---------------------------- FLIP FACE 6 ----------------------------
- conditions:
- '{{ event == "flip" }}'
- '{{ face == "6" }}'
sequence: !input 'flipped_face_6'
# ---------------------------- SHAKE ----------------------------
- conditions:
- '{{ event == "shake" }}'
sequence: !input 'shake'
# ---------------------------- DROP ----------------------------
- conditions:
- '{{ event == "device_dropped" }}'
- '{{ sub_event == "turn_on" }}'
sequence: !input 'drop'
# ---------------------------- ROTATE CLOCKWISE ----------------------------
- conditions:
- '{{ event == "rotate_right" }}'
sequence: !input 'rotate_cw'
# ---------------------------- ROTATE COUNTER CLOCKWISE ----------------------------
- conditions:
- '{{ event == "rotate_left" }}'
sequence: !input 'rotate_ccw'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment