1
0
ansible-home-assistant/roles/scripts/files/40.pause-all-media.yaml

102 lines
3.0 KiB
YAML

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.bathroom_shower_sensor_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.bathroom_shower_sensor_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:
- choose:
- conditions:
- condition: state
entity_id: media_player.bathroom
state: playing
sequence:
- service: media_player.media_pause
target:
entity_id: media_player.bathroom
- choose:
- conditions:
- condition: state
entity_id: media_player.bedroom
state: playing
sequence:
- service: media_player.media_pause
target:
entity_id: media_player.bedroom
- choose:
- conditions:
- condition: state
entity_id: media_player.living_room
state: playing
sequence:
- service: media_player.media_pause
target:
entity_id: media_player.living_room
- choose:
- conditions:
- condition: state
entity_id: media_player.nvidia_shield
state: playing
sequence:
- service: media_player.media_pause
target:
entity_id: media_player.nvidia_shield
- choose:
- conditions:
- condition: state
entity_id: media_player.spotify_11175365349
state: playing
sequence:
- service: media_player.media_pause
target:
entity_id: media_player.spotify_11175365349