ESP32 Energy Meter

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}

You likely need calibration.
Did you had a look at the documentation on that topic?

Yes, I looked at the that link and I did my best to calibrate the sensors using a space heater and a plug in watt meter. I honestly think that it is picking up information from another circuit. I do not want the code to be longer than necessary

hi. I know this is almost a year later, but I was having a similar calibration issue. This is what I did using a Shelly Plus Plug that provides voltage, power, and current readings:
voltage calibration (voltage_cal): I used (Shelly Voltage reading) / (Energy Meter voltage reading) x 7305

I tried doing similar for current calibration and it worked at high loads (1200 watts) but was too low at lower load (I would get ~3.1A with a 600W load). So I used ESPHome’s calibrate_polynomial filter and I was able to get a better approximation from the meter vs the shelly:

      current:
        name: "CT02 Current"
        id: ct02Current
        filters: 
          - calibrate_polynomial: 
              degree: 2
              datapoints: 
                - 0.01 -> 0.01
                - 3.14 -> 5.42
                - 9.80 -> 9.94
          - clamp:
              min_value: 0

and went ahead to the same for the power calibration:

      power:
        name: "CT02 Power"
        id: ct02Power
        filters:
          - calibrate_polynomial: 
              degree: 2
              datapoints: 
                - 0.90 -> 0.90
                - 230 -> 600
                - 1150 -> 1188
          - clamp:
              min_value: 0

hope this helps