-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay.yaml
189 lines (175 loc) · 7.63 KB
/
display.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
spi:
clk_pin: GPIO18
mosi_pin: GPIO19
color:
- id: my_red
red: 100%
green: 0%
blue: 0%
- id: my_yellow
red: 100%
green: 100%
blue: 0%
- id: my_green
red: 0%
green: 100%
blue: 0%
- id: my_blue
red: 0%
green: 0%
blue: 100%
- id: my_gray
red: 50%
green: 50%
blue: 50%
font:
- file: "Roboto-Medium.ttf"
id: tahoma_48
size: 48
- file: "Roboto-Medium.ttf"
id: tahoma_24
size: 24
display:
- platform: st7789v
id: "tft"
backlight_pin: GPIO4
cs_pin: GPIO5
dc_pin: GPIO16
reset_pin: GPIO23
rotation: 90
brightness: 0.5
update_interval: 0.5s
pages:
- id: ura_tft
lambda: |-
id(on_pec) = false;
id(on_bojler) = false;
id(on_histereza) = false;
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue));
it.rectangle(0, 40, it.get_width(), it.get_height(), id(my_blue)); // header bar
it.strftime((240 / 2), (140 / 3) * 1 + 10, id(tahoma_24), id(my_gray), TextAlign::CENTER, "%Y-%m-%d", id(esptime).now());
it.strftime((240 / 2), (140 / 3) * 2 + 10, id(tahoma_48), id(my_gray), TextAlign::CENTER, "%H:%M:%S", id(esptime).now());
it.print(5, 5, id(tahoma_24), id(my_yellow), TextAlign::TOP_LEFT, "Ura");
if (id(system_status).state) {
it.print(235, 5, id(tahoma_24), id(my_green), TextAlign::TOP_RIGHT, "Online");
}
else {
it.print(235, 5, id(tahoma_24), id(my_red), TextAlign::TOP_RIGHT, "Offline");
}
- id: ops_tft
lambda: |-
id(on_pec) = false;
id(on_bojler) = false;
id(on_histereza) = false;
if (!id(pumpa).state){
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_red));
it.rectangle(0, 40, it.get_width(), it.get_height(), id(my_red)); // header bar
if(id(stanje) == 1){
it.printf((240 / 2), (150 / 2), id(tahoma_48), id(my_gray),TextAlign::CENTER, "Pec - %d", id(temperatura_pec));
}
if(id(stanje) == 2){
it.print((240 / 2), (150 / 2), id(tahoma_48), id(my_gray),TextAlign::CENTER, "Pec - Bojler");
}
if(id(stanje) == 3){
it.printf((240 / 2), (150 / 2), id(tahoma_48), id(my_gray),TextAlign::CENTER, "Bojler + %d", id(temperatura_bojler));
}
if(id(stanje) == 666){
it.print((240 / 2), (150 / 2), id(tahoma_48), id(my_gray),TextAlign::CENTER, "Pec +90");
}
}else{
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_green));
it.rectangle(0, 40, it.get_width(), it.get_height(), id(my_green)); // header bar
it.printf((240 / 2), (150 / 2), id(tahoma_48), id(my_gray),TextAlign::CENTER, "%s", id(pumpa).state ? "ON" : "OFF");
}
it.print(5, 5, id(tahoma_24), id(my_yellow), TextAlign::TOP_LEFT, "Stanje");
if (id(system_status).state) {
it.print(235, 5, id(tahoma_24), id(my_green), TextAlign::TOP_RIGHT, "Online");
}
else {
it.print(235, 5, id(tahoma_24), id(my_red), TextAlign::TOP_RIGHT, "Offline");
}
- id: bojler_tft
lambda: |-
id(on_pec) = false;
id(on_bojler) = true;
id(on_histereza) = false;
if (id(nastavi_bojler)) {
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_red));
it.rectangle(0, 40, it.get_width(), it.get_height(), id(my_red)); // header bar
} else {
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue));
it.rectangle(0, 40, it.get_width(), it.get_height(), id(my_blue)); // header bar
}
if (!id(nastavi_bojler)) {
it.printf((240 / 2), (150 / 2), id(tahoma_48), id(my_gray), TextAlign::CENTER, "%.1f°C", id(tbojler).get_temp_c());
} else {
it.printf((240 / 2), (150 / 2), id(tahoma_48), id(my_gray), TextAlign::CENTER, "%d°C", id(temperatura_bojler));
}
it.print(5, 5, id(tahoma_24), id(my_yellow), TextAlign::TOP_LEFT, "Bojler");
if (id(system_status).state) {
it.print(235, 5, id(tahoma_24), id(my_green), TextAlign::TOP_RIGHT, "Online");
}
else {
it.print(235, 5, id(tahoma_24), id(my_red), TextAlign::TOP_RIGHT, "Offline");
}
- id: pec_tft
lambda: |-
id(on_pec) = true;
id(on_bojler) = false;
id(on_histereza) = false;
if (id(nastavi_pec)) {
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_red));
it.rectangle(0, 40, it.get_width(), it.get_height(), id(my_red)); // header bar
} else {
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue));
it.rectangle(0, 40, it.get_width(), it.get_height(), id(my_blue)); // header bar
}
if (!id(nastavi_pec)) {
it.printf((240 / 2), (150 / 2), id(tahoma_48), id(my_gray), TextAlign::CENTER, "%.1f°C", id(tpec).get_temp_c());
} else {
it.printf((240 / 2), (150 / 2), id(tahoma_48), id(my_gray), TextAlign::CENTER, "%d°C", id(temperatura_pec));
}
it.print(5, 5, id(tahoma_24), id(my_yellow), TextAlign::TOP_LEFT, "Pec");
if (id(system_status).state) {
it.print(235, 5, id(tahoma_24), id(my_green), TextAlign::TOP_RIGHT, "Online");
}
else {
it.print(235, 5, id(tahoma_24), id(my_red), TextAlign::TOP_RIGHT, "Offline");
}
- id: histereza_tft
lambda: |-
id(on_pec) = false;
id(on_bojler) = false;
id(on_histereza) = true;
if (id(nastavi_histereza)) {
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_red));
it.rectangle(0, 40, it.get_width(), it.get_height(), id(my_red)); // header bar
} else {
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue));
it.rectangle(0, 40, it.get_width(), it.get_height(), id(my_blue)); // header bar
}
it.printf((240 / 2), (150 / 2), id(tahoma_48), id(my_gray), TextAlign::CENTER, "%.1f", id(histereza));
it.print(5, 5, id(tahoma_24), id(my_yellow), TextAlign::TOP_LEFT, "Histereza");
if (id(system_status).state) {
it.print(235, 5, id(tahoma_24), id(my_green), TextAlign::TOP_RIGHT, "Online");
}
else {
it.print(235, 5, id(tahoma_24), id(my_red), TextAlign::TOP_RIGHT, "Offline");
}
- id: wifi_tft
lambda: |-
id(on_pec) = false;
id(on_bojler) = false;
id(on_histereza) = false;
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue));
it.rectangle(0, 40, it.get_width(), it.get_height(), id(my_blue)); // header bar
it.print(5, 5, id(tahoma_24), id(my_yellow), TextAlign::TOP_LEFT, "WIFI");
if (id(system_status).state) {
it.print(235, 5, id(tahoma_24), id(my_green), TextAlign::TOP_RIGHT, "Online");
}
else {
it.print(235, 5, id(tahoma_24), id(my_red), TextAlign::TOP_RIGHT, "Offline");
}
it.printf((240 / 2), (140 / 3) * 1+20, id(tahoma_24), id(my_gray), TextAlign::CENTER, "WIFI: %.fdB", id(wifirssi).state);
it.printf((240 / 2), (140 / 3) * 2-5, id(tahoma_24), id(my_gray), TextAlign::CENTER, "%s", id(ipaddr).state.c_str());
it.printf((240 / 2), (140 / 3) * 2+20, id(tahoma_24), id(my_gray), TextAlign::CENTER, "AP: %s", id(wifissid).state.c_str());