Hello guys,
recently I got an Aqara Cube T1 Pro - for some reason I thought it is a button but what the hell, I kept it and now I am trying to get the most of it. I created an automation which is dimming the lights (rotate), randomly changes their colour (shake) and restarting their initial state (hold). Fourth should do some kind of pre-set settings depending on the side of the cube facing up. I believe it is “flip_to_side” action but it seems it is more or less random behaviour.
Maybe it’s me who cannot use the cube properly but the automation when changing sides never do what it should, well in 1:6 it does
Can you, please, check my automation if there is anything wrong? When checking traces it never goes to the second check which side is up but it still do something.
alias: svetlo_jidelni_stul
description: ""
triggers:
- topic: zigbee2mqtt/tesseract
trigger: mqtt
conditions: []
actions:
- choose:
- conditions:
- condition: and
conditions:
- condition: state
entity_id: light.svetlo_kuchyn_stul
state: "on"
- condition: state
entity_id: light.svetlo_kuchyn_ledpasek_linka
state: "on"
- condition: template
value_template: >-
{{ trigger.payload_json.action in ['rotate_right',
'rotate_left'] }}
sequence:
- if:
- condition: template
value_template: >-
{{ (states.light.svetlo_kuchyn_stul.attributes.brightness +
trigger.payload_json.action_angle | int) > 0 and
(states.light.svetlo_kuchyn_ledpasek_linka.attributes.brightness
+ trigger.payload_json.action_angle | int) > 0}}
then:
- data:
brightness_step: "{{trigger.payload_json.action_angle | int}}"
target:
entity_id:
- light.svetlo_kuchyn_stul
- light.svetlo_kuchyn_ledpasek_linka
action: light.turn_on
else:
- data:
brightness_pct: 10
target:
entity_id:
- light.svetlo_kuchyn_stul
- light.svetlo_kuchyn_ledpasek_linka
action: light.turn_on
- conditions:
- condition: template
value_template: "{{ trigger.payload_json.action == \"shake\" }}"
sequence:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- "{{ range(0, 255) | random }}"
- "{{ range(0, 255) | random }}"
- "{{ range(0, 255) | random }}"
target:
entity_id:
- light.svetlo_kuchyn_ledpasek_linka
- light.svetlo_kuchyn_stul
alias: nahodna_barva
- conditions:
- condition: template
value_template: "{{ trigger.payload_json.action == \"hold\" }}"
enabled: true
sequence:
- action: light.turn_off
metadata: {}
data: {}
target:
entity_id:
- light.svetlo_kuchyn_ledpasek_linka
- light.svetlo_kuchyn_stul
- delay:
hours: 0
minutes: 0
seconds: 1
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id:
- light.svetlo_kuchyn_ledpasek_linka
- light.svetlo_kuchyn_stul
alias: restart
- conditions:
- condition: template
value_template: "{{ trigger.payload_json.action == \"flip_to_side\" }}"
sequence:
- choose:
- conditions:
- condition: template
value_template: "{{is_state('sensor.tesseract_side', '1')}}"
sequence:
- action: light.turn_off
metadata: {}
data: {}
target:
entity_id:
- light.svetlo_kuchyn_stul
- light.svetlo_kuchyn_ledpasek_linka
- conditions:
- condition: template
value_template: "{{is_state('sensor.tesseract_side', '2')}}"
sequence:
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.svetlo_kuchyn_stul
- conditions:
- condition: template
value_template: "{{is_state('sensor.tesseract_side', '3')}}"
sequence:
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id:
- light.svetlo_kuchyn_ledpasek_linka
- light.svetlo_kuchyn_stul
- conditions:
- condition: template
value_template: "{{is_state('sensor.tesseract_side', '4')}}"
sequence:
- action: light.turn_on
metadata: {}
data:
kelvin: 2000
brightness_pct: 1
target:
entity_id:
- light.svetlo_kuchyn_ledpasek_linka
- light.svetlo_kuchyn_stul
- conditions:
- condition: template
value_template: "{{is_state('sensor.tesseract_side', '5')}}"
sequence:
- action: light.turn_on
metadata: {}
data:
kelvin: 2000
brightness_pct: 100
target:
entity_id:
- light.svetlo_kuchyn_ledpasek_linka
- light.svetlo_kuchyn_stul
- conditions:
- condition: template
value_template: "{{is_state('sensor.tesseract_side', '6')}}"
sequence:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 210
- 32
- 223
brightness_pct: 50
target:
entity_id:
- light.svetlo_kuchyn_ledpasek_linka
- light.svetlo_kuchyn_stul
mode: single