Calculate real power consumption with solar

Hi,
I do have a question regarding the tracking of my actual power consumption.

I do have a device at my power meter to get the power consumption. Now I also added a solar panel to the system where I use a shelly to track the power production.

Now if the solar power is directly feed into my power grid, so power is directly consumed and not showing actually in the total power consumption on the power meter. This means if I produce more than I actual currently consume, the total power meter shows a negative value. I already created a sensor to track this value what goes back into the power grip.

My problem is that I want to track what I actually consume in my house and dismissing the solar generated power.

The question here would be if I need a sensor which calculates the actual power consumption, by taking the value of the power meter (only positive) and ADD the generated power? Or do I have this wrong ?

Maybe a sensor template in your yaml config?

Something like this:

sensor:
  - platform: template
    sensors:
      actual_usage:
        friendly_name: "Actual Usage"
        value_template: "{{ states('sensor.active_power') + states('sensor.pv_grid_power') }}"
        icon_template: mdi:lightning-bolt
        device_class: power
        state_class: measurement
        unit_of_measurement: W

If you active power goes below 0, by adding solar consumption, you get the right amount
if it’s saying 100W for instance, you need to add the amount generated as actual usage

1 Like