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
| esphome:
name: espdisplay2
platform: ESP8266
board: d1_mini
# Enable logging
logger:
# level: VERY_VERBOSE
# Enable Home Assistant API
api:
ota:
password: "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
wifi:
ssid: "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
password: "xxxxxxxxxxxxxxxxxxxxxxxxxx"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Espdisplay2 Fallback Hotspot"
password: "xxxxxxxxxxxxxxxxxxxx"
captive_portal:
output:
- platform: esp8266_pwm
id: output_component1
pin: D8
light:
- platform: monochromatic
name: "LCD backlight"
output: output_component1
spi:
clk_pin: D5
mosi_pin: D7
miso_pin: D6
font:
- file: 'slkscr.ttf'
id: font1
size: 16
- file: 'arial.ttf'
id: font3
size: 20
- file: 'arial.ttf'
id: font28
size: 28
- file: 'arial.ttf'
id: font40
size: 40
globals:
- id: rotate
type: boolean
initial_value: "true"
sensor:
- platform: homeassistant
id: inside_temperature
entity_id: sensor.living_room_temperature
internal: true
- platform: homeassistant
id: outside_temperature
entity_id: sensor.openweathermap_temperature
internal: true
- platform: homeassistant
id: net_in
entity_id: sensor.electricity_meter_power_consumption
internal: true
filters:
multiply: 1000
- platform: homeassistant
id: net_out
entity_id: sensor.electricity_meter_power_production
internal: true
filters:
multiply: 1000
- platform: homeassistant
id: solar
entity_id: sensor.solarman_output_active_power
internal: true
accuracy_decimals: 0
- platform: homeassistant
id: solarday
entity_id: sensor.solarman_daily_production
accuracy_decimals: 2
switch:
- platform: template
name: rotate2
id: rotate2
turn_on_action:
then:
- globals.set:
id: rotate
value: 'true'
- switch.template.publish:
id: rotate2
state: 'ON'
turn_off_action:
then:
- globals.set:
id: rotate
value: 'false'
- switch.template.publish:
id: rotate2
state: 'OFF'
button:
- platform: template
name: next
id: next
on_press:
then:
- display.page.show_next: my_display
- component.update: my_display
time:
- platform: homeassistant
id: esptime
timezone: Europe/Amsterdam
display:
- platform: st7735
model: "INITR_BLACKTAB"
id: my_display
reset_pin: D3
cs_pin: GPIO4
dc_pin: GPIO5
rotation: 90
device_width: 80
device_height: 160
col_start: 26
row_start: 1
use_bgr: true
invert_colors: true
eight_bit_color: true
update_interval: 1s
pages:
- id: page1
lambda: |-
auto red = Color(255, 0, 0);
auto green = Color(0, 255, 0);
auto blue = Color(0, 0, 255);
it.rectangle(0, 0, 159, 79, blue);
it.line(0,54,159,54, blue);
it.line(79,0,79,54,blue);
it.print(5,5, id(font1),blue, "Binnen");
it.printf(6, 24, id(font3), red, TextAlign::TOP_LEFT , "%.1f°C", id(inside_temperature).state);
it.print(85,5, id(font1),blue, "Buiten");
it.printf(85, 24, id(font3), red, TextAlign::TOP_LEFT , "%.1f°C", id(outside_temperature).state);
it.strftime(40, 56, id(font3), green, TextAlign::TOP_LEFT, "%H:%M:%S", id(esptime).now());
- id: page2
lambda: |-
auto red = Color(255, 0, 0);
auto green = Color(0, 155, 0);
auto blue = Color(0, 0, 255);
it.rectangle(0, 0, 159, 79, blue);
it.print(10, 8, id(font1), red, "In:");
if (id(net_in).has_state()) {
it.printf(60, 3, id(font3), red, TextAlign::TOP_LEFT , "%.0f W", id(net_in).state);
}
it.print(10, 33, id(font1), green, "Out:");
if (id(net_out).has_state()) {
it.printf(60, 28, id(font3), green, TextAlign::TOP_LEFT , "%.0f W", id(net_out).state);
}
it.print(10, 58, id(font1), blue, "Zon:");
if (id(net_out).has_state()) {
it.printf(60, 53, id(font3), blue, TextAlign::TOP_LEFT , "%.0f W", id(solar).state);
}
- id: page3
lambda: |-
auto red = Color(255, 0, 0);
auto green = Color(0, 155, 0);
auto blue = Color(0, 0, 255);
it.print(5,5, id(font1),blue, "Netto verbruik");
it.rectangle(0, 0, 159, 79, blue);
it.printf(5,25, id(font40), green, TextAlign::TOP_LEFT , "%.0f W", (id(net_in).state - id(net_out).state) );
- id: page4
lambda: |-
auto red = Color(255, 0, 0);
auto green = Color(0, 155, 0);
auto blue = Color(0, 0, 255);
it.printf(10,5, id(font28),green, " %.2f kWh", id(solarday).state);
it.rectangle(0, 0, 159, 79, blue);
it.printf(5,36, id(font40), green, TextAlign::TOP_LEFT , "%.0f W", id(solar).state);
- id: page5
lambda: |-
auto green = Color(0, 155, 0);
auto blue = Color(0, 0, 255);
it.rectangle(0, 0, 159, 79, blue);
it.strftime(3,10, id(font40), green, TextAlign::TOP_LEFT , "%H:%M:%S", id(esptime).now());
it.strftime(20,60, id(font1), green, TextAlign::TOP_LEFT , "%d-%m-%Y", id(esptime).now());
interval:
- interval: 5s
then:
if:
condition:
lambda: 'return id(rotate);'
#binary_sensor.is_on:rotate
then:
- display.page.show_next: my_display
- component.update: my_display
|