I am completely new to ESPHome and Yaml. Please be gentle and correct any of my terminology
I purchased a ESP32 energy meter board and I have everything setup to work with HA. There are a couple of circuits that I only turn on when my pool is open. As of right now, they are off and I am getting negative values for watts and amps. I did find a yaml script that creates a new ID and I am to use that ID in my total watts and amps calculations. To me, that does not seem to be the correct thing to do. Can I get some help to update the yaml so it will redefine the original watts and amps to be 0 when the values are negative?
#IC2 AddOn
- platform: atm90e32
cs_pin: 16
phase_a:
current:
name: ${disp_name} CT10 Amps
id: ct10Amps
power:
name: ${disp_name} CT10 Watts
id: ct10Watts
gain_voltage: ${voltage_cal}
gain_ct: 42650
phase_b:
current:
name: ${disp_name} CT11 Amps
id: ct11Amps
power:
name: ${disp_name} CT11 Watts
id: ct11Watts
gain_voltage: ${voltage_cal}
gain_ct: 42650
phase_c:
current:
name: ${disp_name} CT12 Amps
id: ct12Amps
power:
name: ${disp_name} CT12 Watts
id: ct12Watts
gain_voltage: ${voltage_cal}
gain_ct: 42650
line_frequency: 60Hz
gain_pga: 1X
update_interval: ${update_time}
#zero out
- platform: template
name: ${disp_name} CT11 Watts Positive
id: ct11WattsPositive
lambda: |-
if (id(ct11Watts).state < 0) {
return 0;
} else {
return id(ct11Watts).state ;
}
accuracy_decimals: 2
unit_of_measurement: W
icon: "mdi:flash-circle"
update_interval: ${update_time}