From 92bf8c23e23a3bd62ca26ec5756818c62bee1ec6 Mon Sep 17 00:00:00 2001 From: pgrondek Date: Tue, 25 May 2021 13:54:21 +0200 Subject: [PATCH] Change bathroom automations Merge with white temperature automations --- .../automations/bathroom-lights.yaml | 18 ++++++++-- .../automations/bathroom-mirror-button.yaml | 36 +++++++++++++++---- configuration/automations/bathroom-music.yaml | 1 + .../automations/bathroom-shower-motion.yaml | 35 ++++++++++++++++-- 4 files changed, 78 insertions(+), 12 deletions(-) diff --git a/configuration/automations/bathroom-lights.yaml b/configuration/automations/bathroom-lights.yaml index 4ec613b..bc912b8 100644 --- a/configuration/automations/bathroom-lights.yaml +++ b/configuration/automations/bathroom-lights.yaml @@ -58,8 +58,20 @@ for: '0:05:00' from: 'on' to: 'off' + - platform: state + entity_id: binary_sensor.shower_motion + for: '0:02:00' + from: 'on' + to: 'off' + condition: + - condition: state + entity_id: binary_sensor.bathroom_motion_occupancy + for: '0:02:00' + state: 'off' + - condition: state + entity_id: binary_sensor.shower_motion + for: '0:02:00' + state: 'off' action: - service: light.turn_off - entity_id: - - light.bathroom_lights - - light.bathroom_mirror_lights + entity_id: light.bathroom_lights diff --git a/configuration/automations/bathroom-mirror-button.yaml b/configuration/automations/bathroom-mirror-button.yaml index 32d1e7e..5238763 100644 --- a/configuration/automations/bathroom-mirror-button.yaml +++ b/configuration/automations/bathroom-mirror-button.yaml @@ -1,5 +1,5 @@ -- id: button-bathroom-mirror-on - alias: '[Bathroom] Mirror Button On' +- id: bathroom-mirror-lights-on + alias: '[Bathroom] Mirror Lights On' trigger: - device_id: 4d5298037e93ba11438409bff01b5005 domain: zha @@ -7,11 +7,30 @@ type: remote_button_short_press subtype: turn_on action: - - service: light.turn_on - data: - entity_id: light.bathroom_mirror_lights + - 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.toggle + entity_id: light.bathroom_mirror_lights + data: + brightness_pct: 100 + kelvin: 3200 mode: single -- id: button-bathroom-mirror-off + +- id: bathroom-mirror-lights-off alias: '[Bathroom] Mirror Button Off' trigger: - device_id: 4d5298037e93ba11438409bff01b5005 @@ -19,6 +38,11 @@ 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: diff --git a/configuration/automations/bathroom-music.yaml b/configuration/automations/bathroom-music.yaml index 607e653..64f76f2 100644 --- a/configuration/automations/bathroom-music.yaml +++ b/configuration/automations/bathroom-music.yaml @@ -20,6 +20,7 @@ data: device_name: Bathroom speaker uri: 'spotify:playlist:71mXIu6HcdVj3fAMduaHop' + - id: bathroom-music-off alias: '[Bathroom] Music Off' mode: restart diff --git a/configuration/automations/bathroom-shower-motion.yaml b/configuration/automations/bathroom-shower-motion.yaml index 6f22566..17a238f 100644 --- a/configuration/automations/bathroom-shower-motion.yaml +++ b/configuration/automations/bathroom-shower-motion.yaml @@ -7,8 +7,27 @@ from: 'off' to: 'on' action: - - service: light.turn_on - entity_id: light.shower_lights + - choose: + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'on' + sequence: + - service: light.turn_on + entity_id: light.shower_lights + data: + brightness_pct: 100 + kelvin: 2000 + - conditions: + - condition: state + entity_id: input_boolean.sleep_mode + state: 'off' + sequence: + - service: light.toggle + entity_id: light.shower_lights + data: + brightness_pct: 100 + kelvin: 3200 - id: bathroom-shower-motion-off alias: '[Bathroom] Shower Motion Off' @@ -16,9 +35,19 @@ trigger: - platform: state entity_id: binary_sensor.shower_motion - for: '0:01:00' + for: '0:02:00' from: 'on' to: 'off' + - platform: state + entity_id: binary_sensor.bathroom_motion_occupancy + for: '0:05:00' + from: 'on' + to: 'off' + condition: + - condition: state + entity_id: binary_sensor.shower_motion + for: '0:02:00' + state: 'off' action: - service: light.turn_off entity_id: light.shower_lights \ No newline at end of file