-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmatrixleddemo.yaml
106 lines (83 loc) · 2.33 KB
/
matrixleddemo.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
# Example for some matrix led effects, especially a scrolling clock/mqtt text display
# set the text via:
# mosquitto_pub -h mqtthost -t text/text -m "Hi there!"
substitutions:
devicename: leggedlamp
xscrollpadding: "4" # in pix
esphome:
name: $devicename
platform: ESP32
board: esp32dev
on_boot:
priority: -10
then: # stop the flickering
- lambda: |-
fastled_base_fastledlightoutput->get_controller()->setDither(0);
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
# workaround for "wifi auth expired"
#https://community.home-assistant.io/t/esphome-wifi-auth-expired/443790/22
i2c:
sda: 22
scl: 23
frequency: 200kHz
mqtt:
id: mqtt_client
broker: !secret mqtt_broker
# username: !secret mqtt_user
# password: !secret mqtt_password
text_sensor:
- platform: mqtt_subscribe
name: "Text"
id: extratext
topic: text/text
logger:
debug:
ota:
font:
- id: tinyfont
file: "DejaVuSans-Bold.ttf"
size: 9
glyphs: '♡Ωäöüß!"%()+,-_.:*=°?~#0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz'
time:
- platform: sntp
id: rtctime
light:
- platform: fastled_clockless
chipset: SK6812
pin: GPIO26
num_leds: 64
rgb_order: GRB
name: "$devicename Light"
id: mylight
color_correct: [40%, 40%, 40%]
display:
- platform: addressable_light
id: led_matrix_display
addressable_light_id: mylight
width: 8
height: 8
rotation: 270°
# use a pixel mapper, if needed (cf. https://esphome.io/components/display/addressable_light.html)
# pixel_mapper: |-
# if (x % 2 == 0) {
# return (x * 8) + y;
# }
# return (x * 8) + (7 - y);
update_interval: 200ms
lambda: |-
static uint16_t xpos = 0;
const char * text = id(extratext).state.c_str();
int x_start, y_start;
int width, height;
it.get_text_bounds(0, 0, text, id(tinyfont),
TextAlign::TOP_LEFT, &x_start, &y_start, &width, &height);
it.print(-(xpos % (width + $xscrollpadding)), -2,
id(tinyfont), Color(0xFF1010),
TextAlign::TOP_LEFT, text);
if (width > it.get_width()) // only scroll if nesessary
xpos++;
else
xpos = 0;