Files
fresh-home/esphome/power-monitor.yaml
T

399 lines
11 KiB
YAML

# CT01 - A - Grid Phase A
# CT02 - G - Dryer
# CT03 - D - Furnace
# CT04 - B - Grid Phase B
# CT05 - E - Basement Plugs (Computer is on this circuit)
# CT06 - F - Nursery, Kitchen, and Dining Room Lights
# CT07 - C - Sump Pump Plug
# CT08 - H - Microwave Plug
# CT09 - I - Stove/Oven
# CT10 - J - Front Room Plugs
# CT11 - M - Heat Pump
# CT12 - L - Kitchen Circuit 1 (Fridge is on this circuit)
substitutions:
devicename: power-monitor
disp_name: power-monitor
friendly_name: 'Power Monitor'
entity_name: power_monitor
comment: Circuit Setup Power Monitor
static_ip: !secret power-monitor-ip
platform: ESP32
board: nodemcu-32s
update_time: 2s
kwh_report_interval: 60s
watt_heartbeat: 60s
throttle_time: 60s
watt_delta_lights: "2.0"
watt_delta_appliances: "10.0"
watt_delta_grid: "100.0"
watt_throttle: 60s
watt_accuracy_decimals: 1
watt_label: W
amp_delta: 0.05
amp_throttle: 60s
amp_accuracy_decimals: 2
amp_label: A
voltage_delta: 0.5
voltage_heartbeat: 300s
voltage_accuracy_decimals: 1
voltage_label: V
kwh_throttle: 60s
kwh_label: kWh
main_meter_name1: Meter 1-3
main_meter_name2: Meter 4-6
main_meter_id1: meter_main1
main_meter_id2: meter_main2
## Addon1
addon1_name1: Addon1 7-9
addon1_name2: Addon1 10-12
addon1_id1: addon1_1
addon1_id2: addon1_2
## Addon2
addon2_name1: Addon2 13-15
addon2_name2: Addon2 16-18
addon2_id1: addon2_1
addon2_id2: addon2_2
## Addon3
addon3_name1: Addon3 19-21
addon3_name2: Addon3 22-24
addon3_id1: addon3_1
addon3_id2: addon3_2
ct1_name: 'Grid Phase A'
ct4_name: 'Grid Phase B'
ct22_name: 'Well' # 1, 3 # sct010 - O
ct12_name: 'Kitchen 1' # 5 # sct006 - L
ct16_name: 'Kitchen 2' # 7 # sct006 - S
ct18_name: 'Laundry Plug' # 9 # sct006 - N
ct8_name: 'Microwave Plug' # 11 # sct006 - H
ct17_name: 'Bathroom Plug' # 13 # sct006 - R
ct11_name: 'Heat Pump' # 15, 17 - M
ct24_name: 'Basement Bedroom and Furnace Room Lights' # 19 # sct006 - K
ct5_name: 'Basement Plugs' # 21a # sct006 - E
ct23_name: 'Basement and Laundry Lights and Plugs' # 21b # sct006 - W
ct7_name: 'Sump Pump Plug' # 23 # sct006 - C
ct6_name: 'Nursery, Dining, Kitchen Lights' # 2 # sct006 - F
ct20_name: 'Master Suite' # 4 # sct006 - T
ct3_name: 'Furnace' # 6 # sct006 - D
ct15_name: 'Basement Stairs and Lights' # 8 # sct006 - P
ct21_name: 'Dishwasher' # 10 # sct006 - V
ct13_name: 'Garage Outside and Front Garage Lights' # 12 # sct006 - U
ct10_name: 'Front Room Plugs' # 14 # sct006 - J
ct14_name: 'Garage and Outside Plugs' # 16 # sct006 - Q
ct9_name: 'Stove' # 18, 20 # sct016 - I
ct2_name: 'Dryer' # 22, 24 # sct010 - G
ct19_name: 'Unused'
# Current Transformers:
# 20A/25mA SCT-006: 11143
sct006: '11143'
# 30A/1V SCT-013-030: 8650
# 50A/1V SCT-013-050: 15420
# 80A/26.6mA SCT-010: 41660
sct010: '41660'
# 100A/50ma SCT-013-000: 27518
sct013: '27518'
# 120A/40mA: SCT-016: 41787
sct016: '41787'
# 200A/100mA SCT-024: 27518
#current_cal: '27518'
# Jameco 9VAC Transformer:
# For meter versions:
# >= v1.3: 7305
#voltage_cal: '7305'
## Main Board
current_cal_ct1: '41787'
current_cal_ct2: '41660'
current_cal_ct3: '11143'
current_cal_ct4: '41787'
current_cal_ct5: '11143'
current_cal_ct6: '11143'
## Addon1
current_cal_ct7: '11143'
current_cal_ct8: '11143'
current_cal_ct9: '27518'
current_cal_ct10: '11143'
current_cal_ct11: '41660'
current_cal_ct12: '11143'
## Addon2
current_cal_ct13: '11143'
current_cal_ct14: '11143'
current_cal_ct15: '11143'
current_cal_ct16: '11143'
current_cal_ct17: '11143'
current_cal_ct18: '11143'
## Addon3
current_cal_ct19: '11143'
current_cal_ct20: '11143'
current_cal_ct21: '11143'
current_cal_ct22: '41660'
current_cal_ct23: '11143'
current_cal_ct24: '11143'
# This only needs to be changed if you're using something other than the
# Jameco 9VAC Transformer:
voltage_cal1: '7305'
voltage_cal2: '7305'
electric_freq: "60Hz"
offset_calibration: "true"
gain_calibration: "true"
spi_clk: 18
spi_miso: 19
spi_mosi: 23
main_ic1: 5
addon1_ic1: 0
addon2_ic1: 27
addon3_ic1: 2
main_ic2: 4
addon1_ic2: 16
addon2_ic2: 17
addon3_ic2: 21
esphome:
name: ${disp_name}
friendly_name: "${friendly_name}"
name_add_mac_suffix: false
min_version: '2025.7.0'
project:
name: clever.6c-energy-meter-3-addons
version: "1.7"
esp32:
board: nodemcu-32s
cpu_frequency: 240MHz
framework:
# ESPHome v2025.7.0 update to allow more than 6 SPI hardware devices on ESP-IDF
type: esp-idf
captive_portal:
spi:
clk_pin: ${spi_clk}
miso_pin: ${spi_miso}
mosi_pin: ${spi_mosi}
packages:
wifi: !include common/wifi.yaml
device_base: !include common/device_base.yaml
mqtt: !include common/mqtt_null.yaml
#mqtt: !include common/mqtt_all.yaml
# device_base: !include common/complex_esp32_base.yaml
#common: !include circuit-setup/6chan_common.yaml
main: !include circuit-setup/meter_sensors/6chan_main_sensor.yaml
main_status: !include circuit-setup/status_fields/6chan_main_status.yaml
#main_cal: !include circuit-setup/calibration/6chan_main_calibration.yaml
#main_offset: !include circuit-setup/calibration/6chan_main_offset_calibrations.yaml
addon1: !include circuit-setup/meter_sensors/6chan_addon1.yaml
# addon1_status: !include circuit-setup/status_fields/6chan_addon1_status.yaml
# addon1_cal: !include circuit-setup/calibration/6chan_addon1_calibration.yaml
# addon1_offset: !include circuit-setup/calibration/6chan_addon1_offset_calibrations.yaml
addon2: !include circuit-setup/meter_sensors/6chan_addon2.yaml
# addon2_status: !include circuit-setup/status_fields/6chan_addon2_status.yaml
# addon2_cal: !include circuit-setup/calibration/6chan_addon2_calibration.yaml
# addon2_offset: !include circuit-setup/calibration/6chan_addon2_offset_calibrations.yaml
addon3: !include circuit-setup/meter_sensors/6chan_addon3.yaml
# addon3_status: !include circuit-setup/status_fields/6chan_addon3_status.yaml
# addon3_cal: !include circuit-setup/calibration/6chan_addon3_calibration.yaml
# addon3_offset: !include circuit-setup/calibration/6chan_addon3_offset_calibrations.yaml
# web_server:
# port: 80
# text_sensor:
# - id: !extend ${addon3_id1}
# phase_status:
# phase_a:
# internal: true
sensor:
## The max value for current that the meter can output is 65.535. If you expect to measure current over 65A,
## divide the current_cal_ctx (above) by 2 (120A CT) or 4 (200A CT) and multiply the current and power values
## by 2 or 4, uncommenting the below and changing the id and phase_x accordingly
#- id: !extend ${main_meter_id1} # CTs 1-3
# phase_a: # CT1
# current:
# filters:
# - multiply: 2
# power:
# filters:
# - multiply: 2
#
## uncomment if monitoring 2 voltages
#- id: !extend ${main_meter_id2}
# phase_a:
# voltage:
# name: Voltage 2
# id: ic2Volts
# accuracy_decimals: 1
# frequency:
# name: Frequency 2
## Comment out to show amps and watts per meter board in Home Assistant
## These were commented out altogether, so they wouldn't be calculated, even if they remained internal
# - id: !extend totalAmpsMain
# internal: true
# - id: !extend totalWattsMain
# # internal: true
# - id: !extend totalAmpsAddOn1
# internal: true
# - id: !extend totalWattsAddOn1
# internal: true
# - id: !extend totalAmpsAddOn2
# internal: true
# - id: !extend totalWattsAddOn2
# internal: true
# - id: !extend totalAmpsAddOn3
# internal: true
# - id: !extend totalWattsAddOn3
# internal: true
- id: !extend ${addon3_id1}
phase_a:
power:
internal: true
current:
internal: true
- id: !remove ct19Kwh
# Dishwasher on ct21
- id: !extend ${addon3_id1}
phase_c:
power:
qos: 0
retain: true
state_topic: ${mqtt_root_topic}/${devicename}/sensor/${ct21_name}/Watts
current:
qos: 0
retain: true
state_topic: ${mqtt_root_topic}/${devicename}/sensor/${ct21_name}/Amps
- id: !extend ct21Kwh
qos: 0
retain: true
state_topic: ${mqtt_root_topic}/${devicename}/sensor/${ct21_name}/kWh
# Dryer on ct2
- id: !extend ${main_meter_id1}
phase_b:
power:
qos: 0
retain: true
state_topic: ${mqtt_root_topic}/${devicename}/sensor/${ct2_name}/Watts
current:
qos: 0
retain: true
state_topic: ${mqtt_root_topic}/${devicename}/sensor/${ct2_name}/Amps
- id: !extend ct2Kwh
qos: 0
retain: true
state_topic: ${mqtt_root_topic}/${devicename}/sensor/${ct2_name}/kWh
# Washing Machine on ct18
- id: !extend ${addon2_id2}
phase_c:
power:
qos: 0
retain: true
state_topic: ${mqtt_root_topic}/${devicename}/sensor/${ct18_name}/Watts
current:
qos: 0
retain: true
state_topic: ${mqtt_root_topic}/${devicename}/sensor/${ct18_name}/Amps
- id: !extend ct18Kwh
qos: 0
retain: true
state_topic: ${mqtt_root_topic}/${devicename}/sensor/${ct18_name}/kWh
#Total Amps
###########
# - platform: template
# name: ${friendly_name} Total Amps
# id: totalAmps
# lambda: return id(totalAmpsMain).state + id(totalAmpsAddOn1).state + id(totalAmpsAddOn2).state + id(totalAmpsAddOn3).state ;
# accuracy_decimals: 2
# unit_of_measurement: A
# device_class: current
# update_interval: ${update_time}
#Total Watts
############
# - platform: template
# name: ${friendly_name} Total Watts
# id: totalWatts
# lambda: return id(totalWattsMain).state + id(totalWattsAddOn1).state + id(totalWattsAddOn2).state + id(totalWattsAddOn3).state ;
# accuracy_decimals: 1
# unit_of_measurement: W
# device_class: power
# update_interval: ${update_time}
#kWh
####
# - platform: total_daily_energy
# name: ${friendly_name} Total kWh
# power_id: totalWatts
# filters:
# - multiply: 0.001
# unit_of_measurement: kWh
# device_class: energy
# state_class: total_increasing
#Total A From Grid
- platform: template
name: Grid A
id: totalAmpsFromGrid
lambda: return id(ct1Amps).state + id(ct4Amps).state ;
accuracy_decimals: 1
unit_of_measurement: A
device_class: current
state_class: measurement
update_interval: ${update_time}
# filters:
# - or:
# - delta: 2.0
# - throttle_average: ${throttle_time}
# # - heartbeat: ${watt_heartbeat}
#Total Watts From Grid
- platform: template
name: Grid W
id: totalWattsFromGrid
lambda: return id(ct1Watts).state + id(ct4Watts).state ;
accuracy_decimals: 1
unit_of_measurement: W
device_class: power
state_class: measurement
update_interval: ${update_time}
# filters:
# - or:
# - delta: 5.0
# - throttle_average: ${throttle_time}
# # - heartbeat: ${watt_heartbeat}
#kWh From Grid
- platform: total_daily_energy
name: Grid kWh
power_id: totalWattsFromGrid
filters:
- multiply: 0.001
- throttle: ${kwh_throttle}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing