-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patha1-slwf-03-voice-assistant.yaml
96 lines (81 loc) · 1.82 KB
/
a1-slwf-03-voice-assistant.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
esphome:
name: a1-slwf-03-voice-assistant
friendly_name: a1-slwf-03-voice-assistant
project:
name: slwf03.voice-assistant
version: "1.0"
min_version: 2023.11.1
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
on_connect:
- delay: 5s # Gives time for improv results to be transmitted
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "A1-Slwf-03-Voice-Assistant"
password: "a1slwf03"
captive_portal:
button:
- platform: factory_reset
id: factory_reset_btn
name: Factory reset
i2s_audio:
i2s_lrclk_pin: GPIO15
i2s_bclk_pin: GPIO14
microphone:
- platform: i2s_audio
id: slwf03_microphone
i2s_din_pin: GPIO32
adc_type: external
pdm: true
voice_assistant:
microphone: slwf03_microphone
binary_sensor:
- platform: gpio
name: "Voice"
pin:
number: GPIO26
inverted: false
on_press:
- voice_assistant.start:
on_release:
- voice_assistant.stop:
# Uptime sensor register
sensor:
- platform: uptime
id: uptime_s
update_interval: 60s
text_sensor:
- platform: template
name: "SLWF-03 Uptime"
lambda: |-
uint32_t dur = id(uptime_s).state;
int dys = 0;
int hrs = 0;
int mnts = 0;
if (dur > 86399) {
dys = trunc(dur / 86400);
dur = dur - (dys * 86400);
}
if (dur > 3599) {
hrs = trunc(dur / 3600);
dur = dur - (hrs * 3600);
}
if (dur > 59) {
mnts = trunc(dur / 60);
dur = dur - (mnts * 60);
}
char buffer[17];
sprintf(buffer, "%ud %02uh %02um %02us", dys, hrs, mnts, dur);
return {buffer};
icon: mdi:clock-start
update_interval: 60s