From 351ac94c089706f6b36fc44c1ce23f1224b03f80 Mon Sep 17 00:00:00 2001 From: Georgi Gardev Date: Wed, 13 May 2020 21:23:51 +0300 Subject: [PATCH] Add basic automation for bathroom switch --- .../advanced_dashboard/10_system.yaml | 2 ++ config/packages/modules/media/sonos.yaml | 20 +++++++++++++++++++ config/packages/modules/media/youtube.yaml | 14 +++++++++++++ config/secrets.example.yaml | 1 + 4 files changed, 37 insertions(+) diff --git a/config/lovelace/advanced_dashboard/10_system.yaml b/config/lovelace/advanced_dashboard/10_system.yaml index 162caa8..4913029 100644 --- a/config/lovelace/advanced_dashboard/10_system.yaml +++ b/config/lovelace/advanced_dashboard/10_system.yaml @@ -287,6 +287,8 @@ cards: entity: sensor.desk_switch_power - type: custom:battery-entity entity: sensor.master_bedroom_bedside_switch_power + - type: custom:battery-entity + entity: sensor.bathroom_switch_power - type: divider - type: custom:battery-entity entity: sensor.motion_1_power diff --git a/config/packages/modules/media/sonos.yaml b/config/packages/modules/media/sonos.yaml index 3b475a6..366cfb8 100644 --- a/config/packages/modules/media/sonos.yaml +++ b/config/packages/modules/media/sonos.yaml @@ -102,6 +102,26 @@ automation: push: thread-id: "sonos" + - alias: Media · Sonos · Volume up on bathroom switch click + trigger: + platform: event + event_type: zha_event + event_data: + device_ieee: !secret bathroom_switch_ieee + command: single + action: + - service: media_player.volume_set + entity_id: media_player.bathroom + data_template: + volume_level: >- + + {% if state_attr('media_player.bathroom', 'volume_level')|float > 0.5 %} + 0.2 + {% else %} + 0.55 + {% endif %} + + homeassistant: customize: media_player.master_bedroom: diff --git a/config/packages/modules/media/youtube.yaml b/config/packages/modules/media/youtube.yaml index 56710cb..cdac103 100644 --- a/config/packages/modules/media/youtube.yaml +++ b/config/packages/modules/media/youtube.yaml @@ -91,3 +91,17 @@ automation: - service: script.say data: message: "Just wanted to let you know - a new PDS is available!" + + - alias: Youtube · play latest pds on bathroom switch dobule click + trigger: + platform: event + event_type: zha_event + event_data: + device_ieee: !secret bathroom_switch_ieee + command: double + action: + - service: media_player.volume_set + entity_id: media_player.bathroom + data: + volume_level: 0.55 + - service: script.youtube_play_latest_pds diff --git a/config/secrets.example.yaml b/config/secrets.example.yaml index 949f5a9..c4f02c8 100644 --- a/config/secrets.example.yaml +++ b/config/secrets.example.yaml @@ -51,6 +51,7 @@ 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 +bathroom_switch_ieee: 00:00:00:00:00:00:00:00 magic_cube_ieee: 00:00:00:00:00:00:00:00 sonos_hosts: