-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathulanzi.yaml
353 lines (332 loc) · 9.63 KB
/
ulanzi.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
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
343
344
345
346
347
348
349
350
351
352
353
substitutions:
devicename: ulanzi
friendly_name: LED Matrix
board: esp32dev
# Pin definition from https://github.com/aptonline/PixelIt_Ulanzi
battery_pin: GPIO34
buzzer_pin: GPIO15
ldr_pin: GPIO35
matrix_pin: GPIO32
left_button_pin: GPIO26
mid_button_pin: GPIO27
right_button_pin: GPIO14
scl_pin: GPIO22
sda_pin: GPIO21
switch:
- platform: template
name: "Auto-Adjust Brightness"
id: switch_autobrightness
icon: mdi:brightness-auto
restore_mode: RESTORE_DEFAULT_ON
lambda: |-
if (id(aab_enable)) {
return true;
} else {
return false;
}
turn_on_action:
lambda: |-
id(aab_enable) = true;
turn_off_action:
lambda: |-
id(aab_enable) = false;
## Getting Dressed Helper
## When enabled, change clock color on work days from white to yellow to red
- platform: template
name: "Getting Dressed Hint"
id: switch_getting_dressed_hint
restore_mode: RESTORE_DEFAULT_ON
lambda: |-
if (id(gdh_enable)) {
return true;
} else {
return false;
}
turn_on_action:
lambda: |-
id(gdh_enable) = true;
turn_off_action:
lambda: |-
id(gdh_enable) = false;
globals:
# aab = auto-adjustable brightness
- id: aab_enable
type: "bool"
restore_value: true
initial_value: "true"
- id: aab_add
type: int
initial_value: "10"
- id: aab_max
type: int
initial_value: "220"
- id: aab_min
type: int
initial_value: "20"
# gdh = getting dressed hint
- id: gdh_enable
type: "bool"
restore_value: true
initial_value: "true"
external_components:
- source:
type: git
url: https://github.com/lubeda/EspHoMaTriXv2
ref: 2024.3.0
refresh: 60s
components: [ehmtxv2]
esphome:
comment: "EHMTXv2 from LuBeDa"
name: $devicename
project:
name: "Ulanzi.EHMTXv2"
version: "2.0.0"
on_boot:
then:
- ds1307.read_time:
output:
- platform: gpio
pin:
number: GPIO15
ignore_strapping_warning: true
id: buzzer_pin
esp32:
board: esp32dev
image:
- file: 1pixel.gif
id: breaking20237
animation:
- file: 1pixel.gif
id: breaking202371
font:
# Font included in this folder
# - file: mateine.ttf
# size: 16
# id: default_font
# glyphs: |
# !?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnÖÄÜöäüopqrstuvwxyz@<>ߧ€/
# Matrix Clock Fonts
# Grab these from https://github.com/trip5/Matrix-Fonts
# See https://github.com/lubeda/EspHoMaTriXv2#font
# Store in a "fonts" subfolder of your ESPHome config folder or change paths below
- file: fonts/MatrixLight6.bdf
id: default_font
glyphs: |
! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¡¢£¤¦§©ª«®°±²³´µ¶¥·¹º»¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
- file: fonts/MatrixLight8.bdf
id: special_font
glyphs: |
! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¡¢£¤¦§©ª«®°±²³´µ¶¥·¹º»¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
binary_sensor:
- platform: status
name: "$devicename Status"
- platform: gpio
pin:
number: $left_button_pin
inverted: true
name: "Left button"
- platform: gpio
pin:
inverted: true
number: $mid_button_pin
mode: INPUT_PULLUP
name: "Middle button"
- platform: gpio
pin:
number: $right_button_pin
inverted: true
name: "Right button"
logger:
level: WARN
api:
sensor:
- platform: sht3xd
temperature:
name: "$devicename Temperature"
id: sensor_temperature
humidity:
name: "$devicename Relative Humidity"
id: sensor_humidity
update_interval: 60s
- platform: adc
pin: $battery_pin
name: "$devicename Battery"
id: battery_voltage
update_interval: 10s
device_class: battery
accuracy_decimals: 0
attenuation: auto
filters:
- sliding_window_moving_average:
window_size: 15
send_every: 15
send_first_at: 1
- multiply: 1.6
- lambda: |-
auto r = ((x - 3) / 0.69 * 100.00);
if (r >= 100) return 100;
if (r > 0) return r;
if (r <= 0) return 1;
return 0;
unit_of_measurement: "%"
- platform: adc
id: light_sensor
name: "$devicename Illuminance"
pin: $ldr_pin
update_interval: 10s
attenuation: auto
unit_of_measurement: lx
device_class: illuminance
accuracy_decimals: 0
filters:
- lambda: |-
return (x / 10000.0) * 2000000.0 - 15 ;
on_value:
then:
- lambda: |-
if ( id(aab_enable) ) {
int n = x / 4 + id(aab_add); // new_value
if (n > id(aab_max)) n = id(aab_max);
if (n < id(aab_min)) n = id(aab_min);
int c = id(rgb8x32)->get_brightness(); // current value
c = c>0?c:1 ;
int d = (n - c) * 100 / c; // diff in %
if ( abs(d) > 2 ) id(rgb8x32)->set_brightness(n);
}
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
web_server:
i2c:
sda: $sda_pin
scl: $scl_pin
scan: true
id: i2cbus
light:
- platform: neopixelbus
id: ehmtx_light
type: GRB
internal: true
variant: WS2812
pin: $matrix_pin
num_leds: 256
color_correct: [30%, 30%, 30%]
gamma_correct: 2.0
name: "$devicename Light"
restore_mode: ALWAYS_OFF
time:
- platform: homeassistant
timezone: Europe/Berlin
on_time_sync:
then:
ds1307.write_time:
- platform: ds1307
update_interval: never
id: ehmtx_time
on_time:
- seconds: /10
minutes: 45-59
hours: 6
days_of_week: MON-FRI
then:
- lambda: |-
auto time = id(ehmtx_time).now();
if (id(gdh_enable)) {
// Super sophisticated percentage calculation for RED value
int s = time.second + (time.minute - 45) * 60;
int r = s / 900 * 255;
id(rgb8x32)->set_clock_color(r, 255, 0);
}
- seconds: /10
minutes: 0-10
hours: 7
days_of_week: MON-FRI
then:
- lambda: |-
auto time = id(ehmtx_time).now();
if (id(gdh_enable)) {
// Super sophisticated percentage calculation for GREEN value
int s = time.second + time.minute * 60;
int g = 255 - s / 600 * 255;
id(rgb8x32)->set_clock_color(255, g, 0);
}
- seconds: 0
minutes: 15
hours: 7
days_of_week: MON-FRI
then:
- lambda: |-
id(rgb8x32)->set_clock_color(255, 255, 255);
display:
- platform: addressable_light
id: ehmtx_display
addressable_light_id: ehmtx_light
width: 32
height: 8
pixel_mapper: |-
if (y % 2 == 0) {
return (y * 32) + x;
}
return (y * 32) + (31 - x);
rotation: 0°
update_interval: 16ms
auto_clear_enabled: true
lambda: |-
id(rgb8x32)->tick();
id(rgb8x32)->draw();
ehmtxv2:
id: rgb8x32
icons2html: false
matrix_component: ehmtx_display
time_component: ehmtx_time
time_format: "%H:%M"
date_format: "%d.%m."
show_seconds: false
# Uncomment below if using the mateine font
# default_font_id: default_font
# special_font_id: default_font
# Comment out below if using mateine font
default_font_id: default_font
default_font_yoffset: 7
special_font_id: special_font
# until here
blend_steps: 16
week_start_monday: true
weekdays: SOMODIMIDOFRSA
icons:
- id: error
lameid: 40530
- id: home_assistant
lameid: 47693
- id: temperature
lameid: 2056
- id: tv
lameid: 7862
- id: humidity
lameid: 48556
- id: washing_running
lameid: 54281
- id: washing_done
lameid: 54282
- id: balloons
lameid: 54735
- id: sleep8x32
url: https://user-images.githubusercontent.com/16407309/224850723-634c9b2d-55d9-44f2-9f93-765c0485b090.gif
on_next_screen:
- homeassistant.event:
event: esphome.new_screen
data_template:
iconname: !lambda "return icon.c_str();"
text: !lambda "return text.c_str();"
on_empty_queue:
then:
lambda: |-
id(rgb8x32)->clock_screen(10,10);
id(rgb8x32)->date_screen(10,5);
on_start_running:
then:
lambda: |-
id(rgb8x32)->bitmap_screen("[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63519,63519,63519,63519,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63519,0,0,0,0,2016,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,63488,0,63488,0,0,0,63519,0,0,0,0,2016,2016,0,0,0,65514,0,65514,0,0,0,31,0,0,0,64512,0,0,64512,0,63488,63488,0,63488,63488,0,0,63519,63519,63519,0,0,2016,0,2016,0,65514,0,65514,0,65514,0,31,31,31,0,0,0,64512,64512,0,0,63488,63488,63488,63488,63488,0,0,63519,0,0,0,0,2016,0,2016,0,65514,0,65514,0,65514,0,0,31,0,0,0,0,64512,64512,0,0,0,63488,63488,63488,0,0,0,63519,63519,63519,63519,0,2016,0,2016,0,65514,0,65514,0,65514,0,0,0,31,31,0,64512,0,0,64512,0,0,0,63488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]", 0, 10);
id(rgb8x32)->bitmap_small("[2016,0,0,0,2016,0,0,0,2016,0,0,0,2016,0,0,0,2016,0,0,0,2016,0,0,0,0,2016,0,2016,0,31,31,0,0,0,2016,0,31,0,0,31,0,0,0,0,0,0,31,0,0,0,0,0,0,31,0,0,0,0,0,0,31,31,31,31]", "2024.3.0", 0, 10);