Files
fresh-home/esphome/circuit-setup/meter_sensors/6chan_main_sensor.yaml
T
2026-05-04 21:01:23 -04:00

323 lines
9.9 KiB
YAML

sensor:
# Main IC1
#########
- platform: atm90e32
release_device: true
cs_pin: ${main_ic1}
id: ${main_meter_id1}
phase_a:
voltage:
name: Voltage 1
id: ic1Volts
entity_category: diagnostic
accuracy_decimals: ${voltage_accuracy_decimals}
filters:
# Only log if voltage moves by 0.5V, or every 5 mins regardless
- or:
- delta: ${voltage_delta}
- heartbeat: ${voltage_heartbeat}
current:
name: ${ct1_name} ${amp_label}
id: ct1Amps
entity_category: diagnostic
accuracy_decimals: ${amp_accuracy_decimals}
filters:
# Drop noise below 0.02A, then log 0.05A changes or every 60s
- lambda: "return x < 0.02 ? 0 : x;"
- or:
- delta: ${grid_amp_delta}
- throttle: ${amp_throttle}
power:
name: ${ct1_name} ${watt_label}
id: ct1Watts
accuracy_decimals: 1
filters:
# Convert negative to positive (absolute value)
- lambda: "return abs(x);"
# Clip "ghost" watts when the device is off
- lambda: "return x < 5.0 ? 0 : x;"
- or:
- delta: ${watt_delta_grid}
- throttle: ${watt_throttle}
gain_voltage: ${voltage_cal1}
gain_ct: ${current_cal_ct1}
phase_b:
current:
name: ${ct2_name} ${amp_label}
id: ct2Amps
entity_category: diagnostic
accuracy_decimals: ${amp_accuracy_decimals}
filters:
# Drop noise below 0.02A, then log 0.05A changes or every 60s
- lambda: "return x < 0.02 ? 0 : x;"
- or:
- delta: ${amp_delta}
- throttle: ${amp_throttle}
power:
name: ${ct2_name} ${watt_label}
id: ct2Watts
accuracy_decimals: 1
filters:
# Convert negative to positive (absolute value)
- lambda: "return abs(x);"
# Clip "ghost" watts when the device is off
- lambda: "return x < 2.0 ? 0 : x;"
- or:
- delta: ${watt_delta_appliances}
- throttle: ${watt_throttle}
gain_voltage: ${voltage_cal1}
gain_ct: ${current_cal_ct2}
phase_c:
current:
name: ${ct3_name} ${amp_label}
id: ct3Amps
entity_category: diagnostic
accuracy_decimals: ${amp_accuracy_decimals}
filters:
# Drop noise below 0.02A, then log 0.05A changes or every 60s
- lambda: "return x < 0.02 ? 0 : x;"
- or:
- delta: ${amp_delta}
- throttle: ${amp_throttle}
power:
name: ${ct3_name} ${watt_label}
id: ct3Watts
accuracy_decimals: 1
filters:
# Convert negative to positive (absolute value)
- lambda: "return abs(x);"
# Clip "ghost" watts when the device is off
- lambda: "return x < 2.0 ? 0 : x;"
- or:
- delta: ${watt_delta_appliances}
- throttle: ${watt_throttle}
gain_voltage: ${voltage_cal1}
gain_ct: ${current_cal_ct3}
frequency:
name: Frequency 1
filters:
- or:
- delta: ${freq_delta}
- throttle: ${freq_throttle}
chip_temperature:
name: ${main_meter_name1} Chip Temp
line_frequency: ${electric_freq}
gain_pga: 1X
update_interval: ${update_time}
enable_offset_calibration: ${offset_calibration}
enable_gain_calibration: ${gain_calibration}
# Main IC2
##########
- platform: atm90e32
release_device: true
cs_pin: ${main_ic2}
id: ${main_meter_id2}
phase_a:
current:
name: ${ct4_name} ${amp_label}
id: ct4Amps
entity_category: diagnostic
accuracy_decimals: ${amp_accuracy_decimals}
filters:
# Drop noise below 0.02A, then log 0.05A changes or every 60s
- lambda: "return x < 0.02 ? 0 : x;"
- or:
- delta: ${grid_amp_delta}
- throttle: ${amp_throttle}
power:
name: ${ct4_name} ${watt_label}
id: ct4Watts
accuracy_decimals: ${watt_accuracy_decimals}
filters:
# Convert negative to positive (absolute value)
- lambda: "return abs(x);"
# Clip "ghost" watts when the device is off
- lambda: "return x < 2.0 ? 0 : x;"
- or:
- delta: ${watt_delta_grid}
- throttle: ${watt_throttle}
gain_voltage: ${voltage_cal2}
gain_ct: ${current_cal_ct4}
phase_b:
current:
name: ${ct5_name} ${amp_label}
id: ct5
entity_category: diagnostic
accuracy_decimals: ${amp_accuracy_decimals}
filters:
# Drop noise below 0.02A, then log 0.05A changes or every 60s
- lambda: "return x < 0.02 ? 0 : x;"
- or:
- delta: ${amp_delta}
- throttle: ${amp_throttle}
power:
name: ${ct5_name} ${watt_label}
id: ct5Watts
accuracy_decimals: ${watt_accuracy_decimals}
filters:
# Convert negative to positive (absolute value)
- lambda: "return abs(x);"
# Clip "ghost" watts when the device is off
- lambda: "return x < 2.0 ? 0 : x;"
- or:
- delta: ${watt_delta_computers}
- throttle: ${watt_throttle}
gain_voltage: ${voltage_cal2}
gain_ct: ${current_cal_ct5}
phase_c:
current:
name: ${ct6_name} ${amp_label}
id: ct6Amps
entity_category: diagnostic
accuracy_decimals: ${amp_accuracy_decimals}
filters:
# Drop noise below 0.02A, then log 0.05A changes or every 60s
- lambda: "return x < 0.02 ? 0 : x;"
- or:
- delta: ${amp_delta}
- throttle: ${amp_throttle}
power:
name: ${ct6_name} ${watt_label}
id: ct6Watts
accuracy_decimals: ${watt_accuracy_decimals}
filters:
# Convert negative to positive (absolute value)
- lambda: "return abs(x);"
# Clip "ghost" watts when the device is off
- lambda: "return x < 2.0 ? 0 : x;"
- or:
- delta: ${watt_delta_lights}
- throttle: ${watt_throttle}
gain_voltage: ${voltage_cal2}
gain_ct: ${current_cal_ct6}
#this is only needed if monitoring 2 voltages
# frequency:
# name: Frequency 2
chip_temperature:
name: ${main_meter_name2} Chip Temp
filters:
- or:
- delta: ${temp_delta}
- throttle: ${temp_throttle}
line_frequency: ${electric_freq}
gain_pga: 1X
update_interval: ${update_time}
enable_offset_calibration: ${offset_calibration}
enable_gain_calibration: ${gain_calibration}
#Total A Main
################
# - platform: template
# name: Mainboard Total ${amp_label}
# id: totalAmpsMain
# entity_category: diagnostic
# lambda: return id(ct1Amps).state + id(ct2Amps).state + id(ct3Amps).state + id(ct4Amps).state + id(ct5Amps).state + id(ct6Amps).state ;
# accuracy_decimals: ${amp_accuracy_decimals}
# unit_of_measurement: A
# device_class: current
# update_interval: ${update_time}
# filters:
# # Drop noise below 0.02A, then log 0.05A changes or every 60s
# - lambda: "return x < 0.02 ? 0 : x;"
# - or:
# - delta: ${amp_delta}
# - throttle: ${amp_throttle}
#Total W Main
#################
# - platform: template
# name: Mainboard Total ${watt_label}
# id: totalWattsMain
# lambda: return id(ct1Watts).state + id(ct2Watts).state + id(ct3Watts).state + id(ct4Watts).state + id(ct5Watts).state + id(ct6Watts).state ;
# accuracy_decimals: ${watt_accuracy_decimals}
# unit_of_measurement: ${watt_label}
# device_class: power
# update_interval: ${update_time}
# filters:
# # Convert negative to positive (absolute value)
# - lambda: "return abs(x);"
# # Clip "ghost" watts when the device is off
# - lambda: "return x < 2.0 ? 0 : x;"
# - or:
# - delta: ${watt_delta_grid}
# - throttle: ${watt_throttle}
#kWh From CT 1
- platform: total_daily_energy
name: ${ct1_name} ${kwh_label}
id: ct1Kwh
power_id: ct1Watts
accuracy_decimals: 3
filters:
- multiply: 0.001
- throttle: ${kwh_throttle}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
# kWh from CT 2
- platform: total_daily_energy
name: ${ct2_name} ${kwh_label}
id: ct2Kwh
power_id: ct2Watts
accuracy_decimals: 3
filters:
- multiply: 0.001
- throttle: ${kwh_throttle}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
#kWh From CT 3
- platform: total_daily_energy
name: ${ct3_name} ${kwh_label}
id: ct3Kwh
power_id: ct3Watts
accuracy_decimals: 3
filters:
- multiply: 0.001
- throttle: ${kwh_throttle}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
#kWh From CT 4
- platform: total_daily_energy
name: ${ct4_name} ${kwh_label}
id: ct4Kwh
power_id: ct4Watts
accuracy_decimals: 3
filters:
- multiply: 0.001
- throttle: ${kwh_throttle}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
#kWh From CT 5
- platform: total_daily_energy
name: ${ct5_name} ${kwh_label}
id: ct5Kwh
power_id: ct5Watts
accuracy_decimals: 3
filters:
- multiply: 0.001
- throttle: ${kwh_throttle}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
#kWh From CT 6
- platform: total_daily_energy
name: ${ct6_name} ${kwh_label}
id: ct6Kwh
power_id: ct6Watts
accuracy_decimals: 3
filters:
- multiply: 0.001
- throttle: ${kwh_throttle}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing