1
0

Deduplicate bathroom music automations sequence

This commit is contained in:
Przemek Grondek 2022-02-07 20:02:42 +01:00
parent f56d9fb84c
commit e1ec6f4baa
4 changed files with 55 additions and 31 deletions

View File

@ -7,9 +7,7 @@
type: remote_button_alt_short_press
subtype: button_2
action:
- service: media_player.media_play_pause
target:
entity_id: media_player.bathroom
- service: script.bathroom_music_toggle
mode: single
- id: bathroom-mirror-lights-off
@ -47,7 +45,6 @@
target:
entity_id: vacuum.robot_vacuum
- id: bathroom-mirror-button-4
alias: '[Bathroom] Mirror Button Automations'
trigger:

View File

@ -56,5 +56,4 @@
type: remote_button_short_press
subtype: remote_button_short_press
action:
- service: media_player.media_play_pause
entity_id: media_player.bathroom
- service: script.bathroom_music_toggle

View File

@ -22,28 +22,3 @@
data:
media_content_id: https://open.spotify.com/playlist/71mXIu6HcdVj3fAMduaHop
media_content_type: music
- 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_occupancy
for: '0:01:00'
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: binary_sensor.shower_motion
state: 'off'
- condition: state
entity_id: binary_sensor.bathroom_motion_occupancy
state: 'off'
action:
- service: media_player.media_pause
entity_id: media_player.bathroom

View File

@ -1,3 +1,56 @@
bathroom_music_toggle:
alias: '[Bathroom] Music toggle'
sequence:
- choose:
- conditions:
- condition: state
entity_id: media_player.bathroom
state: 'playing'
sequence:
- service: script.bathroom_music_off
- conditions:
- condition: state
entity_id: media_player.bathroom
state: 'paused'
sequence:
- service: script.bathroom_music_on
default: [ ]
bathroom_music_off:
alias: '[Bathroom] Music turn off'
sequence:
- service: media_player.media_pause
target:
entity_id: media_player.bathroom
bathroom_music_on:
alias: '[Bathroom] Music turn on'
sequence:
- service: media_player.media_play
target:
entity_id: media_player.bathroom
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.shower_motion
state: 'on'
sequence:
- service: media_player.volume_set
data:
volume_level: 0.65
target:
entity_id: media_player.bathroom
- conditions:
- condition: state
entity_id: binary_sensor.shower_motion
state: 'off'
sequence:
- service: media_player.volume_set
data:
volume_level: 0.45
target:
entity_id: media_player.bathroom
pause_all_players:
alias: Pause all playing devices
sequence: