Created
February 19, 2024 16:36
-
-
Save ctag/7e4cacfea61a04cd057c0c1758cd8e26 to your computer and use it in GitHub Desktop.
ESPHome config for CircuitSetup Split Single Phase Real Time Whole House Energy Meter Solar Kit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esphome: | |
name: cs-energy-monitor | |
friendly_name: CS Energy Monitor | |
esp32: | |
board: esp32dev | |
framework: | |
type: arduino | |
# NONE, ERROR, WARN, INFO, DEBUG (default), VERBOSE, VERY_VERBOSE | |
# Enable logging | |
logger: | |
level: WARN | |
# Enable Home Assistant API | |
api: | |
encryption: | |
key: "xxx" | |
ota: | |
password: "xxx" | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "Cs-Energy-Monitor" | |
password: "xxx" | |
captive_portal: | |
time: | |
- platform: sntp | |
id: sntp_time | |
switch: | |
- platform: restart | |
name: ${disp_name} Restart | |
# Example configuration entry for split single phase meter | |
spi: | |
clk_pin: 18 | |
miso_pin: 19 | |
mosi_pin: 23 | |
substitutions: | |
# Change the disp_name to something you want | |
disp_name: House | |
solar_name: Spa | |
# Interval of how often the power is updated | |
update_time: 15s | |
# Current transformer calibrations: | |
# 80A/26.6mA SCT-010: 39571 | |
# 100A/50mA SCT-013: 26315 | |
# 120A/40ma SCT-016: 39473 - default kit CT | |
# 200A/100mA SCT-024: 26315 | |
# 200A/50mA SCT-024: 52630 | |
current_cal: '39473' | |
# AC Transformer voltage calibration 9VAC Jameco 157041: 37106 | |
# For Meters >= v1.4 rev3: 3920 | |
voltage_cal: '3920' | |
sensor: | |
- platform: wifi_signal | |
name: ${disp_name} WiFi Signal | |
update_interval: 60s | |
- platform: atm90e32 | |
cs_pin: 5 | |
data_rate: 2MHz | |
phase_a: | |
voltage: | |
name: ${disp_name} Volts | |
accuracy_decimals: 1 | |
current: | |
name: ${disp_name} CT1 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: ${disp_name} CT1 Watts | |
accuracy_decimals: 1 | |
id: "ct1Watts" | |
# filters: | |
# - multiply: 2 | |
gain_voltage: ${voltage_cal} | |
gain_ct: ${current_cal} | |
phase_c: | |
current: | |
name: ${disp_name} CT2 Amps | |
id: "ct2Amps" | |
# 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: ${disp_name} CT2 Watts | |
accuracy_decimals: 1 | |
id: "ct2Watts" | |
# filters: | |
# - multiply: 2 | |
gain_voltage: ${voltage_cal} | |
gain_ct: ${current_cal} | |
frequency: | |
name: ${disp_name} Freq | |
line_frequency: 60Hz | |
gain_pga: 1X | |
update_interval: ${update_time} | |
- platform: template | |
name: ${disp_name} Total Amps | |
id: "totalAmps" | |
lambda: return id(ct1Amps).state + id(ct2Amps).state; | |
accuracy_decimals: 2 | |
unit_of_measurement: A | |
update_interval: ${update_time} | |
device_class: current | |
- platform: template | |
name: ${disp_name} Total Watts | |
id: "totalWatts" | |
lambda: return id(ct1Watts).state + id(ct2Watts).state; | |
accuracy_decimals: 0 | |
unit_of_measurement: W | |
device_class: power | |
update_interval: ${update_time} | |
- 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 | |
# Spa meter | |
- platform: atm90e32 | |
cs_pin: 4 | |
data_rate: 2MHz | |
phase_a: | |
voltage: | |
name: ${solar_name} Volts | |
accuracy_decimals: 1 | |
current: | |
name: ${solar_name} CT3 Amps | |
id: "ct3Amps" | |
power: | |
name: ${solar_name} CT3 Watts | |
accuracy_decimals: 1 | |
id: "ct3Watts" | |
gain_voltage: ${voltage_cal} | |
gain_ct: ${current_cal} | |
phase_c: | |
current: | |
name: ${solar_name} CT4 Amps | |
id: "ct4Amps" | |
power: | |
name: ${solar_name} CT4 Watts | |
accuracy_decimals: 1 | |
id: "ct4Watts" | |
gain_voltage: ${voltage_cal} | |
gain_ct: ${current_cal} | |
frequency: | |
name: ${solar_name} Freq | |
line_frequency: 60Hz | |
gain_pga: 1X | |
update_interval: ${update_time} | |
- platform: template | |
name: ${solar_name} Total Amps | |
id: "spaTotalAmps" | |
lambda: return id(ct3Amps).state + id(ct4Amps).state; | |
accuracy_decimals: 2 | |
unit_of_measurement: A | |
update_interval: ${update_time} | |
device_class: current | |
- platform: template | |
name: ${solar_name} Total Watts | |
id: "spaTotalWatts" | |
lambda: return id(ct3Watts).state + id(ct4Watts).state; | |
accuracy_decimals: 0 | |
unit_of_measurement: W | |
device_class: power | |
update_interval: ${update_time} | |
- platform: total_daily_energy | |
name: ${solar_name} Total kWh | |
power_id: spaTotalWatts | |
filters: | |
- multiply: 0.001 | |
unit_of_measurement: kWh | |
device_class: energy | |
state_class: total_increasing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your SPI data rate should be 1Mhz max.