Skip to content

Instantly share code, notes, and snippets.

@farridav
Last active January 8, 2024 13:50
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 farridav/1ed8632a0fdcd2427a3476190b9790a5 to your computer and use it in GitHub Desktop.
Save farridav/1ed8632a0fdcd2427a3476190b9790a5 to your computer and use it in GitHub Desktop.
simple blueprint for aqara cube
blueprint:
name: Aqara Magic Cube [Simple] (Z2M)
description: Aqara Magic Cube [Simple] (Z2M)
domain: automation
input:
cube:
name: Aqara Magic Cube action
description: Aqara Magic Cube to use
selector:
entity:
integration: mqtt
domain:
- sensor
multiple: false
flipped90:
name: Flip the cube 90 degrees
default: []
selector:
action: {}
flipped180:
name: Flip the cube 180 degrees
default: []
selector:
action: {}
throw:
name: Throw the cube
default: []
selector:
action: {}
slide:
name: Slide the cube
default: []
selector:
action: {}
tap:
name: Tap the cube
default: []
selector:
action: {}
rotate_cw:
name: Rotate cube clockwise
default: []
selector:
action: {}
rotate_ccw:
name: Rotate cube counter clockwise
default: []
selector:
action: {}
shake:
name: Shake the cube
default: []
selector:
action: {}
fall:
name: Drop the cube
default: []
selector:
action: {}
mode: queued
max: 5
max_exceeded: silent
trigger:
- platform: state
entity_id: !input cube
condition:
- condition: template
value_template: '{{ trigger.to_state.state in ("shake", "throw", "fall", "tap", "slide", "flip180", "flip90", "rotate_left", "rotate_right") }}'
action:
- variables:
action: "{{ trigger.to_state.state }}"
- choose:
- conditions: '{{ action == "slide" }}'
sequence: !input slide
- conditions: '{{ action == "tap" }}'
sequence: !input tap
- conditions: '{{ action == "flip90" }}'
sequence: !input flipped90
- conditions: '{{ action == "flip180" }}'
sequence: !input flipped180
- conditions: '{{ action == "rotate_right" }}'
sequence: !input rotate_cw
- conditions: '{{ action == "rotate_left" }}'
sequence: !input rotate_ccw
- conditions: '{{ action == "shake" }}'
sequence: !input shake
- conditions: '{{ action == "fall" }}'
sequence: !input fall
- conditions: '{{ action == "throw" }}'
sequence: !input throw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment