-
Notifications
You must be signed in to change notification settings - Fork 0
/
tdisplay-s3-amoled-test.yaml
269 lines (246 loc) · 6.48 KB
/
tdisplay-s3-amoled-test.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
esphome:
name: tdisplay-s3-amoled-test
friendly_name: tdisplay-s3-amoled-test
platformio_options:
build_unflags: -Werror=all
board_build.flash_mode: dio
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
framework:
type: esp-idf
external_components:
source: github://clydebarrow/esphome@amoled
components: [ qspi_amoled ]
refresh: 10min
spi:
id: quad_spi
clk_pin: 47
data_pins:
- ignore_strapping_warning: false
number: 18
- 7
- 48
- 5
psram:
mode: octal
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
encryption:
key: !secret api_secret
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "AP ${node_name}"
password: !secret wifi_ap_password
font:
- file: "fonts/Oswald-Light.ttf"
id: font_oswald_120
size: 96
- file: "fonts/Oswald-Light.ttf"
id: font_oswald_70
size: 70
- file: "fonts/Oswald-Light.ttf"
id: font_oswald_30
size: 30
- file: 'fonts/slkscr.ttf'
id: font_slkscr_8
size: 8
glyphs: "!%()+,-/_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
- file: 'fonts/slkscr.ttf'
id: font_slkscr_16
size: 16
glyphs: "!%()+,-/_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
- file: 'fonts/BebasNeue-Regular.ttf'
id: font_bebas_120
size: 120
- file: 'fonts/BebasNeue-Regular.ttf'
id: font_bebas_160
size: 160
- file: 'fonts/arial.ttf'
id: font_arial_16
size: 16
- file: 'fonts/arial.ttf'
id: font_arial_20
size: 20
color:
- id: color_red
red: 1
green: 0
blue: 0
- id: color_green
red: 0
green: 1
blue: 0
- id: color_blue
red: 0
green: 0
blue: 1
- id: color_orange
red: 1
green: 0.6
blue: 0
- id: color_teal_blue
red: 0
green: 0.5
blue: 0.45
- id: color_grey
red: 0.3
green: 0.3
blue: 0.3
- id: color_black
red: 0
green: 0
blue: 0
- id: color_white
red: 1
green: 1
blue: 1
time:
- platform: homeassistant
id: esptime
sensor:
- platform: adc
pin: GPIO04
attenuation: auto
filters:
- multiply: 2
name: VBatt
id: vcc
update_interval: 10s
- platform: template
name: "Battery Percentage"
update_interval: 30s
accuracy_decimals: 2
lambda: |-
return (id(vcc).state - 3.5) / 0.7 * 100.00;
id: battery_percentage
entity_category: diagnostic
unit_of_measurement: '%'
device_class: battery
- platform: homeassistant
id: dsmr_power_production
entity_id: sensor.electricity_meter_power_production
unit_of_measurement: 'W'
filters:
- multiply: 1000
- heartbeat: 5s
- platform: homeassistant
id: dsmr_power_consumption
entity_id: sensor.electricity_meter_power_consumption
unit_of_measurement: 'W'
filters:
- multiply: 1000
- heartbeat: 5s
- platform: homeassistant
id: dsmr_total_power
entity_id: sensor.dsmr_total_sl
unit_of_measurement: 'W'
- platform: homeassistant
id: solar_power
entity_id: sensor.dds238_2_solar_energy_power
unit_of_measurement: 'W'
binary_sensor:
# Button to cycle through pages on the display
- platform: gpio
pin:
number: GPIO21
inverted: true
id: button_1
on_press:
then:
- display.page.show_next: my_display
# - component.update: my_display
graph:
- id: dsmr_power_graph
duration: 30min
x_grid: 5min
y_grid: 500
width: 535
height: 80
border: false
traces:
- sensor: dsmr_power_consumption
line_type: SOLID
line_thickness: 3
color: color_red
- sensor: dsmr_power_production
line_type: SOLID
line_thickness: 2
color: color_green
display:
- platform: qspi_amoled
id: my_display
model: T-DISP-AMOLED
dimensions:
height: 240
width: 536
offset_height: 0
offset_width: 0
transform:
mirror_x: true
mirror_y: false
swap_xy: true
color_order: rgb
invert_colors: false
brightness: 175
cs_pin: 6
reset_pin: 17
enable_pin: 38
pages:
- id: page1
lambda: |-
auto white = Color(255, 255, 255);
auto test = Color(40, 40, 255);
auto purple = Color(102, 0, 204);
it.filled_rectangle(0, 0, 535, 20, test);
it.strftime(268, -2, id(font_arial_20), id(color_white), TextAlign::CENTER_HORIZONTAL, "%c", id(esptime).now());
//if (id(vcc).has_state()) {
//it.printf(4, 0, id(font_arial_16), id(color_teal_blue), "%.2f V (%.2f %%)", id(vcc).state, id(batterylevel).state);
//}
if (id(dsmr_total_power).has_state())
{
float pwr = id(dsmr_total_power).state;
if (pwr > 1000.0)
{
it.printf(268, 0, id(font_bebas_160), id(color_red), TextAlign::CENTER_HORIZONTAL, "%.0f W", id(dsmr_total_power).state);
}
else
{
if (pwr > 750.0)
{
it.printf(268, 0, id(font_bebas_160), id(color_orange), TextAlign::CENTER_HORIZONTAL, "%.0f W", id(dsmr_total_power).state);
}
else
{
if (pwr < 0.0)
{
it.printf(268, 0, id(font_bebas_160), id(color_blue), TextAlign::CENTER_HORIZONTAL, "%.0f W", id(dsmr_total_power).state);
}
else
{
it.printf(268, 0, id(font_bebas_160), id(color_green), TextAlign::CENTER_HORIZONTAL, "%.0f W", id(dsmr_total_power).state);
}
}
}
}
// Draw the graph
it.graph(1, 160, id(dsmr_power_graph), color_teal_blue);
- id: page2
lambda: |-
auto white = Color(255, 255, 255);
auto test = Color(40, 40, 255);
auto purple = Color(102, 0, 204);
it.filled_rectangle(0, 0, 535, 20, test);
it.strftime(268, -2, id(font_arial_20), id(color_white), TextAlign::CENTER_HORIZONTAL, "%c", id(esptime).now());
it.printf(268, 0, id(font_bebas_160), id(color_blue), TextAlign::CENTER_HORIZONTAL, "%.0f W", id(solar_power).state);
// Draw the graph
it.graph(1, 160, id(dsmr_power_graph), color_teal_blue);