-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathenergy_monitor.yaml.exemple
223 lines (209 loc) · 5.62 KB
/
energy_monitor.yaml.exemple
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
substitutions:
# Interval of how often the power is updated
update_time: 2s
esphome:
name: energy-monitor
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
sensor:
#Total House Amps
- platform: ct_clamp
sensor: out_sensor
id: house_current
name: "House used current"
filters:
- calibrate_linear:
# Measured value of 0.004 maps to 0A
- 0.00348 -> 0
# Known load: 4.0A
# Value shown in logs: 0.1333A
- 0.1278 -> 6.08696
- lambda: |-
if (x > 0.2) return x;
else return 0;
update_interval: ${update_time}
- platform: adc
pin: 34
id: out_sensor
attenuation: auto
#Total House Watts
- platform: template
id: house_power
name: "House power"
lambda: return id(house_current).state * 230.0; #Power = Current * Voltage (so change 230 to whatever your mains voltage is)
unit_of_measurement: 'W'
icon: "mdi:flash-circle"
update_interval: ${update_time}
#House kWh
- platform: total_daily_energy
name: "House energy"
power_id: house_power
filters:
- multiply: 0.001
unit_of_measurement: kWh
#Total Solar Amps
- platform: ct_clamp
sensor: in_sensor
id: solar_current
name: "Solar current"
filters:
- calibrate_linear:
# Measured value of 0.004 maps to 0A
- 0.01 -> 0
# Known load: 4.0A
# Value shown in logs: 0.1333A
#- 0.2348 -> 13.783
- 0.2044 -> 14.783
- lambda: |-
if (x > 0.2) return x;
else return 0;
update_interval: ${update_time}
- platform: adc
pin: 35
id: in_sensor
attenuation: auto
#Total Solar Watts
- platform: template
id: solar_power
name: "Solar power"
lambda: return id(solar_current).state * 230.0; #Power = Current * Voltage (so change 230 to whatever your mains voltage is)
unit_of_measurement: 'W'
icon: "mdi:flash-circle"
update_interval: ${update_time}
#Solar kWh
- platform: total_daily_energy
name: "Solar Energy"
power_id: solar_power
filters:
- multiply: 0.001
unit_of_measurement: kWh
#Total Air Conditioning Amps
- platform: ct_clamp
sensor: ac_sensor
id: ac_current
name: "total ac current"
filters:
- calibrate_linear:
# Measured value of 0.004 maps to 0A
- 0.00348 -> 0
# Known load: 4.0A
# Value shown in logs: 0.1333A
- 0.1261 -> 6.08696
- lambda: |-
if (x > 0.2) return x;
else return 0;
update_interval: ${update_time}
- platform: adc
pin: 32
id: ac_sensor
attenuation: auto
#Total Air Conditioning Watts
- platform: template
id: ac_power
name: "total ac power"
lambda: return id(ac_current).state * 230.0; #Power = Current * Voltage (so change 230 to whatever your mains voltage is)
unit_of_measurement: 'W'
icon: "mdi:flash-circle"
update_interval: ${update_time}
#House kWh
- platform: total_daily_energy
name: "total ac energy"
power_id: ac_power
filters:
- multiply: 0.001
unit_of_measurement: kWh
#Total diff Watts
- platform: template
id: diff_power
name: "Power difference"
lambda: return id(solar_power).state - id(house_power).state;
unit_of_measurement: 'W'
icon: "mdi:flash-circle"
update_interval: ${update_time}
#Difference kWh
- platform: total_daily_energy
name: "Energy difference"
power_id: diff_power
filters:
- multiply: 0.001
unit_of_measurement: kWh
#Total house without air conditioning Watts
- platform: template
id: house_noAc_power
name: "House power without ac"
lambda: return id(house_power).state - id(ac_power).state;
unit_of_measurement: 'W'
icon: "mdi:flash-circle"
update_interval: ${update_time}
#To grid Watts
- platform: template
id: toGrid_power
name: "To grid power"
lambda: !lambda |-
if (id(diff_power).state > 0) {
return id(diff_power).state;
} else {
return 0;
}
unit_of_measurement: 'W'
icon: "mdi:flash-circle"
update_interval: ${update_time}
#To grid kWh
- platform: total_daily_energy
name: "To grid energy"
power_id: toGrid_power
filters:
- multiply: 0.001
unit_of_measurement: kWh
#From grid Watts
- platform: template
id: fromGrid_power
name: "From grid power"
lambda: !lambda |-
if (id(diff_power).state < 0) {
return abs(id(diff_power).state);
} else {
return 0;
}
unit_of_measurement: 'W'
icon: "mdi:flash-circle"
update_interval: ${update_time}
#From grid kWh
- platform: total_daily_energy
name: "From grid energy"
power_id: fromGrid_power
filters:
- multiply: 0.001
unit_of_measurement: kWh
i2c:
sda: 21
scl: 22
display:
- platform: lcd_pcf8574
id: mydisplay
dimensions: 16x2
address: 0x27
lambda: |-
static bool bDisplay = true;
auto now = id(my_time).now(); // local time
if ((now.hour >= 23 || now.hour < 7) && bDisplay) {
id(mydisplay).no_backlight();;
bDisplay = false;
} else if ((now.hour >= 7 && now.hour < 23) && !bDisplay) {
id(mydisplay).backlight();;
bDisplay = true;
}
it.printf(0,0," IN %4.0fW", id(solar_power).state);
it.strftime(11, 0, "%H:%M", id(my_time).now());
it.printf(0,1,"OUT %4.0fW", id(house_power).state);
it.printf(10,1, "D%4.0fW", id(diff_power).state);
time:
- platform: sntp
id: my_time