-
Notifications
You must be signed in to change notification settings - Fork 185
/
music.yaml
55 lines (54 loc) · 1.57 KB
/
music.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
#-
# _
# _ __ ___ _ _ ___(_) ___
# | '_ ` _ \| | | / __| |/ __|
# | | | | | | |_| \__ \ | (__
# |_| |_| |_|\__,_|___/_|\___|
#
#
#- from github.com/basnijholt/home-assistant-config
- alias: "Music: start playlist"
initial_state: "on"
trigger:
platform: state
entity_id: input_boolean.start_the_music
from: "off"
to: "on"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.start_the_music
- service: script.start_spotify_playlist_of_nearest_person
data:
source: KEF LS50
entity_id: media_player.kef_ls50
- alias: "Music: switch music from iPhone to speakers if coming home"
trigger:
platform: state
entity_id: binary_sensor.openclose_front_door
from: "off"
to: "on"
condition:
- condition: state
entity_id: person.marcella
state: not_home
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
- "{{ is_state_attr('media_player.spotify', 'source', 'basnijholt-iphone') }}"
- "{{ is_state('media_player.spotify', 'playing') }}"
- "{{ as_timestamp(now()) - as_timestamp(states.person.bas.last_changed) < 5 * 60 }}" # recently got home
- condition: numeric_state
entity_id: proximity.home
below: 2
action:
- service: media_player.turn_on
entity_id: media_player.kef_ls50
- service: media_player.select_source
entity_id: media_player.kef_ls50
data:
source: Wifi
- service: media_player.select_source
entity_id: media_player.spotify
data:
source: KEF LS50