-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm5-atom-matrix-raphael.yaml
144 lines (125 loc) · 4.1 KB
/
m5-atom-matrix-raphael.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
---
substitutions:
devicename: m5atom_marquee
upper_devicename: M5Atom Marquee
mqtt_broker: homeassistant
matrixwidth: "5"
matrixheight: "5"
esphome:
name: $devicename
platform: ESP32
board: pico32
includes:
- includes/my_matrixled_scrolling_display.h
on_boot:
priority: -10
then: # stop the flickering
- lambda: |-
fastled_base_fastledlightoutput->get_controller()->setDither(0);
- light.turn_on:
id: light1
brightness: 80%
effect: "addressable_rainbow"
- delay: 5s
- light.turn_on:
id: light1
brightness: 80%
effect: "Scrolling Info"
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
#ap:
# ssid: Fallback ${device_name}
manual_ip:
# pour une connection rapide, et pour que le conteneur docker esphome puisse trouver l'ESP sans mDNS
static_ip: 192.168.1.44
gateway: 192.168.1.1
subnet: 255.255.255.0
# si pas de connexion WiFi, créer un hotspot wifi
#captive_portal:
logger:
api:
ota:
password: !secret ota_password
mqtt:
broker: 192.168.1.252
discovery: true
text_sensor:
- platform: mqtt_subscribe
name: ${upper_devicename} Text
id: text1
topic: ${devicename}/text
font:
- id: tinyfont
file: "resources/DejaVuSans.ttf"
size: 7
binary_sensor:
- platform: gpio
pin:
number: GPIO39
inverted: true
name: ${upper_devicename} Button
sensor:
- platform: wifi_signal
name: ${upper_devicename} WiFi Signal
- platform: uptime
name: ${upper_devicename} Uptime
switch:
- platform: restart
name: ${upper_devicename} Restart
light:
- platform: fastled_clockless
chipset: WS2812B
pin: GPIO27
num_leds: 25
rgb_order: GRB
name: ${upper_devicename} Led Matrix
id: light1
color_correct: [40%, 40%, 40%]
effects:
- addressable_rainbow:
- addressable_color_wipe:
- addressable_scan:
- addressable_twinkle:
- addressable_random_twinkle:
- addressable_fireworks:
- addressable_lambda:
name: "Scrolling Info"
update_interval: 120ms
lambda: |-
static uint16_t run = 0;
static auto scrolldisp = new MatrixLedScrollingDisplay();
static char text[64] = "WAITING FOR DATA ";
static int fullwidth = 32;
if (run == 0) {
scrolldisp->set_size($matrixwidth * 30, $matrixheight); // Set the maximum size of the scrollable area here!
}
if (run % fullwidth == 0) {
scrolldisp->fill(Color(0, 0, 0));
if(id(text1).has_state())
sprintf(text, "%s ", id(text1).state.c_str());
int x_start=5, y_start=-2;
int width, height;
Color c;
if(text[0] == '+')
c = Color(0, 255, 0);
else if(text[0] == '-')
c = Color(255, 0, 0);
else
c = Color(current_color.r * 255, current_color.g * 255, current_color.b * 255);
scrolldisp->print(x_start, y_start, id(tinyfont), c, text);
// Wrap the scrolling to the actual size of the text
scrolldisp->get_text_bounds(x_start, y_start, text, id(tinyfont), TextAlign::TOP_LEFT, &x_start, &y_start, &width, &height);
fullwidth = width + 4;
scrolldisp->set_wrapped_area(0, 0, width + 3, height + 1);
scrolldisp->dump_buffer();
run = 0;
}
scrolldisp->to_addressable_lights(
// (light::AddressableLight *) &it, $matrixwidth, $matrixheight, run, 0, (DisplayOrient) (DisplayOrient::DISPLAY_FLIP_HORIZONTAL | DisplayOrient::DISPLAY_ROTATION_270_DEGREES)
(light::AddressableLight *) &it, $matrixwidth, $matrixheight, run, 0, (DisplayOrient) (DisplayOrient::DISPLAY_FLIP_HORIZONTAL | DisplayOrient::DISPLAY_ROTATION_90_DEGREES)
);
run++;
display: