-
Notifications
You must be signed in to change notification settings - Fork 14
/
emporia-vue2.yaml
195 lines (185 loc) · 10.2 KB
/
emporia-vue2.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
substitutions:
device_id: emporia-vue2
device_name: Emporia Vue2 Power Monitor
board: esp32dev
ip_address: !secret emporia_vue2_ip
api_key: !secret emporia_vue2_key
pwd: !secret emporia_vue2_pwd
packages:
device_base: !include ./packages/device_base_esp32.yaml
api:
services:
- service: play_rtttl
variables:
song_str: string
then:
- rtttl.play:
rtttl: !lambda 'return song_str;'
preferences:
flash_write_interval: "48h"
external_components:
- source: github://emporia-vue-local/esphome@dev
components: [ emporia_vue ]
i2c:
sda: 21
scl: 22
scan: false
frequency: 200kHz
id: i2c_a
output:
- platform: ledc
pin: GPIO12
id: buzzer
- platform: gpio
pin: GPIO27
id: buzzer_gnd
rtttl:
output: buzzer
# 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
- &throttle_avg
# average all raw readings together over a 5 second span before publishing
throttle_average: 5s
- &throttle_time
# only send the most recent measurement every 60 seconds
throttle: 60s
- &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);'
- &abs
# take the absolute value of the value
lambda: 'return abs(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.022 # 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: [*throttle_avg, *pos]
frequency:
name: "Power Frequency"
filters: [*throttle_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.022 # 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: [*throttle_avg, *pos]
ct_clamps:
# Do not specify a name for any of the power sensors here, only an id. This leaves the power sensors internal to ESPHome.
# Copy sensors will filter and then send power measurements to HA
# These non-throttled power sensors are used for accurately calculating energy
- phase_id: phase_a
input: "A" # Verify the CT going to this device input also matches the phase/leg
power:
id: phase_a_power
filters: [*pos]
- phase_id: phase_b
input: "B" # Verify the CT going to this device input also matches the phase/leg
power:
id: phase_b_power
filters: [*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
- { phase_id: phase_b, input: "1", power: { id: cir1, filters: [*pos] } }
- { phase_id: phase_b, input: "2", power: { id: cir2, filters: [*pos, multiply: 2] } }
- { phase_id: phase_b, input: "3", power: { id: cir3, filters: [*pos] } }
- { phase_id: phase_b, input: "4", power: { id: cir4, filters: [*pos, multiply: 2] } }
# - { phase_id: phase_a, input: "5", power: { id: cir5, filters: [*pos] } }
# - { phase_id: phase_a, input: "6", power: { id: cir6, filters: [*pos] } }
# - { phase_id: phase_a, input: "7", power: { id: cir7, filters: [*pos] } }
# - { phase_id: phase_b, input: "8", power: { id: cir8, filters: [*pos] } }
- { phase_id: phase_a, input: "9", power: { id: cir9, filters: [*pos] } }
- { phase_id: phase_a, input: "10", power: { id: cir10, filters: [*pos] } }
- { phase_id: phase_a, input: "11", power: { id: cir11, filters: [*pos] } }
- { phase_id: phase_a, input: "12", power: { id: cir12, filters: [*pos, multiply: 2] } }
- { phase_id: phase_a, input: "13", power: { id: cir13, filters: [*pos] } }
- { phase_id: phase_b, input: "14", power: { id: cir14, filters: [*pos] } }
- { phase_id: phase_b, input: "15", power: { id: cir15, filters: [*pos] } }
- { phase_id: phase_a, input: "16", power: { id: cir16, filters: [*pos] } }
on_update:
then:
- component.update: total_power
- component.update: balance_power
- platform: template
lambda: return id(phase_a_power).state + id(phase_b_power).state;
update_interval: never # will be updated after all power sensors update via on_update trigger
id: total_power
device_class: power
state_class: measurement
unit_of_measurement: "W"
- platform: template
lambda: !lambda |-
return max(0.0f, id(total_power).state -
id( cir1).state -
id( cir2).state -
id( cir3).state -
id( cir4).state -
id( cir9).state -
id(cir10).state -
id(cir11).state -
id(cir12).state -
id(cir13).state -
id(cir14).state -
id(cir15).state -
id(cir16).state);
update_interval: never # will be updated after all power sensors update via on_update trigger
id: balance_power
device_class: power
state_class: measurement
unit_of_measurement: "W"
# The copy sensors filter and send the power state to HA
- { platform: copy, source_id: phase_a_power, name: "Phase A Power", filters: *throttle_avg }
- { platform: copy, source_id: phase_b_power, name: "Phase B Power", filters: *throttle_avg }
- { platform: copy, source_id: total_power, name: "Total Power", filters: *throttle_avg }
- { platform: copy, source_id: balance_power, name: "Balance Power", filters: *throttle_avg }
- { platform: copy, source_id: cir1, name: "Furnace Power", filters: *throttle_avg }
- { platform: copy, source_id: cir2, name: "Dryer Power", filters: *throttle_avg }
- { platform: copy, source_id: cir3, name: "Garage 1 Power", filters: *throttle_avg }
- { platform: copy, source_id: cir4, name: "Hot Water Heater Power", filters: *throttle_avg }
# - { platform: copy, source_id: cir5, name: " Power", filters: *throttle_avg }
# - { platform: copy, source_id: cir6, name: " Power", filters: *throttle_avg }
# - { platform: copy, source_id: cir7, name: " Power", filters: *throttle_avg }
# - { platform: copy, source_id: cir8, name: " Power", filters: *throttle_avg }
- { platform: copy, source_id: cir9, name: "Fire Pit/Fountain Power", filters: *throttle_avg }
- { platform: copy, source_id: cir10, name: "Pool Accessories Total Power", filters: *throttle_avg }
- { platform: copy, source_id: cir11, name: "Garage 2 Power", filters: *throttle_avg }
- { platform: copy, source_id: cir12, name: "Air Conditioner Power", filters: *throttle_avg }
- { platform: copy, source_id: cir13, name: "Dish Washer Power", filters: *throttle_avg }
- { platform: copy, source_id: cir14, name: "Garbage Disposal Power", filters: *throttle_avg }
- { platform: copy, source_id: cir15, name: "Kitchen 1 Power", filters: *throttle_avg }
- { platform: copy, source_id: cir16, name: "Kitchen 2 Power", filters: *throttle_avg }
- { platform: total_daily_energy, power_id: total_power, accuracy_decimals: 0, restore: false, name: "Total Daily Energy", filters: *throttle_time }
- { platform: total_daily_energy, power_id: balance_power, accuracy_decimals: 0, restore: false, name: "Balance Daily Energy", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir1, accuracy_decimals: 0, restore: false, name: "Furnace", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir2, accuracy_decimals: 0, restore: false, name: "Dryer", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir3, accuracy_decimals: 0, restore: false, name: "Garage 1", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir4, accuracy_decimals: 0, restore: false, name: "Hot Water Heater", filters: *throttle_time }
# - { platform: total_daily_energy, power_id: cir5, accuracy_decimals: 0, restore: false, name: "", filters: *throttle_time }
# - { platform: total_daily_energy, power_id: cir6, accuracy_decimals: 0, restore: false, name: "", filters: *throttle_time }
# - { platform: total_daily_energy, power_id: cir7, accuracy_decimals: 0, restore: false, name: "", filters: *throttle_time }
# - { platform: total_daily_energy, power_id: cir8, accuracy_decimals: 0, restore: false, name: "", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir9, accuracy_decimals: 0, restore: false, name: "Fire Pit/Fountain", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir10, accuracy_decimals: 0, restore: false, name: "Pool Accessories Total", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir11, accuracy_decimals: 0, restore: false, name: "Garage 2", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir12, accuracy_decimals: 0, restore: false, name: "Air Conditioner", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir13, accuracy_decimals: 0, restore: false, name: "Dish Washer", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir14, accuracy_decimals: 0, restore: false, name: "Garbage Disposal", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir15, accuracy_decimals: 0, restore: false, name: "Kitchen 1", filters: *throttle_time }
- { platform: total_daily_energy, power_id: cir16, accuracy_decimals: 0, restore: false, name: "Kitchen 2", filters: *throttle_time }