Last active
July 26, 2020 17:30
-
-
Save Kagee/7d9966abddc9a745d4110a179c8a112b to your computer and use it in GitHub Desktop.
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
- id: 'cube-toggle-office' | |
alias: Toggle lights on double tap | |
description: 'Toggle lights on double tap (desc)' | |
trigger: | |
- event_data: | |
gesture: 6 | |
id: mi_magic_cube | |
event_type: deconz_event | |
platform: event | |
condition: | |
condition: template | |
value_template: > | |
{% set side = trigger.event.data.event // 1000 %} | |
{% set side_ctemp = ({ 1:"153", 3:"326", 6:"500" }) %} | |
{{ side in side_ctemp}} | |
action: | |
- service: light.toggle | |
entity_id: light.skrivebordslys | |
data: | |
brightness: 255 | |
data_template: | |
color_temp: > | |
{% set side = trigger.event.data.event // 1000 %} | |
{% set side_ctemp = ({ 1:"153", 3:"326", 6:"500" }) %} | |
{{ side_ctemp[side] }} | |
- id: 'cube-set-color-temp' | |
alias: Set color temp based on cube side | |
description: 'Set solor temp based on cube side (desc)' | |
trigger: | |
- platform: event | |
event_type: deconz_event | |
event_data: | |
id: mi_magic_cube | |
condition: | |
condition: template | |
value_template: > | |
{% set side = trigger.event.data.event // 1000 %} | |
{% set gesture_ops = ({ 3:"90 deg", 4:"180 deg" }) %} | |
{% set side_ctemp = ({ 1:"153", 3:"326", 6:"500" }) %} | |
{{ side in side_ctemp and trigger.event.data.gesture in gesture_ops }} | |
action: | |
- service: light.turn_on | |
entity_id: light.skrivebordslys | |
data_template: | |
color_temp: > | |
{% set side = trigger.event.data.event // 1000 %} | |
{% set side_ctemp = ({ 1:"153", 3:"326", 6:"500" }) %} | |
{{ side_ctemp[side] }} | |
brightness: > | |
{% set old_bt = state_attr('light.skrivebordslys', 'brightness') %} | |
{% if old_bt < 3 %} | |
255 | |
{% else %} | |
{{ old_bt }} | |
{% endif %} | |
- id: 'cube-adjust-brightness-rotation' | |
alias: Adjust brightness based on rotation | |
description: 'Adjust brightness based on rotation (desc)' | |
trigger: | |
- platform: event | |
event_type: deconz_event | |
event_data: | |
id: mi_magic_cube | |
condition: | |
condition: template | |
value_template: > | |
{% set gesture_ops = ({ 8:"rotate left", 7:"rotate right" }) %} | |
{{ trigger.event.data.gesture in gesture_ops }} | |
action: | |
- service: light.turn_on | |
entity_id: light.skrivebordslys | |
data_template: | |
brightness_step_pct: > | |
{% if trigger.event.data.event < 0 %} | |
-25 | |
{% else %} | |
25 | |
{% endif %} | |
- id: 'cube-no-shake-plz' | |
alias: No shake cube plz | |
description: 'No shake cube plz (desc)' | |
trigger: | |
- platform: event | |
event_type: deconz_event | |
event_data: | |
id: mi_magic_cube | |
condition: | |
condition: template | |
value_template: > | |
{% set gesture_ops = ({ 1:"shake" }) %} | |
{{ trigger.event.data.gesture in gesture_ops }} | |
action: | |
- service: tts.google_cloud_say | |
data: | |
entity_id: media_player.livingroom | |
message: "Please stopp shaking me, i will be a good cube!" | |
- service: light.turn_on | |
entity_id: light.skrivebordslys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment