From 76d12defa84c7f017142f76e9e6b717a738ae2b8 Mon Sep 17 00:00:00 2001 From: pgrondek Date: Wed, 30 Jun 2021 11:52:38 +0200 Subject: [PATCH] Change mirror button functions to also handle music --- .../automations/bathroom-lights.yaml | 4 ++ .../automations/bathroom-mirror-button.yaml | 70 +++++++++++-------- 2 files changed, 43 insertions(+), 31 deletions(-) diff --git a/configuration/automations/bathroom-lights.yaml b/configuration/automations/bathroom-lights.yaml index 9ef5e18..f386ff2 100644 --- a/configuration/automations/bathroom-lights.yaml +++ b/configuration/automations/bathroom-lights.yaml @@ -73,3 +73,7 @@ action: - service: light.turn_off entity_id: light.bathroom_lights + - service: light.turn_off + entity_id: light.bathroom_mirror_lights + - service: light.turn_off + entity_id: light.shower_lights diff --git a/configuration/automations/bathroom-mirror-button.yaml b/configuration/automations/bathroom-mirror-button.yaml index 6bb6d16..1b4685a 100644 --- a/configuration/automations/bathroom-mirror-button.yaml +++ b/configuration/automations/bathroom-mirror-button.yaml @@ -1,5 +1,5 @@ - id: bathroom-mirror-lights-on - alias: '[Bathroom] Mirror Lights On' + alias: '[Bathroom] Mirror Button Music' trigger: - device_id: 4d5298037e93ba11438409bff01b5005 domain: zha @@ -7,44 +7,52 @@ type: remote_button_short_press subtype: turn_on action: - - choose: - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'on' - sequence: - - service: light.turn_on - entity_id: light.bathroom_mirror_lights - data: - brightness_pct: 100 - kelvin: 2000 - - conditions: - - condition: state - entity_id: input_boolean.sleep_mode - state: 'off' - sequence: - - service: light.turn_on - entity_id: light.bathroom_mirror_lights - data: - brightness_pct: 100 - kelvin: 3200 + - service: media_player.media_play_pause + target: + entity_id: media_player.bathroom mode: single - id: bathroom-mirror-lights-off - alias: '[Bathroom] Mirror Button Off' + alias: '[Bathroom] Mirror Button Lights toggle' trigger: - device_id: 4d5298037e93ba11438409bff01b5005 domain: zha platform: device type: remote_button_short_press subtype: turn_off - - platform: state - entity_id: binary_sensor.bathroom_motion_occupancy - for: '0:05:00' - from: 'on' - to: 'off' action: - - service: light.turn_off - data: - entity_id: light.bathroom_mirror_lights + - choose: + - conditions: + - condition: state + entity_id: light.bathroom_mirror_lights + state: 'on' + sequence: + - service: light.turn_off + entity_id: light.bathroom_mirror_lights + - conditions: + - condition: state + entity_id: light.bathroom_mirror_lights + state: 'off' + sequence: + - choose: + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'on' + sequence: + - service: light.turn_on + entity_id: light.bathroom_mirror_lights + data: + brightness_pct: 100 + kelvin: 2000 + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'off' + sequence: + - service: light.turn_on + entity_id: light.bathroom_mirror_lights + data: + brightness_pct: 100 + kelvin: 3200 mode: single