Thanks for the blueprint, works well. Xiaomi Gateway 3 Custom Integration it’s released to v2.0 with more action option for the cube.
Could you update the blueprint?
Hey, I had some busy days, and you were right! A lot of stuff had stopped working. My most used (rotate and flip) were fine, but now I also fixed: wake up, slide, tapping, shaking and falling.
Yes, I’m working on adding it, but it’s a lot of actions and complexity. I also want to be able to rotate based on side to change TV volume or lights brightness.
Hi,
I added slide and double tap on all sides, and now it’s been 19 actions. I’m going to add the flip90° and flip180° but it’s a lot of work. Wake Up, rotate, free fall and shake haven’t the infos for sides, impossible to exploit.
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
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_side0:
name: Double Tap Side 0 Aqara Logo
description: Actions to run when cube is tapped twice (hold it with your hands and tap it twice the table)
default: []
selector:
action: {}
tap_twice_side1:
name: Double Tap Side 1
description: Actions to run when cube is tapped twice (hold it with your hands and tap it twice the table)
default: []
selector:
action: {}
tap_twice_side2:
name: Double Tap Side 2
description: Actions to run when cube is tapped twice (hold it with your hands and tap it twice the table)
default: []
selector:
action: {}
tap_twice_side3:
name: Double Tap Side 3
description: Actions to run when cube is tapped twice (hold it with your hands and tap it twice the table)
default: []
selector:
action: {}
tap_twice_side4:
name: Double Tap Side 4
description: Actions to run when cube is tapped twice (hold it with your hands and tap it twice the table)
default: []
selector:
action: {}
tap_twice_side5:
name: Double Tap Side 5
description: Actions to run when cube is tapped twice (hold it with your hands and tap it twice the table)
default: []
selector:
action: {}
move_side0:
name: Move Side 0 Aqara Logo
description: Actions to run when cube is moved (slide in any direction)
default: []
selector:
action: {}
move_side1:
name: Move Side 1
description: Actions to run when cube is moved (slide in any direction)
default: []
selector:
action: {}
move_side2:
name: Move Side 2
description: Actions to run when cube is moved (slide in any direction)
default: []
selector:
action: {}
move_side3:
name: Move Side 3
description: Actions to run when cube is moved (slide in any direction)
default: []
selector:
action: {}
move_side4:
name: Move Side 4
description: Actions to run when cube is moved (slide in any direction)
default: []
selector:
action: {}
move_side5:
name: Move Side 5
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' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
below: '1'
sequence: !input "tap_twice_side0"
- conditions:
- "{{ action == 'tap' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
above: '0'
below: '2'
sequence: !input "tap_twice_side1"
- conditions:
- "{{ action == 'tap' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
above: '1'
below: '3'
sequence: !input "tap_twice_side2"
- conditions:
- "{{ action == 'tap' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
above: '2'
below: '4'
sequence: !input "tap_twice_side3"
- conditions:
- "{{ action == 'tap' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
above: '3'
below: '5'
sequence: !input "tap_twice_side4"
- conditions:
- "{{ action == 'tap' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
above: '4'
below: '6'
sequence: !input "tap_twice_side5"
- conditions:
- "{{ action == 'slide' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
below: '1'
sequence: !input "move_side0"
- conditions:
- "{{ action == 'slide' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
above: '0'
below: '2'
sequence: !input "move_side1"
- conditions:
- "{{ action == 'slide' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
above: '1'
below: '3'
sequence: !input "move_side2"
- conditions:
- "{{ action == 'slide' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
above: '2'
below: '4'
sequence: !input "move_side3"
- conditions:
- "{{ action == 'slide' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
above: '3'
below: '5'
sequence: !input "move_side4"
- conditions:
- "{{ action == 'slide' }}"
- condition: numeric_state
entity_id: !input 'trigger_entity'
attribute: side
above: '4'
below: '6'
sequence: !input "move_side5"
- 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
Hello friend, nice work. My daughter arrived this week and I didn’t get a minute to sit at my computer, but we can keep track of sides using an helper outside the automation, such as a input number.
Hello, I would like to use this blueprints, but I have the first generation of Xiaomi Gateway with Mi Cube.
Do you think it’s possible to adapt this blueprint with this gateway ?
The integration used is “xiaomi_aqara”, the cube is a “binary_sensor” entity with attributes :
last_action: shake_air, rotate etc…
voltage: xxx
battery_level: xx
friendly_name: xxxx
Thanks in advance for your reply and tell me if it’s possible to adapt this blueprint by editig yaml