-
Notifications
You must be signed in to change notification settings - Fork 0
/
tagtuner-atom-grove.yaml
257 lines (245 loc) · 5.71 KB
/
tagtuner-atom-grove.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
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
# These substitutions allow the end user to override certain values
substitutions:
name: "tagtuner"
friendly_name: "TagTuner"
esphome:
name: "${name}"
friendly_name: ${friendly_name}
# Automatically add the mac address to the name
# so you can use a single firmware for all devices
name_add_mac_suffix: true
# hello world
on_boot:
priority: -100
then:
- light.turn_on:
id: led1
effect: HelloWorld
- delay: 1000ms
- light.turn_off: led1
- wait_until:
condition:
api.connected:
timeout: 20s
- text_sensor.template.publish:
id: status
state: "Ready"
esp32:
board: m5stack-atom
framework:
type: arduino
# To be able to get logs from the device via serial and api.
logger:
# level: VERBOSE
level: DEBUG
# level: WARN
logs:
light: WARN
# pn532: DEBUG
# pn532_i2c: DEBUG
packages:
core-nfc: github://luka6000/TagTuner/tagtuner-core-nfc.yaml@main
core-comms: github://luka6000/TagTuner/tagtuner-core-comms.yaml@main
# core-nfc: !include tagtuner-core-nfc.yaml
# core-comms: !include tagtuner-core-comms.yaml
i2c:
id: bus_i2c
sda: 26
scl: 32
scan: False
frequency: 100kHz
timeout: 13ms #to prevent pn532 timeout
i2s_audio:
- id: i2s_audio_bus
i2s_lrclk_pin: GPIO33
i2s_bclk_pin: GPIO19
media_player:
- platform: i2s_audio
id: mp1
name: Player
dac_type: external
i2s_dout_pin: GPIO22
mode: mono
binary_sensor:
- platform: gpio
id: toggle
pin:
number: GPIO39
inverted: true
on_multi_click:
- timing:
- ON for at most 300ms
- OFF for at most 250ms
- ON for at most 300ms
- OFF for at least 50ms
then:
- script.execute: led_blink
- logger.log: "Double Clicked"
- text_sensor.template.publish:
id: status
state: "clickDouble"
- homeassistant.event:
event: esphome.tagtuner
data:
action: "clickDouble"
- timing:
- ON for 0.5s to 2s
- OFF for at least 50ms
then:
- script.execute: led_blink
- logger.log: "Single Long Clicked"
- text_sensor.template.publish:
id: status
state: "clickLong"
- homeassistant.event:
event: esphome.tagtuner
data:
action: "clickLong"
- timing:
- ON for at most 300ms
- OFF for at least 260ms
then:
- script.execute: led_blink
- logger.log: "Single Short Clicked"
- text_sensor.template.publish:
id: status
state: "clickSingle"
- homeassistant.event:
event: esphome.tagtuner
data:
action: "clickSingle"
light:
- platform: esp32_rmt_led_strip
id: led1
pin: GPIO27
chipset: SK6812
num_leds: 1
rgb_order: grb
rmt_channel: 0
restore_mode: ALWAYS_OFF
default_transition_length: 0s
flash_transition_length: 0s
effects:
- strobe:
name: HelloWorld
colors:
- state: true
brightness: 100%
red: 100%
green: 0%
blue: 0%
duration: 250ms
- state: true
brightness: 100%
red: 0%
green: 100%
blue: 0%
duration: 250ms
- state: true
brightness: 100%
red: 0%
green: 0%
blue: 100%
duration: 250ms
- state: true
brightness: 100%
red: 100%
green: 100%
blue: 100%
duration: 250ms
- strobe:
name: TagWrite
colors:
- state: true
brightness: 100%
red: 100%
green: 0%
blue: 0%
duration: 250ms
- state: false
duration: 50ms
script:
- id: led_blink
then:
- light.turn_off: led1
- light.turn_on:
id: led1
brightness: 60%
red: 100%
green: 100%
blue: 100%
flash_length: 100ms
- id: led_ok
then:
- light.turn_off: led1
- light.turn_on:
id: led1
brightness: 100%
red: 0%
green: 100%
blue: 0%
flash_length: 50ms
- delay: 100ms
- light.turn_on:
id: led1
brightness: 100%
red: 0%
green: 100%
blue: 0%
flash_length: 50ms
- id: led_success
then:
- light.turn_off: led1
- light.turn_on:
id: led1
brightness: 100%
red: 0%
green: 100%
blue: 0%
flash_length: 200ms
- delay: 250ms
- light.turn_on:
id: led1
brightness: 100%
red: 0%
green: 100%
blue: 0%
flash_length: 200ms
- delay: 250ms
- light.turn_on:
id: led1
brightness: 100%
red: 0%
green: 100%
blue: 0%
flash_length: 500ms
- id: led_tagwrite
then:
- light.turn_on:
id: led1
effect: TagWrite
sensor:
- platform: rotary_encoder
id: rotary
pin_a: 25
pin_b: 21
min_value: 0
max_value: 20
on_clockwise:
- text_sensor.template.publish:
id: status
state: "Volume up"
- homeassistant.event:
event: esphome.tagtuner
data:
action: "volume_up"
- script.execute: led_blink
on_anticlockwise:
- text_sensor.template.publish:
id: status
state: "Volume down"
- homeassistant.event:
event: esphome.tagtuner
data:
action: "volume_down"
- script.execute: led_blink