From efd1d50873ba3f29449512c8efd663b0e3b1ff2f Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Fri, 8 Jan 2021 22:51:30 +0100 Subject: [PATCH] Update bathroom automations --- automations/files/bathroom-motion.yaml | 2 +- automations/files/bathroom-music.yaml | 38 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 automations/files/bathroom-music.yaml diff --git a/automations/files/bathroom-motion.yaml b/automations/files/bathroom-motion.yaml index 3a2e5df..6a26f7e 100644 --- a/automations/files/bathroom-motion.yaml +++ b/automations/files/bathroom-motion.yaml @@ -19,7 +19,7 @@ trigger: - platform: state entity_id: binary_sensor.bathroom_motion_sensor - for: '0:01:00' + for: '0:02:00' from: 'on' to: 'off' action: diff --git a/automations/files/bathroom-music.yaml b/automations/files/bathroom-music.yaml new file mode 100644 index 0000000..7f0cbc6 --- /dev/null +++ b/automations/files/bathroom-music.yaml @@ -0,0 +1,38 @@ +- id: bathroom-music-on + alias: '[Bathroom] Music On' + mode: restart + trigger: + - platform: state + entity_id: binary_sensor.shower_motion + from: 'off' + to: 'on' + action: + - service: spotcast.start + data: + device_name: Bathroom speaker + uri: 'spotify:playlist:71mXIu6HcdVj3fAMduaHop' + random_song: true +- id: bathroom-music-off + alias: '[Bathroom] Music Off' + mode: restart + trigger: + - platform: state + entity_id: binary_sensor.shower_motion + for: '0:01:00' + from: 'on' + to: 'off' + - platform: state + entity_id: binary_sensor.bathroom_motion_sensor + for: '0:01:00' + from: 'on' + to: 'off' + condition: + - condition: state + entity_id: binary_sensor.shower_motion + state: 'on' + - condition: state + entity_id: binary_sensor.bathroom_motion_sensor + state: 'on' + action: + - service: media_player.turn_off + entity_id: media_player.bathroom_speaker