-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemporiavue2.yaml
243 lines (231 loc) · 12.1 KB
/
emporiavue2.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
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
esphome:
name: emporiavue2
external_components:
- source: github://flaviut/[email protected]
components: [ emporia_vue ]
esp32:
board: esp32dev
framework:
type: esp-idf
version: recommended
# Enable logging (currently disabled)
# logger:
# Enable Home Assistant API - can enable native API or MQTT but NOT both
#api:
# encryption:
# key: "NBhc8AYAWj6luh/sxCYUrOpOQ+CoPDjcpqnq1AxDYio="
mqtt:
broker: !secret mymqttbroker
username: !secret mymqttuser
password: !secret mqttpassword
ota:
password: !secret vue2_ota_password
wifi:
ssid: !secret wifi_SSID
password: !secret wifi_password
i2c:
sda: 21
scl: 22
scan: false
frequency: 200kHz # recommended range is 50-200kHz
id: i2c_a
time:
- platform: sntp
id: my_time
# these are called references in YAML. They allow you to reuse
# this configuration in each sensor, while only defining it once
.defaultfilters:
- &moving_avg
# we capture a new sample every 0.24 seconds, so the time can
# be calculated from the number of samples as n * 0.24.
sliding_window_moving_average:
# we average over the past 2.88 seconds
window_size: 12
# we push a new value every 1.44 seconds
send_every: 6
- &invert
# invert and filter out any values below 0.
lambda: 'return max(-x, 0.0f);'
- &pos
# filter out any values below 0.
lambda: 'return max(x, 0.0f);'
- &pool
# filter out any values below 0.
lambda: 'return (max(x, 0.0f) + 20.0f);'
- &abs
# take the absolute value of the value
lambda: 'return abs(x);'
- &dryer_filter
# dryer filter
lambda: |-
if (x < 400.0f) { x = max (x, 0.0f); }
else { x = (x * 2.0f) + 150.0f; };
return x;
- &pool_filter
# pool filter
lambda: |-
if (x < 100.0f) { x = max (x, 0.0f); }
else if ( x < 500.0f) { x = (x * 2.0f) - 3.5f + 21.0f; }
else { x = (x * 2.0f) - 11.0f + 92.0f; };
return x;
- &ac_comp_filter
# ac and compressor filter
lambda: |-
if (x < 250.0f) { x = max (x, 0.0f); }
else { x = (x * 2.0f) + 100.0f; };
return x;
- &oven_filter
# oven filter
lambda: |-
if (x < 45.0f) { x = max (x, 0.0f); }
else if (( (id(phase_a_power).state -
(id(cir2).state + id(cir3).state + id(cir5).state + id(cir13).state)
)
- (id(phase_b_power).state -
(id(cir1).state + id(cir4).state + id(cir6).state + id(cir7).state + id(cir8).state + id(cir10).state + id(cir12).state)
)
) > 800.0f
) { x = max (x, 0.0f); }
else { x = x * 2.0f; };
return x;
sensor:
- platform: emporia_vue
i2c_id: i2c_a
phases:
- id: phase_a # Verify that this specific phase/leg is connected to correct input wire color on device listed below
input: BLACK # Vue device wire color
calibration: 0.023 # 0.022 is used as the default as starting point but may need adjusted to ensure accuracy
# To calculate new calibration value use the formula <in-use calibration value> * <accurate voltage> / <reporting voltage>
voltage:
name: "Phase A Voltage"
filters: [*moving_avg, *pos]
- id: phase_b # Verify that this specific phase/leg is connected to correct input wire color on device listed below
input: RED # Vue device wire color
calibration: 0.0214 # 0.022 is used as the default as starting point but may need adjusted to ensure accuracy
# To calculate new calibration value use the formula <in-use calibration value> * <accurate voltage> / <reporting voltage>
voltage:
name: "Phase B Voltage"
filters: [*moving_avg, *pos]
ct_clamps:
- phase_id: phase_a
input: "A" # Verify the CT going to this device input also matches the phase/leg
power:
name: "Total Power Phase A"
id: phase_a_power
device_class: power
filters: [*moving_avg, *pos]
- phase_id: phase_b
input: "B" # Verify the CT going to this device input also matches the phase/leg
power:
name: "Total Power Phase B"
id: phase_b_power
device_class: power
filters: [*moving_avg, *pos]
# Pay close attention to set the phase_id for each breaker by matching it to the phase/leg it connects to in the panel
# Single Phase B Circuits
- { phase_id: phase_b, input: "1", power: { name: "Dining Rm / Kitchen GFI / Bathrooms Power", id: cir1, filters: [ *moving_avg, *pos ] } }
- { phase_id: phase_b, input: "4", power: { name: "Clothes Washer Power", id: cir4, filters: [ *moving_avg, *pos ] } }
- { phase_id: phase_b, input: "6", power: { name: "Living Room Power", id: cir6, filters: [ *moving_avg, *pos ] } }
- { phase_id: phase_b, input: "7", power: { name: "Guest Bedrooms Power", id: cir7, filters: [ *moving_avg, *pos ] } }
- { phase_id: phase_b, input: "8", power: { name: "Microwave Power", id: cir8, filters: [ *moving_avg, *pos ] } }
- { phase_id: phase_b, input: "10", power: { name: "Dock / Landscaping Power", id: cir10, filters: [ *moving_avg, *pos ] } }
- { phase_id: phase_b, input: "12", power: { name: "Master Bedroom Power", id: cir12, filters: [ *moving_avg, *pos ] } }
# Single Phase A Circuits
- { phase_id: phase_a, input: "2", power: { name: "Entry, Coach, Garage Back Wall Power", id: cir2, filters: [ *moving_avg, *pos ] } }
- { phase_id: phase_a, input: "3", power: { name: "Fridge, Dishwasher, Disposal Power", id: cir3, filters: [ *moving_avg, *pos ] } }
- { phase_id: phase_a, input: "5", power: { name: "Family Room Power", id: cir5, filters: [ *moving_avg, *pos ] } }
- { phase_id: phase_a, input: "13", power: { name: "Office Power", id: cir13, filters: [ *moving_avg, *pos ] } }
# Dual Phase Circuits
- { phase_id: phase_a, input: "14", power: { name: "AC Handler Power", id: cir14, filters: [ *moving_avg, *pos, multiply: 2 ] } }
- { phase_id: phase_a, input: "16", power: { name: "AC Compressor Power", id: cir16, filters: [ *moving_avg, *pos, *ac_comp_filter ] } }
- { phase_id: phase_a, input: "9", power: { name: "Pool Equipment Power", id: cir9, filters: [ *moving_avg, *pos, *pool_filter ] } }
- { phase_id: phase_a, input: "11", power: { name: "Clothes Dryer Power", id: cir11, filters: [ *moving_avg, *pos, *dryer_filter ] } }
- { phase_id: phase_a, input: "15", power: { name: "Oven Power", id: cir15, filters: [ *moving_avg, *pos, *oven_filter ] } }
- platform: template
name: "Total Power"
lambda: return id(phase_a_power).state + id(phase_b_power).state;
id: total_power
filters: *moving_avg
unit_of_measurement: "W"
update_interval: 1s
- platform: total_daily_energy
name: "Total Daily Energy"
power_id: total_power
accuracy_decimals: 0
- { power_id: cir1, platform: total_daily_energy, accuracy_decimals: 0, name: "Dining Rm / Kitchen GFI / Bathroom Daily Energy" }
- { power_id: cir2, platform: total_daily_energy, accuracy_decimals: 0, name: "Entry, Coach, Garage Back Wall Daily Energy" }
- { power_id: cir3, platform: total_daily_energy, accuracy_decimals: 0, name: "Fridge / Dishwasher / Disposal Daily Energy" }
- { power_id: cir4, platform: total_daily_energy, accuracy_decimals: 0, name: "Clothes Washer Daily Energy" }
- { power_id: cir5, platform: total_daily_energy, accuracy_decimals: 0, name: "Family Room Daily Energy" }
- { power_id: cir6, platform: total_daily_energy, accuracy_decimals: 0, name: "Living Room Daily Energy" }
- { power_id: cir7, platform: total_daily_energy, accuracy_decimals: 0, name: "Guest Bedrooms Daily Energy" }
- { power_id: cir8, platform: total_daily_energy, accuracy_decimals: 0, name: "Microwave Daily Energy" }
- { power_id: cir9, platform: total_daily_energy, accuracy_decimals: 0, name: "Pool Equipment Daily Energy" }
- { power_id: cir10, platform: total_daily_energy, accuracy_decimals: 0, name: "Dock / Landscaping Daily Energy" }
- { power_id: cir11, platform: total_daily_energy, accuracy_decimals: 0, name: "Clothes Dryer Daily Energy" }
- { power_id: cir12, platform: total_daily_energy, accuracy_decimals: 0, name: "Master Bedroom Daily Energy" }
- { power_id: cir13, platform: total_daily_energy, accuracy_decimals: 0, name: "Office Daily Energy" }
- { power_id: cir14, platform: total_daily_energy, accuracy_decimals: 0, name: "AC Handler Daily Energy" }
- { power_id: cir15, platform: total_daily_energy, accuracy_decimals: 0, name: "Oven Daily Energy" }
- { power_id: cir16, platform: total_daily_energy, accuracy_decimals: 0, name: "AC Compressor Daily Energy" }
- platform: template
name: "Total Power Balance - Phase A"
lambda: |-
float local_phase_a = id(cir2).state + id(cir3).state + id(cir5).state + id(cir13).state;
float local_phase_b = id(cir1).state + id(cir4).state + id(cir6).state + id(cir7).state + id(cir8).state + id(cir10).state + id(cir12).state;
float dryer_component;
if (id(cir11).state > 800.0f ) { dryer_component = ((id(cir11).state) - 150.0f) / 2.0f - 30.0f; }
else { dryer_component = id(cir11).state; };
float pool_component;
if (id(cir9).state > 1500.0f) { pool_component = ((id(cir9).state + 11.0f - 92.0f) / 2.0f) - 11.0f; }
else if ( id(cir9).state > 300.0f) { pool_component = ((id(cir9).state + 3.5f - 21.0f) / 2.0f) - 3.5f; }
else { pool_component = id(cir9).state; };
float ac_comp_component;
if (id(cir16).state > 600.0f ) { ac_comp_component = ((id(cir16).state - 140.0f) / 2.0f); }
else { ac_comp_component = id(cir16).state; };
float oven_component;
if (id(cir15).state < 45.0f) { oven_component = id(cir15).state; }
else if (( (id(phase_a_power).state - local_phase_a) - (id(phase_b_power).state - local_phase_b)) > 800.0f ) { oven_component = id(cir15).state; }
else { oven_component = id(cir15).state / 2.0f; };
return (id(phase_a_power).state - local_phase_a - pool_component - dryer_component - (id(cir14).state / 2.0f) - oven_component - ac_comp_component);
update_interval: 1s
id: phase_a_balance_power
filters: *moving_avg
unit_of_measurement: "W"
- platform: template
name: "Total Power Balance - Phase B"
lambda: |-
float local_phase_a = id(cir2).state + id(cir3).state + id(cir5).state + id(cir13).state;
float local_phase_b = id(cir1).state + id(cir4).state + id(cir6).state + id(cir7).state + id(cir8).state + id(cir10).state + id(cir12).state;
float dryer_component = 0.0f;
if (id(cir11).state > 800.0f ) { dryer_component = ((id(cir11).state) -150.0f) / 2.0f - 120.0f; }
float pool_component = 0.0f;
if (id(cir9).state > 1500.0f) { pool_component = ((id(cir9).state + 11.0f - 92.0f) / 2.0f) + 92.0f; }
else if (id(cir9).state > 300.0f) { pool_component = ((id(cir9).state + 3.5f - 21.0f) / 2.0f) + 21.0f; };
float ac_comp_component = 0.0f;
if (id(cir16).state > 600.0f ) { ac_comp_component = ((id(cir16).state - 100.0f) / 2.0f) + 100.0f; }
float oven_component = 0.0f;
if (id(cir15).state < 45.0f) { oven_component = 0.0f; }
else if (( (id(phase_a_power).state - local_phase_a) - (id(phase_b_power).state - local_phase_b)) > 800.0f ) { oven_component = 0.0f; }
else { oven_component = id(cir15).state / 2.0f; };
return (id(phase_b_power).state - local_phase_b - pool_component - dryer_component - (id(cir14).state / 2.0f) - oven_component - ac_comp_component);
update_interval: 1s
filters: *moving_avg
id: phase_b_balance_power
unit_of_measurement: "W"
- platform: template
name: "Total Power Single Phase A"
lambda: |-
return (id(cir2).state + id(cir3).state + id(cir5).state + id(cir13).state);
update_interval: 3s
id: phase_a_1_ph_balance_power
filters: *moving_avg
unit_of_measurement: "W"
- platform: template
name: "Total Power Single Phase B"
lambda: |-
return (id(cir1).state + id(cir4).state + id(cir6).state + id(cir7).state + id(cir8).state + id(cir10).state + id(cir12).state);
update_interval: 1s
id: phase_b_1_ph_balance_power
filters: *moving_avg
unit_of_measurement: "W"