-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtagtuner-D1-custom1.yaml
213 lines (202 loc) · 4.72 KB
/
tagtuner-D1-custom1.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
packages:
project: github://luka6000/TagTuner/tagtuner-project.yaml@main
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
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: TagWrite
- delay: 1000ms
- light.turn_off: led1
- wait_until:
condition:
api.connected:
timeout: 20s
- text_sensor.template.publish:
id: status
state: "Ready"
esp32:
board: wemos_d1_mini32
framework:
type: esp-idf
# 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
i2c:
id: bus_i2c
sda: 21
scl: 22
scan: False
frequency: 100kHz
timeout: 13ms #to prevent pn532 timeout
esp32_ble_tracker:
scan_parameters:
active: false
bluetooth_proxy:
active: false
binary_sensor:
- platform: gpio
id: toggle
pin:
number: 23
inverted: true
mode:
input: true
pullup: true
on_multi_click:
- timing:
- ON for at most 1s
- OFF for at most 0.25s
- ON for at most 1s
- OFF for at most 0.25s
- ON for at most 1s
then:
- script.execute: led_blink
- logger.log: "Triple Clicked"
- text_sensor.template.publish:
id: status
state: "clickTriple"
- script.execute:
id: action_event
action: "clickTriple"
- timing:
- ON for at most 1s
- OFF for at most 0.25s
- ON for at most 1s
- OFF for at least 0.25s
then:
- script.execute: led_blink
- logger.log: "Double Clicked"
- text_sensor.template.publish:
id: status
state: "clickDouble"
- script.execute:
id: action_event
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"
- script.execute:
id: action_event
action: "clickLong"
- timing:
- ON for at most 0.5s
- OFF for at least 260ms
then:
- script.execute: led_blink
- logger.log: "Single Short Clicked"
- text_sensor.template.publish:
id: status
state: "clickSingle"
- script.execute:
id: tagtuner_event
action: "clickSingle"
uid: ""
uri: ""
artist: ""
playlist: ""
output:
- platform: gpio
pin: 2
id: led1_gpio
light:
- platform: binary
id: led1
output: led1_gpio
restore_mode: ALWAYS_OFF
effects:
- strobe:
name: TagWrite
colors:
- state: true
duration: 250ms
- state: false
duration: 50ms
script:
- id: led_blink
then:
- light.turn_off: led1
- light.turn_on:
id: led1
flash_length: 100ms
- id: led_ok
then:
- light.turn_off: led1
- light.turn_on:
id: led1
flash_length: 50ms
- delay: 100ms
- light.turn_on:
id: led1
flash_length: 50ms
- id: led_success
then:
- light.turn_off: led1
- light.turn_on:
id: led1
flash_length: 200ms
- delay: 250ms
- light.turn_on:
id: led1
flash_length: 200ms
- delay: 250ms
- light.turn_on:
id: led1
flash_length: 500ms
- id: led_tagwrite
then:
- light.turn_on:
id: led1
effect: TagWrite
sensor:
- platform: rotary_encoder
id: rotary
pin_a: 18
pin_b: 19
on_clockwise:
- text_sensor.template.publish:
id: status
state: "Volume up"
- script.execute:
id: tagtuner_event
action: "volumeUp"
uid: ""
uri: ""
artist: ""
playlist: ""
- script.execute: led_blink
on_anticlockwise:
- text_sensor.template.publish:
id: status
state: "Volume down"
- script.execute:
id: tagtuner_event
action: "volumeDown"
uid: ""
uri: ""
artist: ""
playlist: ""
- script.execute: led_blink