-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathsatellite1-TaterTimer.yaml
More file actions
342 lines (305 loc) · 10.7 KB
/
satellite1-TaterTimer.yaml
File metadata and controls
342 lines (305 loc) · 10.7 KB
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
substitutions:
# -----------------------------
# DEVICE IDENTITY
# -----------------------------
friendly_name: "Tater_Sat1"
node_name: tatersat1
company_name: Tater
project_name: Tater_Sat1
component_name: Core
# -----------------------------
# WIFI / NETWORK
# -----------------------------
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
ha_voice_ip: "127.0.0.1" # optional - remove if not needed
hidden_ssid: "false"
# -----------------------------
# SENSOR CALIBRATION
# -----------------------------
temp_offset: "-3"
humidity_offset: "5"
# -----------------------------
# FIRMWARE VERSIONS
# -----------------------------
esp32_fw_version: "1.0.1"
xmos_fw_version: "v1.0.3"
# -----------------------------
# WAKE WORD CONFIG
# -----------------------------
wake_word_name: hey_tater
wake_word_model_url: https://raw.githubusercontent.com/TaterTotterson/microWakeWords/refs/heads/main/microWakeWords/hey_tater.json
wake_model_stop_url: https://github.com/kahrendt/microWakeWord/releases/download/stop/stop.json
# -----------------------------
# WAKE WORD SENSITIVITY (probability cutoff)
# -----------------------------
wake_cutoff_slight: "250" # ~0.98
wake_cutoff_moderate: "245" # ~0.96
wake_cutoff_very: "222" # ~0.87
# -----------------------------
# AUDIO FILE URLS
# -----------------------------
center_button_press_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/center_button_press.flac
center_button_double_press_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/center_button_double_press.flac
center_button_triple_press_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/center_button_triple_press.flac
center_button_long_press_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/center_button_long_press.flac
factory_reset_initiated_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/factory_reset_initiated.mp3
factory_reset_cancelled_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/factory_reset_cancelled.mp3
mute_switch_on_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/mute_switch_on.flac
mute_switch_off_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/mute_switch_off.flac
timer_finished_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/timer_finished.flac
wake_word_triggered_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/wake_word_triggered.flac
jack_connected_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/jack_connected.flac
jack_disconnected_sound_file: https://github.com/esphome/home-assistant-voice-pe/raw/dev/sounds/jack_disconnected.flac
globals:
# Global initialisation variable. Initialized to true and set to false once everything is connected. Only used to have a smooth "plugging" experience
- id: init_in_progress
type: bool
restore_value: no
initial_value: 'true'
# Global variable storing if user action causes warning
- id: warning
type: bool
restore_value: no
initial_value: 'false'
# Global variable tracking the XMOS flasher status.
- id: xmos_flashing_state
type: int
restore_value: no
initial_value: '0'
# Remote (device-local) timer total duration in seconds.
- id: remote_timer_total_seconds
type: int
restore_value: yes
initial_value: "0"
# Remote (device-local) timer remaining duration in seconds.
- id: remote_timer_remaining_seconds
type: int
restore_value: yes
initial_value: "0"
# Tracks whether the remote timer is currently running.
- id: remote_timer_running
type: bool
restore_value: yes
initial_value: "false"
interval:
- interval: 1s
then:
- if:
condition:
lambda: return id(remote_timer_running);
then:
- lambda: |-
if (id(remote_timer_remaining_seconds) > 0) {
id(remote_timer_remaining_seconds) -= 1;
}
- script.execute: control_leds
- if:
condition:
lambda: return id(remote_timer_running) && (id(remote_timer_remaining_seconds) <= 0);
then:
- lambda: |-
id(remote_timer_running) = false;
- switch.turn_on: timer_ringing
- script.execute: control_leds
number:
- platform: template
id: remote_timer_seconds
name: "Remote Timer Seconds"
icon: mdi:timer
min_value: 0
max_value: 7200
step: 1
optimistic: true
restore_value: true
set_action:
- lambda: |-
int v = (int) x;
if (v < 0) v = 0;
id(remote_timer_total_seconds) = v;
id(remote_timer_remaining_seconds) = v;
id(control_leds).execute();
binary_sensor:
- platform: template
id: remote_timer_running_sensor
name: "Remote Timer Running"
device_class: running
lambda: |-
return id(remote_timer_running);
sensor:
- platform: template
id: remote_timer_remaining_seconds_sensor
name: "Remote Timer Remaining Seconds"
icon: mdi:timer-sand
unit_of_measurement: s
accuracy_decimals: 0
update_interval: 1s
lambda: |-
return id(remote_timer_remaining_seconds);
button:
- platform: template
id: remote_timer_start
name: "Remote Timer Start"
icon: mdi:play
on_press:
- lambda: |-
id(remote_timer_remaining_seconds) = id(remote_timer_total_seconds);
id(remote_timer_running) = (id(remote_timer_remaining_seconds) > 0);
- switch.turn_off: timer_ringing
- script.execute: control_leds
- platform: template
id: remote_timer_cancel
name: "Remote Timer Cancel"
icon: mdi:stop
on_press:
- lambda: |-
id(remote_timer_running) = false;
id(remote_timer_total_seconds) = 0;
id(remote_timer_remaining_seconds) = 0;
- switch.turn_off: timer_ringing
- script.execute: control_leds
esphome:
name: ${node_name}
name_add_mac_suffix: true
friendly_name: ${friendly_name}
min_version: 2026.4.0
project:
name: ${company_name}.${project_name}
version: ${esp32_fw_version}
on_boot:
- priority: -100
then:
- logger.log: "${company_name} ${project_name} ${component_name} running ESP firmware: ${esp32_fw_version} and XMOS firmware: ${xmos_fw_version}"
# Run the script to refresh the LED status
- script.execute: control_leds
- delay: 1s
# if line_out was used previously but is not available try speaker
- lambda: |
if( !id(line_out_sensor).state && id(dac_proxy).active_dac == 1){
id(dac_proxy).activate_speaker();
}
# If after 10 minutes, the device is still initializing (It did not yet connect to Home Assistant), turn off the init_in_progress variable and run the script to refresh the LED status
- delay: 10min
- if:
condition:
lambda: return id(init_in_progress);
then:
- lambda: id(init_in_progress) = false;
- script.execute: control_leds
ota:
- platform: esphome
id: ota_esphome
logger:
level: DEBUG
logs:
sensor: WARN # avoids logging frequent sensor updates
dashboard_import:
package_import_url: github://TaterTotterson/microWakeWords/satellite1-TaterTimer.yaml@main
import_full_config: true
external_components:
- source:
type: git
url: https://github.com/TaterTotterson/microWakeWords
ref: main
path: sat1/components
components:
- fusb302b
- i2s_audio
- memory_flasher
- pcm5122
- satellite1
- satellite1_radar
- tas2780
refresh: 0s
packages:
TaterTotterson.Sat1:
url: https://github.com/TaterTotterson/microWakeWords
ref: main
files:
- sat1/dashboard_build.yaml
- sat1/core_board.yaml
- sat1/wifi_improv.yaml
- sat1/hat_sensors.yaml
- sat1/buttons.yaml
- sat1/home_assistant.yaml
- sat1/media_player.yaml
- sat1/voice_assistant.yaml
- sat1/timer.yaml
- sat1/led_ring.yaml
## OPTIONAL COMPONENTS
# - sat1/mmwave_ld2410.yaml
# - sat1/mmwave_ld2450.yaml
# - sat1/debug.yaml
# - sat1/developer.yaml
wifi:
ssid: ${wifi_ssid}
password: ${wifi_password}
use_address: ${ha_voice_ip}
fast_connect: ${hidden_ssid}
http_request:
safe_mode:
status_led:
pin:
number: GPIO45
ignore_strapping_warning: true
satellite1:
id: satellite1_id
spi_id: spi_0
cs_pin: GPIO10
data_rate: 8000000
spi_mode: MODE3
xmos_rst_pin: GPIO4
on_xmos_no_response:
then:
- text_sensor.template.publish:
id: xmos_firmware_version_text
state: !lambda 'return id(satellite1_id).status_string();'
on_xmos_connected:
then:
- text_sensor.template.publish:
id: xmos_firmware_version_text
state: !lambda 'return id(satellite1_id).status_string();'
memory_flasher:
- platform: satellite1
id: xflash
embed_flash_image:
image_version: ${xmos_fw_version}
image_file: https://raw.githubusercontent.com/FutureProofHomes/Documentation/refs/heads/main/assets/firmware/xmos/${xmos_fw_version}/satellite1_firmware_fixed_delay.factory.bin
md5_file: https://raw.githubusercontent.com/FutureProofHomes/Documentation/refs/heads/main/assets/firmware/xmos/${xmos_fw_version}/satellite1_firmware_fixed_delay.factory.md5
on_flashing_start:
then:
- lambda: id(xmos_flashing_state) = 1;
- script.execute: control_leds
on_progress_update:
then:
- lambda: id(global_led_animation_index) = id(xflash).flashing_progress * 24 / 100;
- script.execute: control_leds
on_flashing_success:
then:
- logger.log: "success called"
- lambda: id(xmos_flashing_state) = 2;
- script.execute: control_leds
- lambda: id(xmos_flashing_state) = 0;
- if:
condition:
lambda: |-
return id(pd_fusb302b).contract_voltage >= 9;
then:
- tas2780.activate:
mode: 2
else:
- tas2780.activate:
mode: 0
on_flashing_failed:
then:
- logger.log: "failed called"
- lambda: id(xmos_flashing_state) = 3;
- script.execute: control_leds
- lambda: id(xmos_flashing_state) = 0;
on_erasing_done:
then:
- if:
condition:
lambda: return id(factory_reset_requested);
then:
- button.press: factory_reset_button