-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboiler-temperature-monitor-esp8266.yaml
148 lines (127 loc) · 4.49 KB
/
boiler-temperature-monitor-esp8266.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
esphome:
name: boiler-temperature-monitor
packages:
wifi: !include shared-wifi.yaml
sensor: !include default-esp8266-sensors.yaml
esp8266:
board: nodemcuv2
<<: !include shared.yaml
dallas:
- pin: GPIO13
i2c:
sda: GPIO4
scl: GPIO5
frequency: 800khz
sensor:
- platform: dallas
address: "0x9a00000015b6a628"
id: cold_flow
name: "Cold Inlet Flow Temperature"
- platform: dallas
address: "0xdd00000018f2e528"
id: hot_flow
name: "Upstairs Hot Flow Temperature"
- platform: dallas
address: "0x49000000197b5a28"
id: rad_flow
name: "Radiator Flow Temperature"
- platform: dallas
address: "0x3d00000016c0b128"
id: rad_return
name: "Radiator Return Temperature"
- platform: dallas
address: "0x38000000192aba28"
id: tank_flow
name: "Hot Water Cylinder Flow Temperature"
- platform: dallas
address: "0x5200000016a13228"
id: tank_return
name: "Hot Water Cylinder Return Temperature"
binary_sensor:
- platform: gpio
id: page_switch_button
pin:
number: GPIO0
mode:
input: true
pullup: true
inverted: true
on_press:
then:
- display.page.show_next: temp_display
font:
- file: "./fonts/ter-u12n.bdf"
id: small
- file: "./fonts/ter-u32b.bdf"
id: large
display:
- platform: ssd1306_i2c
id: temp_display
model: "SSD1306 128x64"
address: 0x3C
pages:
- id: summary
lambda: |-
it.print(0, 2, id(small), "Temperatures");
/* //Debugging bounding box
it.line(0,0,127,0);
it.line(127,0,127,63);
it.line(127,63,0,63);
it.line(0,63,0,0);
*/
int pipes = 6;
int pipes_per_column = 2;
int header_height = 16;
int font_height = 12;
int wpp = (it.get_width()) / (pipes / pipes_per_column);
int hpp = ((it.get_height() - 16) / 2) - 3;
int marginx = 5;
int marginy = 7;
// render each temperature inside little pipe lines in a 3x2 grid
for (int i = 0; i < 6; i++) {
int column = (i/2) % (pipes / pipes_per_column);
int row = i % pipes_per_column;
int leftx = (wpp * column);
int rightx = leftx + wpp - marginx;
int topy = header_height + (hpp * row) + (marginy / 2);
int bottomy = topy + hpp - marginy;
it.line(leftx, topy, rightx, topy);
it.line(leftx, bottomy, rightx, bottomy);
int tx = leftx;
int ty = topy + 2;
float sensor_val = 0;
String sensor_flag;
switch (i) {
case 0: sensor_val = id(cold_flow).state; sensor_flag = "CF"; break;
case 1: sensor_val = id(hot_flow).state; sensor_flag = "HF"; break;
case 2: sensor_val = id(rad_flow).state; sensor_flag = "RF"; break;
case 3: sensor_val = id(rad_return).state; sensor_flag = "RR"; break;
case 4: sensor_val = id(tank_flow).state; sensor_flag = "TF"; break;
case 5: sensor_val = id(tank_return).state; sensor_flag = "TR"; break;
}
it.printf(tx, ty, id(small), "%s%2.1f", sensor_flag.c_str(), sensor_val);
}
- id: cold
lambda: |-
it.print(0, 0, id(small), "Cold Flow");
it.printf(it.get_width()/2, (it.get_height()/2)+4, id(large), TextAlign::CENTER, "%2.2fc", id(cold_flow).state);
- id: hot
lambda: |-
it.print(0, 0, id(small), "Hot Flow");
it.printf(it.get_width()/2, (it.get_height()/2)+4, id(large), TextAlign::CENTER, "%2.2fc", id(hot_flow).state);
- id: rf
lambda: |-
it.print(0, 0, id(small), "Radiator Flow");
it.printf(it.get_width()/2, (it.get_height()/2)+4, id(large), TextAlign::CENTER, "%2.2fc", id(rad_flow).state);
- id: rr
lambda: |-
it.print(0, 0, id(small), "Radiator Return");
it.printf(it.get_width()/2, (it.get_height()/2)+4, id(large), TextAlign::CENTER, "%2.2fc", id(rad_return).state);
- id: tf
lambda: |-
it.print(0, 0, id(small), "Tank Flow");
it.printf(it.get_width()/2, (it.get_height()/2)+4, id(large), TextAlign::CENTER, "%2.2fc", id(tank_flow).state);
- id: tr
lambda: |-
it.print(0, 0, id(small), "Tank Return");
it.printf(it.get_width()/2, (it.get_height()/2)+4, id(large), TextAlign::CENTER, "%2.2fc", id(tank_return).state);