forked from romquenin/home-assistant-config-fr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstop_resume_mediaplayer_when_receiving_calls.yaml
executable file
·65 lines (55 loc) · 2.36 KB
/
stop_resume_mediaplayer_when_receiving_calls.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
56
57
58
59
60
61
####################################################################################################################################################################################################################################################################################################################################################
#### STOP & RESUME MEDIA PLAYER PLAYBACK WHEN RECEIVING CALLS
####################################################################################################################################################################################################################################################################################################################################################
script:
stop_yt_music_when_receiving_call:
alias: Stop YT music player when i receive a call
sequence:
- service: media_player.media_pause
entity_id: media_player.universal
- service: media_player.volume_mute
data:
entity_id: media_player.samsung_tv_remote
is_volume_muted: true
mode: single
resume_yt_music_when_receiving_call:
alias: Resume YT music player when i receive a call
sequence:
- service: media_player.media_play
entity_id: media_player.universal
- service: media_player.volume_mute
data:
entity_id: media_player.samsung_tv_remote
is_volume_muted: false
mode: single
automation:
- alias: Stop YT music player when i receive a call
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.oneplus_a6013_etat_du_telephone
from: 'idle'
to:
- 'ringing'
- 'offhook'
- platform: event
event_type: ios.action_fired
event_data:
actionName: 'Mute Players'
action:
- service: script.stop_yt_music_when_receiving_call
- alias: Resume YT music player when i receive a call
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.oneplus_a6013_etat_du_telephone
from:
- 'ringing'
- 'offhook'
to: 'idle'
- platform: event
event_type: ios.action_fired
event_data:
actionName: 'Unmute Players'
action:
- service: script.resume_yt_music_when_receiving_call