-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathm5cplus_water_heater_common.yaml
More file actions
168 lines (140 loc) · 3.58 KB
/
m5cplus_water_heater_common.yaml
File metadata and controls
168 lines (140 loc) · 3.58 KB
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
esphome:
name: $devicename
platform: ESP32
board: m5stick-c
platformio_options:
#upload_speed: 115200
upload_speed: 1500000
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pw
#domain: .jonn26.lan
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret esphome_rest_pw
ota:
password: !secret esphome_ota_pw
i2c:
#apx192
- id: bus_a
sda: GPIO21
scl: GPIO22
scan: True
binary_sensor:
- platform: status
id: system_status
name: $upper_devicename Status
- platform: gpio
id: m5_button
pin:
number: GPIO37
inverted: true
sensor:
# AXP192 power management - must be present to initialize TFT power on
- platform: axp192
address: 0x34
i2c_id: bus_a
update_interval: 30s
battery_level:
name: "$upper_devicename Battery Level"
id: battery_level
- platform: dallas
address: 0xA5800000277E7928
name: "$upper_devicename Temp #1"
id: temp1
- platform: dallas
address: 0x2A8000002788CF28
name: "$upper_devicename Temp #2"
id: temp2
- platform: uptime
name: "$upper_devicename Uptime"
dallas:
- pin: GPIO32
spi:
clk_pin: GPIO13
mosi_pin: GPIO15
font:
- file: 'arial.ttf'
id: arial_10
size: 10
- file: 'arial.ttf'
id: arial_12
size: 12
- file: 'arial.ttf'
id: arial_18
size: 18
- file: 'arial.ttf'
id: arial_24
size: 24
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%
- id: my_white
red: 95%
green: 95%
blue: 95%
display:
- platform: st7789v
backlight_pin: GPIO26
cs_pin: GPIO5
dc_pin: GPIO23
reset_pin: GPIO18
rotation: 270
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue));
it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue)); // header bar
it.print(10, 5, id(arial_12), id(my_white), TextAlign::TOP_LEFT, "Water Heater Temp");
if (id(system_status).state) {
it.print(235, 5, id(arial_12), id(my_green), TextAlign::TOP_RIGHT, "Online");
}
else {
it.print(235, 5, id(arial_12), id(my_red), TextAlign::TOP_RIGHT, "Offline");
}
it.print(10, 40, id(arial_24), id(my_white), TextAlign::LEFT, "Temp 1: ");
if (id(temp1).has_state()) {
char temp1_str[128];
sprintf(temp1_str, "%.0f°F", id(temp1).state * (9.0/5.0) + 32.0);
it.print(150, 40, id(arial_24), id(my_red), TextAlign::RIGHT, temp1_str);
} else {
it.print(150, 40, id(arial_24), id(my_red), TextAlign::RIGHT, "Unk");
}
it.print(10, 70, id(arial_24), id(my_white), TextAlign::LEFT, "Temp 2: ");
if (id(temp2).has_state()) {
char temp2_str[128];
sprintf(temp2_str, "%.0f°F", id(temp2).state * (9.0/5.0) + 32.0);
it.print(150, 70, id(arial_24), id(my_red), TextAlign::RIGHT, temp2_str);
} else {
it.print(150, 70, id(arial_24), id(my_red), TextAlign::RIGHT, "Unk");
}
// Print time
it.strftime(120, 135, id(arial_18), id(my_gray), TextAlign::BOTTOM_CENTER, "%H:%M:%S %Y-%m-%d", id(sntp_time).now());
//it.strftime(10, 100, id(arial_18), id(my_gray), TextAlign::BOTTOM_RIGHT, "%Y-%m-%d", id(sntp_time).now());
time:
- platform: homeassistant
id: hass_time
- platform: sntp
id: sntp_time
#output:
# - id: status_light
# platform: gpio
# pin: GPIO10