-
Notifications
You must be signed in to change notification settings - Fork 1
/
configuration.yaml
229 lines (224 loc) · 7.35 KB
/
configuration.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
light:
- platform: template
lights:
taudio_good:
friendly_name: "Notify Good"
turn_on:
service: squeezebox.call_method
data:
entity_id: media_player.squeezelite_taudio
command: dmx
parameters:
- '0,80,0,0,80,0,0,80,0,0,80,0,0,80,0,0,80,0'
turn_off:
service: squeezebox.call_method
data:
entity_id: media_player.squeezelite_taudio
command: dmx
parameters:
- '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'
taudio_warn:
friendly_name: "Notify Warn"
turn_on:
service: squeezebox.call_method
data:
entity_id: media_player.squeezelite_taudio
command: dmx
parameters:
- '60,20,0,60,20,0,60,20,0,60,20,0,60,20,0'
- '7'
turn_off:
service: squeezebox.call_method
data:
entity_id: media_player.squeezelite_taudio
command: dmx
parameters:
- '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'
- '7'
taudio_alert:
friendly_name: "Notify Alert"
turn_on:
service: squeezebox.call_method
data:
entity_id: media_player.squeezelite_taudio
command: dmx
parameters:
- '80,0,0,80,0,0,80,0,0,80,0,0,80,0,0,80,0,0,80,0,0'
- '12'
turn_off:
service: squeezebox.call_method
data:
entity_id: media_player.squeezelite_taudio
command: dmx
parameters:
- '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'
- '12'
taudio_all:
taudio_all:
friendly_name: "TAudio Color"
level_template: "{{states('input_number.taudio_l') | int(0)}}"
value_template: "{{states('input_number.taudio_l') | int(0) > 0}}"
color_template: "({{states('input_number.taudio_h') | int(0)}}, {{states('input_number.taudio_s') | int(0)}})"
turn_on:
- service: input_number.set_value
data:
entity_id: input_number.taudio_l
value: '{{ state_attr("input_number.taudio_l","initial")|float(0) }}'
- service: script.taudio_set
turn_off:
- service: input_number.set_value
data:
entity_id: input_number.taudio_l
value: "0"
- service: script.taudio_set
set_level:
- service: input_number.set_value
data:
value: "{{ brightness| float(0) }}"
entity_id: input_number.taudio_l
- service: script.taudio_set
set_color:
- service: input_number.set_value
data:
value: "{{ h }}"
entity_id: input_number.taudio_h
- service: input_number.set_value
data:
value: "{{ s }}"
entity_id: input_number.taudio_s
- service: script.taudio_set
input_number:
# The following helpers are required for the light template integration
taudio_h:
name: TAudio Hue
min: 0
max: 360
taudio_s:
name: TAudio Saturation
min: 0
max: 100
taudio_l:
name: TAudio Level
initial: 30
min: 0
max: 255
step: 1
input_text:
# The following helper is used with the announce to speaker example
alert_trigger:
name: "Alert Trigger Source"
# The following helpers are used with the automations
# to search and play music based on a query
taudio_play_songs:
name: "Play Songs"
taudio_play_artists:
name: "Play Artist"
taudio_play_albums:
name: "Play Album"
# These scripts should be replacted into the script.yaml
# if configured
script:
# Shared function to simplify template lights
taudio_set:
alias: TAudio Set RGB Color
sequence:
- service: squeezebox.call_method
data:
entity_id: media_player.squeezelite_taudio
command: dmx
parameters:
- '{% set gain = state_attr("light.taudio_all", "brightness")|int(0) %}{% for n in range(19) %}{% if gain == 0 %}0,0,0,{% else %}{% set rgb = state_attr("light.taudio_all", "rgb_color") %}{{ (rgb[0]|int(0) * gain / 255)|round }},{{ (rgb[1]|int(0) * gain / 255)|round(0) }},{{ (rgb[2]|int(0) * gain / 255)|round(0) }},{% endif %}{% endfor %}'
- "0"
# Used to flash lights in service calls
taudio_alert_flash:
alias: taudio_alert_flash
sequence:
repeat:
count: 10
sequence:
- service: light.turn_on
data:
entity_id: light.taudio_alert
- delay: '00:00:01'
- service: light.turn_off
data:
entity_id: light.taudio_alert
- delay: '00:00:03'
notify:
# A Text-To_Speech platform is required for the announce to speaker example
- platform: tts
name: tts_announce
tts_service: tts.google_say
media_player: media_player.squeezelite_taudio
# These automations should be located in the automation.yaml
# if configured.
automation:
# Eaxample TTS notify using an input text helper
- id: announce_to_speaker
alias: TAudio Announce
trigger:
- platform: state
entity_id: input_text.alert_trigger
action:
- service: squeezebox.call_method
data:
command: show
parameters:
- 'line1: HA Announce'
- 'line2: {{ states("input_text.alert_trigger") }}'
- 'font: light'
- 'duration: 30'
entity_id: media_player.squeezelite_taudio
- service: notify.tts_announce
data:
message: "{{ states('input_text.alert_trigger') }}"
mode: single
# The following automations use text helpers to search and play music
- id: taudio_load_albums
alias: taudio_load_albums
description: ''
trigger:
- platform: state
entity_id: input_text.taudio_play_albums
condition: []
action:
- service: squeezebox.call_method
data:
entity_id: media_player.squeezelite_taudio
command: playlist
parameters:
- loadtracks
- 'album.titlesearch={{ states(''input_text.taudio_play_albums'') }}'
mode: single
- id: taudio_load_artists
alias: taudio_load_artists
description: ''
trigger:
- platform: state
entity_id: input_text.taudio_play_artists
condition: []
action:
- service: squeezebox.call_method
data:
entity_id: media_player.squeezelite_taudio
command: playlist
parameters:
- loadtracks
- 'contributor.namesearch={{ states(''input_text.taudio_play_artists'') }}'
mode: single
- id: taudio_load_songs
alias: taudio_load_songs
description: ''
trigger:
- platform: state
entity_id: input_text.taudio_play_songs
condition: []
action:
- service: squeezebox.call_method
data:
entity_id: media_player.squeezelite_taudio
command: playlist
parameters:
- loadtracks
- 'track.titlesearch={{ states(''input_text.taudio_play_songs'') }}'
mode: single