Last active
January 30, 2024 16:02
-
-
Save cvroque/0a7fcdd414ff366460353aef2a5e25db to your computer and use it in GitHub Desktop.
Xiaomi Gateway 3 - Aqara Magic Cube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Aqara Magic Cube with Xiaomi Gateway 3 | |
description: | | |
## Aqara Magic Cube with Xiaomi Gateway 3 | |
Basic blueprint for executing supported actions with the Aqara Magic Cube and Xiaomi Gateway 3 using default firmware. | |
Supports the following actions: | |
- Wake | |
- Double Tap | |
- Move | |
- Drop | |
- Shake | |
- Flip 90˚ | |
- Flip 180˚ | |
- Rotate Right | |
- Rotate Left | |
### Requirements: | |
- [Xiaomi Gateway 3 Integration][1] v2.0.0+ | |
- Official Firmware for the Gateway | |
- Paired Aqara Magic Cube | |
[1]: https://github.com/AlexxIT/XiaomiGateway3 | |
domain: automation | |
source_url: https://gist.github.com/cvroque/0a7fcdd414ff366460353aef2a5e25db#file-aqara_cube_for_xiaomi_gateway3-yaml | |
input: | |
trigger_entity: | |
name: Aqara Magic Cube | |
description: Choose Aqara Cube Action entity | |
selector: | |
entity: | |
domain: sensor | |
integration: xiaomi_gateway3 | |
alert: | |
name: Wake | |
description: Actions to run when cube wakes up (idle and you tap it) | |
default: [] | |
selector: | |
action: {} | |
tap_twice: | |
name: Double Tap | |
description: Actions to run when cube is tapped twice (hold it with your hands and tap it twice the table) | |
default: [] | |
selector: | |
action: {} | |
move: | |
name: Move | |
description: Actions to run when cube is moved (slide in any direction) | |
default: [] | |
selector: | |
action: {} | |
free_fall: | |
name: Drop | |
description: Actions to run when cube is dropped (throw in the air and catch) | |
default: [] | |
selector: | |
action: {} | |
shake_air: | |
name: Shake | |
description: Actions to run when cube is shaked (hold in your hands and shake) | |
default: [] | |
selector: | |
action: {} | |
flip90: | |
name: Flip 90º | |
description: Actions to run when cube is flipped 90 degrees (flipped to any side) | |
default: [] | |
selector: | |
action: {} | |
flip180: | |
name: Flip 180º | |
description: Actions to run when cube is flipped 180 degrees (flipped to the previous bottom side) | |
default: [] | |
selector: | |
action: {} | |
rotate_right: | |
name: Rotate Right | |
description: Actions to run when cube is rotated right (turned clockwise) | |
default: [] | |
selector: | |
action: {} | |
rotate_left: | |
name: Rotate Left | |
description: Actions to run when cube is rotated left (turned counter clockwise) | |
default: [] | |
selector: | |
action: {} | |
variables: | |
action: '{{ trigger.to_state.state }}' | |
trigger: | |
- platform: state | |
entity_id: !input trigger_entity | |
condition: [] | |
action: | |
- choose: | |
- conditions: | |
- "{{ action == 'wakeup' }}" | |
sequence: !input "alert" | |
- conditions: | |
- "{{ action == 'tap' }}" | |
sequence: !input "tap_twice" | |
- conditions: | |
- "{{ action == 'slide' }}" | |
sequence: !input "move" | |
- conditions: | |
- "{{ action == 'fall' }}" | |
sequence: !input "free_fall" | |
- conditions: | |
- "{{ action == 'shake' }}" | |
sequence: !input "shake_air" | |
- conditions: | |
- "{{ action == 'flip90' }}" | |
sequence: !input "flip90" | |
- conditions: | |
- "{{ action == 'flip180' }}" | |
sequence: !input "flip180" | |
- conditions: | |
- "{{ action == 'rotate' }}" | |
- condition: numeric_state | |
entity_id: !input trigger_entity | |
attribute: angle | |
above: '0' | |
sequence: !input "rotate_right" | |
- conditions: | |
- "{{ action == 'rotate' }}" | |
- condition: numeric_state | |
entity_id: !input trigger_entity | |
attribute: angle | |
below: '0' | |
sequence: !input "rotate_left" | |
default: [] | |
mode: queued | |
max_exceeded: silent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment