Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking grid import and export kWh seperatly (grid tied solar) #74

Closed
robwolff3 opened this issue Jan 13, 2022 · 1 comment
Closed

Comments

@robwolff3
Copy link

robwolff3 commented Jan 13, 2022

Hey CircuitSetup, love the product have been using it for many months now.

I have solar, I am using two CTs on the lines from the grid to my mains panel and two CTs on the lines from my grid tied solar to my mains panel. I am using your example ESP configuration for solar and its working great. One thing I would like to but am not familiar enough with ESP programing to figure it out is how to track import and export kWh of my grid side with separate kWh sensors. (The new Energy function of HomeAssistant doesn't tracks them separately and doesn't like it when it goes negative.) So if watts are positive tick the import kWh sensor up and if watts are negative tick the separate export kWh senor up.

Any configuration suggestions here? They would be greatly appreciated, thank you!

@robwolff3
Copy link
Author

robwolff3 commented Jan 14, 2022

I think I figured it out by adding these sensors:

#Total Grid Watts Import
  - platform: template
    name: Total Grid Watts Import
    id: totalGridWattsImport
    lambda: |-
      if (id(totalGridWatts).state > 0) {
        return id(totalGridWatts).state;
      } else {
        return 0;
      }
    accuracy_decimals: 1
    unit_of_measurement: W
    icon: "mdi:flash-circle"
    update_interval: ${update_time}
#Total Grid Watts Export
  - platform: template
    name: Total Grid Watts Export
    id: totalGridWattsExport
    lambda: |-
      if (id(ct1Watts).state + id(ct2Watts).state < 0) {
        return (id(ct1Watts).state * -1) + (id(ct2Watts).state * -1);
      } else {
        return 0;
      }
    accuracy_decimals: 1
    unit_of_measurement: W
    icon: "mdi:flash-circle"
    update_interval: ${update_time}

#Grid Import kWh
  - platform: total_daily_energy
    name: Grid Import kWh
    power_id: totalGridWattsImport
    filters:
      - multiply: 0.001
    unit_of_measurement: kWh
#Grid Export kWh
  - platform: total_daily_energy
    name: Grid Export kWh
    power_id: totalGridWattsExport
    filters:
      - multiply: 0.001
    unit_of_measurement: kWh

Case closed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant