From 296f2e3169a1edaf8201d8589316c1b25de22439 Mon Sep 17 00:00:00 2001 From: Georgi Gardev Date: Wed, 13 May 2020 21:02:45 +0300 Subject: [PATCH] Add basic bedroom switch automations --- .../advanced_dashboard/10_system.yaml | 3 ++ .../lighting/by_rooms/master_bedroom.yaml | 34 +++++++++++++++++++ config/packages/modules/media/music.yaml | 11 ++++++ config/secrets.example.yaml | 1 + 4 files changed, 49 insertions(+) diff --git a/config/lovelace/advanced_dashboard/10_system.yaml b/config/lovelace/advanced_dashboard/10_system.yaml index 7d41218..162caa8 100644 --- a/config/lovelace/advanced_dashboard/10_system.yaml +++ b/config/lovelace/advanced_dashboard/10_system.yaml @@ -59,6 +59,8 @@ cards: - 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_switch_single_click + - automation.lighting_master_bedroom_toggle_ambient_lights_on_switch_double_click - automation.lighting_master_bedroom_toggle_lights_on_bedside_switch_single_click - type: divider - automation.lighting_kitchen_day_mode_motion_turn_lights_on @@ -97,6 +99,7 @@ cards: - automation.media_sonos_put_beam_in_day_mode - type: divider - automation.music_living_room_play_pause_on_desk_switch_hold + - automation.music_master_bedroom_play_pause_on_switch_hold - type: divider diff --git a/config/packages/modules/lighting/by_rooms/master_bedroom.yaml b/config/packages/modules/lighting/by_rooms/master_bedroom.yaml index 7faa272..fde75e4 100644 --- a/config/packages/modules/lighting/by_rooms/master_bedroom.yaml +++ b/config/packages/modules/lighting/by_rooms/master_bedroom.yaml @@ -69,3 +69,37 @@ automation: {% else %} 100 {% endif %} + + - alias: Lighting · Master bedroom · Toggle lights on switch single click + trigger: + platform: event + event_type: zha_event + event_data: + device_ieee: !secret master_bedroom_switch_ieee + command: single + action: + - service: light.toggle + data_template: + entity_id: light.master_bedroom_main + brightness_pct: >- + + {% if is_state('input_select.house_mode', 'night') %} + 40 + {% else %} + 100 + {% endif %} + + - alias: Lighting · Master bedroom · Toggle ambient lights on switch double click + trigger: + platform: event + event_type: zha_event + event_data: + device_ieee: !secret master_bedroom_switch_ieee + command: double + action: + - service: light.toggle + data_template: + entity_id: + - light.bedside + - light.bed_led + brightness_pct: 100 diff --git a/config/packages/modules/media/music.yaml b/config/packages/modules/media/music.yaml index 49bab4f..7832b55 100644 --- a/config/packages/modules/media/music.yaml +++ b/config/packages/modules/media/music.yaml @@ -32,3 +32,14 @@ automation: action: - service: media_player.media_play_pause entity_id: media_player.living_room + + - alias: Music · Master bedroom · Play pause on switch hold + trigger: + platform: event + event_type: zha_event + event_data: + device_ieee: !secret master_bedroom_switch_ieee + command: hold + action: + - service: media_player.media_play_pause + entity_id: media_player.master_bedroom diff --git a/config/secrets.example.yaml b/config/secrets.example.yaml index 503b4c5..949f5a9 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 +master_bedroom_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