From e34b0ecb4965c5101746bf5d4b1553fb9d00b4bd Mon Sep 17 00:00:00 2001 From: Georgi Gardev Date: Sat, 25 Apr 2020 01:13:04 +0300 Subject: [PATCH] Dim lights on cube rotate --- config/lovelace/home_dashboard/09_system.yaml | 4 +- config/packages/devices/magic_cube.yaml | 48 ++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/config/lovelace/home_dashboard/09_system.yaml b/config/lovelace/home_dashboard/09_system.yaml index 1b1d2e4..6c685ba 100644 --- a/config/lovelace/home_dashboard/09_system.yaml +++ b/config/lovelace/home_dashboard/09_system.yaml @@ -175,9 +175,11 @@ cards: entities: - automation.magic_cube_mode_change - automation.magic_cube_lighting_toggle_on_knock + - automation.magic_cube_lighting_dim_on_rotate_left + - automation.magic_cube_lighting_brighten_on_rotate_right - automation.magic_cube_music_play_pause_on_knock - automation.magic_cube_music_volume_down_on_rotate_left - - automation.magic_cube_music_volume_up_rotate_right + - automation.magic_cube_music_volume_up_on_rotate_right # Browser mod - type: custom:fold-entity-row diff --git a/config/packages/devices/magic_cube.yaml b/config/packages/devices/magic_cube.yaml index 642699f..c592596 100644 --- a/config/packages/devices/magic_cube.yaml +++ b/config/packages/devices/magic_cube.yaml @@ -33,6 +33,7 @@ automation: {{ states('input_select.magic_cube_mode') }} {% endif %} + # Lighting - alias: Magic Cube · Lighting · Toggle on Knock trigger: platform: event @@ -53,6 +54,51 @@ automation: - service: light.toggle entity_id: light.living_room_all_lights + - alias: Magic Cube · Lighting · Dim on rotate left + trigger: + platform: event + event_type: zha_event + event_data: + device_ieee: !secret magic_cube_ieee + command: rotate_left + condition: + condition: and + conditions: + - condition: state + entity_id: input_boolean.magic_cube_enabled + state: "on" + - condition: state + entity_id: input_select.magic_cube_mode + state: "light" + action: + - service: light.turn_on + entity_id: light.living_room_all_lights + data: + brightness_step_pct: -20 + + - alias: Magic Cube · Lighting · Brighten on rotate right + trigger: + platform: event + event_type: zha_event + event_data: + device_ieee: !secret magic_cube_ieee + command: rotate_right + condition: + condition: and + conditions: + - condition: state + entity_id: input_boolean.magic_cube_enabled + state: "on" + - condition: state + entity_id: input_select.magic_cube_mode + state: "light" + action: + - service: light.turn_on + entity_id: light.living_room_all_lights + data: + brightness_step_pct: 20 + + # Music - alias: Magic Cube · Music · Play/Pause on Knock trigger: platform: event @@ -95,7 +141,7 @@ automation: data: entity_id: media_player.living_room - - alias: Magic Cube ‚ Music · Volume up rotate right + - alias: Magic Cube · Music · Volume up on rotate right trigger: platform: event event_type: zha_event