1
0
ansible-home-assistant/configuration/automations/home-music.yaml

79 lines
1.9 KiB
YAML

- id: ra_music_bathroom_arrive
alias: '[RA] Bathroom arrive'
mode: single
trigger:
- platform: state
entity_id: sensor.przemyslaws_apple_watch_room_presence
to: ra-bathroom
condition:
- condition: or
conditions:
- condition: state
entity_id: media_player.bedroom
state: playing
action:
- service: media_player.join
data:
group_members: media_player.bedroom
target:
entity_id: media_player.bathroom
- id: ra_music_bathroom_leave
alias: '[RA] Bathroom leave'
mode: single
trigger:
- platform: state
entity_id: sensor.przemyslaws_apple_watch_room_presence
from: ra-bathroom
for: '0:01:00'
condition:
- condition: or
conditions:
- condition: state
entity_id: media_player.bathroom
state: playing
action:
- service: media_player.unjoin
target:
entity_id: media_player.bathroom
- id: ra_music_bedroom_arrive
alias: '[RA] Bedroom arrive'
mode: single
trigger:
- platform: state
entity_id: sensor.przemyslaws_apple_watch_room_presence
to: ra-bedroom
condition:
- condition: or
conditions:
- condition: state
entity_id: media_player.bathroom
state: playing
action:
- service: media_player.join
data:
group_members: media_player.bathroom
target:
entity_id: media_player.bedroom
- id: ra_music_bedroom_leave
alias: '[RA] Bedroom leave'
mode: single
trigger:
- platform: state
entity_id: sensor.przemyslaws_apple_watch_room_presence
from: ra-bedroom
for: '0:01:00'
condition:
- condition: or
conditions:
- condition: state
entity_id: media_player.bedroom
state: playing
action:
- service: sonos.unjoin
target:
entity_id: media_player.bedroom