-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathhome_cinema.yaml
executable file
·136 lines (132 loc) · 4.23 KB
/
home_cinema.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
automation:
# Set home cinema lights when remote changes activity
- id: harmony_scene_lights
alias: Licht Szenen Heimkino
mode: single
trigger:
platform: state
entity_id: remote.wohnzimmer
attribute: current_activity
condition:
- "{{ trigger.to_state.state != 'unavailable' }}"
action:
service: script.turn_on
entity_id: script.set_home_cinema_lights
# Brighten/Dim Light on Pause/Play
- id: dim_brighten_light_play_pause
alias: Licht hell/dunkel bei Pause/Play
mode: single
trigger:
platform: event
event_type: roku_command
action:
- variables:
command: "{{ trigger.event.data.key }}"
- choose:
- conditions:
- "{{ command == 'Home' }}"
sequence:
- service: light.turn_on
entity_id: light.livingroom
data:
brightness_pct: 100
transition: 5
- conditions:
- "{{ command == 'Play' }}"
sequence:
- service: script.turn_on
entity_id: script.set_home_cinema_lights
# Pause/Play on phone call
- id: pause_play_on_phone_call
alias: Pause/Play bei Anruf
mode: single
trigger:
platform: state
entity_id:
- sensor.call_state_phone_dimitri
- sensor.call_state_phone_sabrina
condition:
- "{{ is_state('person.' + trigger.entity_id.split('_')[-1], 'home') }}"
- "{{ is_state('remote.wohnzimmer', 'on') }}"
action:
- variables:
call_state: "{{ trigger.to_state.state }}"
current_activity: "{{ state_attr('remote.wohnzimmer', 'current_activity') }}"
device: >
{% set map = {
"Fernsehen": "Swisscom DVR",
"Filme/Serien": "Kodi Wohnzimmer"
}%}
{{ map[current_activity] }}
- choose:
- conditions:
- "{{ call_state == 'ringing' }}"
sequence:
- service: remote.send_command
data:
device: "{{ device }}"
command: Pause
- service: light.turn_on
entity_id: light.livingroom
data:
brightness_pct: 100
transition: 5
- conditions:
- "{{ call_state == 'idle' }}"
sequence:
- service: remote.send_command
data:
device: "{{ device }}"
command: Play
- service: script.turn_on
entity_id: script.set_home_cinema_lights
script:
# Change home cinema lights based on current Harmony activity
set_home_cinema_lights:
mode: restart
variables:
activity: "{{ state_attr('remote.wohnzimmer', 'current_activity') }}"
sequence:
- choose:
- conditions:
- "{{ activity == 'Fernsehen' }}"
sequence:
- service: light.turn_on
entity_id: light.livingroom
data:
color_name: yellow
brightness_pct: 50
transition: 3
- conditions:
- "{{ activity == 'Nintendo Switch' }}"
sequence:
- service: light.turn_on
entity_id: light.livingroom
data:
color_name: green
brightness_pct: 70
transition: 3
- conditions:
- "{{ activity == 'Filme/Serien' }}"
sequence:
- service: light.turn_on
entity_id: light.livingroom
data:
color_name: orange
brightness_pct: 30
transition: 3
- conditions:
- "{{ activity == 'Musik' }}"
sequence:
- service: light.turn_on
entity_id: light.livingroom
data:
effect: colorloop
brightness_pct: 80
- conditions:
- "{{ activity == 'PowerOff' }}"
sequence:
- service: light.turn_off
entity_id: light.livingroom
data:
transition: 120