From 00d8fef34e18355028f2b5667d6377b4e50954d0 Mon Sep 17 00:00:00 2001 From: Georgi Gardev Date: Tue, 12 May 2020 23:24:26 +0300 Subject: [PATCH] Add desk switch --- .../advanced_dashboard/10_system.yaml | 5 +++ .../lighting/by_rooms/living_room.yaml | 38 +++++++++++++++++++ config/packages/modules/media/music.yaml | 12 ++++++ config/secrets.example.yaml | 1 + 4 files changed, 56 insertions(+) create mode 100644 config/packages/modules/lighting/by_rooms/living_room.yaml diff --git a/config/lovelace/advanced_dashboard/10_system.yaml b/config/lovelace/advanced_dashboard/10_system.yaml index b4cec94..38b900e 100644 --- a/config/lovelace/advanced_dashboard/10_system.yaml +++ b/config/lovelace/advanced_dashboard/10_system.yaml @@ -56,6 +56,9 @@ cards: - automation.lighting_temperature_adjust_on_start - automation.lighting_temperature_adjust_based_on_time - type: divider + - automation.lighting_living_room_toggle_ceiling_lights_on_desk_switch_single_click + - automation.lighting_living_room_toggle_ambient_lights_on_desk_switch_double_click + - type: divider - automation.lighting_master_bedroom_toggle_lights_on_bedside_switch_single_click - type: divider - automation.lighting_kitchen_day_mode_motion_turn_lights_on @@ -92,6 +95,8 @@ cards: - automation.youtube_download_latest_pds - automation.media_sonos_put_beam_in_night_mode - automation.media_sonos_put_beam_in_day_mode + - type: divider + - automation.music_living_room_play_pause_on_desk_switch_hold - type: divider diff --git a/config/packages/modules/lighting/by_rooms/living_room.yaml b/config/packages/modules/lighting/by_rooms/living_room.yaml new file mode 100644 index 0000000..a436eb4 --- /dev/null +++ b/config/packages/modules/lighting/by_rooms/living_room.yaml @@ -0,0 +1,38 @@ +automation: + - alias: Lighting · Living Room · Toggle ceiling lights on desk switch single click + trigger: + platform: event + event_type: zha_event + event_data: + device_ieee: !secret desk_switch_ieee + command: single + action: + - service: light.toggle + data_template: + entity_id: light.living_room_ceiling + brightness_pct: >- + + {% if is_state('input_select.house_mode', 'night') %} + 40 + {% else %} + 100 + {% endif %} + + - alias: Lighting · Living Room · Toggle ambient lights on desk switch double click + trigger: + platform: event + event_type: zha_event + event_data: + device_ieee: !secret desk_switch_ieee + command: double + action: + - service: light.toggle + data_template: + entity_id: light.living_room_ambient + brightness_pct: >- + + {% if is_state('input_select.house_mode', 'night') %} + 40 + {% else %} + 100 + {% endif %} diff --git a/config/packages/modules/media/music.yaml b/config/packages/modules/media/music.yaml index a1df501..49bab4f 100644 --- a/config/packages/modules/media/music.yaml +++ b/config/packages/modules/media/music.yaml @@ -20,3 +20,15 @@ script: entity_id: media_player.master_bedroom data_template: source: "{{ playlist | default('Evening Chill') }}" + +automation: + - alias: Music · Living Room · Play pause on desk switch hold + trigger: + platform: event + event_type: zha_event + event_data: + device_ieee: !secret desk_switch_ieee + command: hold + action: + - service: media_player.media_play_pause + entity_id: media_player.living_room diff --git a/config/secrets.example.yaml b/config/secrets.example.yaml index c326c7c..503b4c5 100644 --- a/config/secrets.example.yaml +++ b/config/secrets.example.yaml @@ -49,6 +49,7 @@ platinum_user: user platinum_password: pass master_bedroom_bedside_switch_ieee: 00:00:00:00:00:00:00:00 +desk_switch_ieee: 00:00:00:00:00:00:00:00 magic_cube_ieee: 00:00:00:00:00:00:00:00 sonos_hosts: