Files
fresh-home/esphome/circuit-setup/examples/6chan_main_calibration_beta.yaml
T
2025-12-09 16:59:38 -05:00

421 lines
11 KiB
YAML

# CircuitSetup 6 Channel Energy Meter Main Board example config
# See all options at https://esphome.io/components/sensor/atm90e32.html
substitutions:
# Change the disp_name to something you want
disp_name: Energy-Meter
friendly_name: CircuitSetup Energy Meter Wifi
# Interval of how often the power data is updated
update_time: 60s
# Change current_cal to the corresponding CT's that you're using
# If different CTs per current channel, remove or change "${current_cal}" from
# "gain_ct" below and replace with the CT calibration number respectively
# Current Transformers:
# 20A/25mA SCT-006: 11143
# 30A/1V SCT-013-030: 8650
# 50A/1V SCT-013-050: 15420
# 50A/16.6mA SCT-010: 41334
# 80A/26.6mA SCT-010: 41660
# 100A/50ma SCT-013-000: 27518
# 120A/40mA: SCT-016: 41787
# 200A/100mA SCT-024: 27518
# 200A/50mA SCT-024: 55036
current_cal_ct1: '27518'
current_cal_ct2: '27518'
current_cal_ct3: '27518'
current_cal_ct4: '27518'
current_cal_ct5: '27518'
current_cal_ct6: '27518'
# This only needs to be changed if you're using something other than the
# Jameco 9VAC Transformer:
voltage_cal1: '7305'
voltage_cal2: '7305'
main_meter_name1: Meter 1-3
main_meter_name2: Meter 4-6
main_meter_id1: meter_main1
main_meter_id2: meter_main2
ct1_name: CT1
ct2_name: CT2
ct3_name: CT3
ct4_name: CT4
ct5_name: CT5
ct6_name: CT6
#packages:
# common: github://CircuitSetup/Expandable-6-Channel-ESP32-Energy-Meter/Software/ESPHome/6chan_common.yaml
esphome:
name: energy-meter
friendly_name: "${friendly_name}"
name_add_mac_suffix: true
min_version: '2025.5.0'
project:
name: circuitsetup.6c-energy-meter
version: "1.5"
esp32:
board: nodemcu-32s
captive_portal:
improv_serial:
logger:
level: DEBUG
# Enable OTA updating
ota:
- platform: esphome
web_server:
port: 80
spi:
interface: software
clk_pin: 18
miso_pin: 19
mosi_pin: 23
time:
- platform: homeassistant
id: homeassistant_time
dashboard_import:
package_import_url: github://CircuitSetup/Expandable-6-Channel-ESP32-Energy-Meter/Software/ESPHome/6chan_main_calibration_beta.yaml
import_full_config: false
api:
wifi:
# Set up a wifi access point
ap:
sensor:
#IC1
- platform: atm90e32
cs_pin: 5
id: ${main_meter_id1}
phase_a:
voltage:
name: Voltage 1
id: ic1Volts
accuracy_decimals: 1
current:
name: ${ct1_name} Amps
id: ct1Amps
# The max value for current that the meter can output is 65.535. If you expect to measure current over 65A,
# divide the gain_ct by 2 (120A CT) or 4 (200A CT) and multiply the current and power values by 2 or 4 by uncommenting the filter below
# filters:
# - multiply: 2
power:
name: ${ct1_name} Watts
id: ct1Watts
# filters:
# - multiply: 2
reactive_power:
name: ${ct1_name} VAR
apparent_power:
name: ${ct1_name} VA
harmonic_power:
name: ${ct1_name} Harmonic Power
power_factor:
name: ${ct1_name} PF
phase_angle:
name: ${ct1_name} Phase Angle
peak_current:
name: ${ct1_name} Peak Current
gain_voltage: ${voltage_cal1}
gain_ct: ${current_cal_ct1}
offset_voltage: 0
offset_current: 0
offset_active_power: 0
offset_reactive_power: 0
phase_b:
current:
name: ${ct2_name} Amps
id: ct2Amps
power:
name: ${ct2_name} Watts
id: ct2Watts
reactive_power:
name: ${ct2_name} VAR
apparent_power:
name: ${ct2_name} VA
harmonic_power:
name: ${ct2_name} Harmonic Power
power_factor:
name: ${ct2_name} PF
phase_angle:
name: ${ct2_name} Phase Angle
peak_current:
name: ${ct2_name} Peak Current
gain_voltage: ${voltage_cal1}
gain_ct: ${current_cal_ct2}
offset_voltage: 0
offset_current: 0
offset_active_power: 0
offset_reactive_power: 0
phase_c:
current:
name: ${ct3_name} Amps
id: ct3Amps
power:
name: ${ct3_name} Watts
id: ct3Watts
reactive_power:
name: ${ct3_name} VAR
apparent_power:
name: ${ct3_name} VA
harmonic_power:
name: ${ct3_name} Harmonic Power
power_factor:
name: ${ct3_name} PF
phase_angle:
name: ${ct3_name} Phase Angle
peak_current:
name: ${ct3_name} Peak Current
gain_voltage: ${voltage_cal1}
gain_ct: ${current_cal_ct3}
offset_voltage: 0
offset_current: 0
offset_active_power: 0
offset_reactive_power: 0
frequency:
name: Frequency 1
chip_temperature:
name: ${main_meter_name1} Chip Temp
line_frequency: 60Hz
gain_pga: 1X
update_interval: ${update_time}
enable_offset_calibration: true
enable_gain_calibration: true
#IC2
- platform: atm90e32
cs_pin: 4
id: ${main_meter_id2}
phase_a:
#this voltage is only needed if monitoring 2 voltages
# voltage:
# name: Voltage 2
# id: ic2Volts
# accuracy_decimals: 1
current:
name: ${ct4_name} Amps
id: ct4Amps
power:
name: ${ct4_name} Watts
id: ct4Watts
reactive_power:
name: ${ct4_name} VAR
apparent_power:
name: ${ct4_name} VA
harmonic_power:
name: ${ct4_name} Harmonic Power
power_factor:
name: ${ct4_name} PF
phase_angle:
name: ${ct4_name} Phase Angle
peak_current:
name: ${ct4_name} Peak Current
gain_voltage: ${voltage_cal2}
gain_ct: ${current_cal_ct4}
offset_voltage: 0
offset_current: 0
offset_active_power: 0
offset_reactive_power: 0
phase_b:
current:
name: ${ct5_name} Amps
id: ct5Amps
power:
name: ${ct5_name} Watts
id: ct5Watts
reactive_power:
name: ${ct5_name} VAR
apparent_power:
name: ${ct5_name} VA
harmonic_power:
name: ${ct5_name} Harmonic Power
power_factor:
name: ${ct5_name} PF
phase_angle:
name: ${ct5_name} Phase Angle
peak_current:
name: ${ct5_name} Peak Current
gain_voltage: ${voltage_cal2}
gain_ct: ${current_cal_ct5}
offset_voltage: 0
offset_current: 0
offset_active_power: 0
offset_reactive_power: 0
phase_c:
current:
name: ${ct6_name} Amps
id: ct6Amps
power:
name: ${ct6_name} Watts
id: ct6Watts
reactive_power:
name: ${ct6_name} VAR
apparent_power:
name: ${ct6_name} VA
harmonic_power:
name: ${ct6_name} Harmonic Power
power_factor:
name: ${ct6_name} PF
phase_angle:
name: ${ct6_name} Phase Angle
peak_current:
name: ${ct6_name} Peak Current
gain_voltage: ${voltage_cal2}
gain_ct: ${current_cal_ct6}
offset_voltage: 0
offset_current: 0
offset_active_power: 0
offset_reactive_power: 0
#this is only needed if monitoring 2 voltages
# frequency:
# name: Frequency 2
chip_temperature:
name: ${main_meter_name2} Chip Temp
line_frequency: 60Hz
gain_pga: 1X
update_interval: ${update_time}
enable_offset_calibration: true
enable_gain_calibration: true
#Total Amps
- platform: template
name: ${disp_name} Total Amps
id: totalAmps
lambda: return id(ct1Amps).state + id(ct2Amps).state + id(ct3Amps).state + id(ct4Amps).state + id(ct5Amps).state + id(ct6Amps).state ;
accuracy_decimals: 2
unit_of_measurement: A
device_class: current
update_interval: ${update_time}
#Total Watts
- platform: template
name: ${disp_name} Total Watts
id: totalWatts
lambda: return id(ct1Watts).state + id(ct2Watts).state + id(ct3Watts).state + id(ct4Watts).state + id(ct5Watts).state + id(ct6Watts).state ;
accuracy_decimals: 1
unit_of_measurement: W
device_class: power
update_interval: ${update_time}
#kWh
- platform: total_daily_energy
name: ${disp_name} Total kWh
power_id: totalWatts
filters:
- multiply: 0.001
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
#wifi diagnostic
- platform: wifi_signal
name: ${disp_name} WiFi
id: wifi_signal_db
entity_category: diagnostic
- platform: copy
source_id: wifi_signal_db
id: wifi_signal_pct
name: ${disp_name} WiFi %
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
entity_category: diagnostic
switch:
- platform: restart
name: ${disp_name} Restart
entity_category: diagnostic
text_sensor:
- platform: atm90e32
id: ${main_meter_id1}
phase_status:
phase_a:
name: "${ct1_name} Status"
phase_b:
name: "${ct2_name} Status"
phase_c:
name: "${ct3_name} Status"
frequency_status:
name: "Frequency Status 1"
- platform: atm90e32
id: ${main_meter_id2}
phase_status:
phase_a:
name: "${ct4_name} Status"
phase_b:
name: "${ct5_name} Status"
phase_c:
name: "${ct6_name} Status"
#this is only needed if monitoring 2 voltages
# freq_status:
# name: "Frequency Status 2"
button:
- platform: atm90e32
id: ${main_meter_id1}
run_gain_calibration:
name: "Run ${main_meter_name1} Gain Calibration"
clear_gain_calibration:
name: "Clear ${main_meter_name1} Gain Calibration"
run_offset_calibration:
name: "Run ${main_meter_name1} Offset Calibration"
clear_offset_calibration:
name: "Clear ${main_meter_name1} Offset Calibration"
run_power_offset_calibration:
name: "Run ${main_meter_name1} Power Offset Calibration"
clear_power_offset_calibration:
name: "Clear ${main_meter_name1} Power Offset Calibration"
- platform: atm90e32
id: ${main_meter_id2}
run_gain_calibration:
name: "Run ${main_meter_name2} Gain Calibration"
clear_gain_calibration:
name: "Clear ${main_meter_name2} Gain Calibration"
run_offset_calibration:
name: "Run ${main_meter_name2} Offset Calibration"
clear_offset_calibration:
name: "Clear ${main_meter_name2} Offset Calibration"
run_power_offset_calibration:
name: "Run ${main_meter_name2} Power Offset Calibration"
clear_power_offset_calibration:
name: "Clear ${main_meter_name2} Power Offset Calibration"
number:
- platform: atm90e32
id: ${main_meter_id1}
reference_voltage:
# will copy to phase_b/c for calibration reference
phase_a:
name: "Ref Voltage 1"
reference_current:
phase_a:
name: "${ct1_name} Ref Current"
phase_b:
name: "${ct2_name} Ref Current"
phase_c:
name: "${ct3_name} Ref Current"
- platform: atm90e32
id: ${main_meter_id2}
reference_voltage:
# needed to calibrate voltage registers even if not output
phase_a:
name: "Ref Voltage 2"
reference_current:
phase_a:
name: "${ct4_name} Ref Current"
phase_b:
name: "${ct5_name} Ref Current"
phase_c:
name: "${ct6_name} Ref Current"