Expandable-6-Channel-ESP32-Energy-Meter icon indicating copy to clipboard operation
Expandable-6-Channel-ESP32-Energy-Meter copied to clipboard

With US split phase, simultaneous import and export is possible - small improvement to example

Open scotte opened this issue 6 months ago • 1 comments

For what it's worth, with a US split phase system, simultaneous import and export is possible. While this has no effect on the overall net values, it can matter if someone is tracking costs, or wants to see a bit more accurate data, during early/late hours or during poor weather.

I modified the examples from https://github.com/CircuitSetup/Expandable-6-Channel-ESP32-Energy-Meter/blob/master/Software/ESPHome/6chan_energy_meter_house_solar_ha_kwh.yaml as follows, using values from each phase separately (noting that I use "import" instead of "positive" and "export" instead of "negative" as I find those terms to be a bit more common).

  #Export Watts
  - platform: template
    name: Export
    id: exportWatts
    lambda: |-
      float l1watts = id(houseL1Watts).state;
      float l2watts = id(houseL2Watts).state;
      if (l1watts > 0.0) {
        l1watts = 0.0;
      }
      if (l2watts > 0.0) {
        l2watts = 0.0;
      }
      return abs(l1watts) + abs(l2watts);
    accuracy_decimals: 1
    unit_of_measurement: W
    device_class: power
    update_interval: ${update_time}
  #Import Watts
  - platform: template
    name: Import
    id: importWatts
    lambda: |-
      float l1watts = id(houseL1Watts).state;
      float l2watts = id(houseL2Watts).state;
      if (l1watts < 0.0) {
        l1watts = 0.0;
      }
      if (l2watts < 0.0) {
        l2watts = 0.0;
      }
      return l1watts + l2watts;
    accuracy_decimals: 1
    unit_of_measurement: W
    device_class: power
    update_interval: ${update_time}

The lambdas could be made a bit more terse - i.e. something like float l1watts = (l1watts < 0.0) ? 0 : id(houseL1Watts).state; should be valid, I think.

While this is a bit of a Fool's Errand at some level, I was able to maximize my consumption during poor solar conditions by swapping two breakers around to balance the house "idle" loads between phases.

I figured I would post this here as an issue in case someone else comes across it and wants to track things a bit more accurately. Thank you!

scotte avatar Dec 27 '23 15:12 scotte

You might be able to help me with my current issue that is potentially related to this. I'm tracking power being pulled from the grid, power being generated by my solar panel with excess going into my batteries, and the total home's load at any given time.

For some reason, my tracked/calculated power imported from the grid starts becoming erratic when solar power starts being generated in the morning and the excess starts going into the batteries. The answer may lie in something you posted here.

BobbyBleacher avatar Jan 02 '24 03:01 BobbyBleacher