-
Notifications
You must be signed in to change notification settings - Fork 185
/
arriving.yaml
42 lines (41 loc) · 1.26 KB
/
arriving.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
---
#-
# _ _
# __ _ _ __ _ __(_)_ _(_)_ __ __ _
# / _` | '__| '__| \ \ / / | '_ \ / _` |
# | (_| | | | | | |\ V /| | | | | (_| |
# \__,_|_| |_| |_| \_/ |_|_| |_|\__, |
# |___/
#
#- from github.com/basnijholt/home-assistant-config
# XXX: sometimes triggers when leaving!
- alias: "Arriving: switch music from iPhone to speakers if no one is 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') }}"
action:
- service: notify.iphone_bas
data:
title: "Arriving"
message: "Switched music from phone to speakers"
- service: media_player.turn_on
entity_id: media_player.kef_ls50
- service: media_player.select_source
entity_id: media_player.kef_ls50
data:
source: Spotify
- service: media_player.select_source
entity_id: media_player.spotify
data:
source: KEF LS50