Solar production being included in Energy Usage graph

Hi all

I’m running HA 2025.5.1 on the HA Green. I’m using the Octopus Energy integration with an Octopus Home Mini to track electricity and gas usage. And the Solis Cloud integration for my solar production. I have no batteries for my solar, so anything not used is exported, FYI.

On the Energy dashboard, the Energy Usage graph is showing my electricity usage stacked ontop of the solar production. Which is a duplicate of the data in the… Solar production graph below it. And I can’t figure out why?

Here is the dashboard config:

The electricity is set up with the entity specified in the integration docs

Any ideas why the dashboard considers my production usage?

In an old rPi HASS with 2023.something it used to work OK.

Thanks in advance.

1 Like

All production is considered usage unless it is tracked as going somewhere else.

usage = production - to_battery - return_to_grid

1 Like

You need to add a return to grid measurement.

1 Like

Thanks @karwosts and @gedger. Understood.

Unfortunately, the Octopus integration doesn’t have export quantity data (it does have cost data). There is hope for data in the future (dev opened a Github issue here)

1 Like

Octopus do not provide export energy tracking on a real time basis. However, if you have a Solis inverter then this will almost certainly have a connected power meter with CT clamp on the main supply.

Solis inverters hold the grid power value, taken from the meter, which is signed positive/negative for export/import. It is just a matter of reading the grid power value, with two template sensors set to provide import (abs when -ve) and export (when +ve) separately, and then a Reimann Sum Integration on each will give import energy and export energy.

Although not as responsive, Solis inverters also hold and report Grid Import and Grid Export energy, both total and today. You can use Grid Export Today if available, or pass Grid Export Total through a daily Utility Meter to get grid export energy today that way.

I don’t use Solis cloud anymore but read directly using Modbus and all the data is available.

Thanks all.

To get around this, I created myself a couple of sensors. One to calculate solar exported (demand goes into the negative, which equates to solar exported). And one to track export over time. Seems to work well.

template:
  - sensor:
      - name: "Solar Power Exported"
        unique_id: solar_power_export_sensor
        unit_of_measurement: "W"
        state_class: measurement
        device_class: power
        state: >
          {% set solar = states('sensor.solis_ac_output_total_power') %}
          {% set demand = states('sensor.octopus_energy_electricity_22l3741775_1900029181234_current_demand') %}

          {% if solar in ['unavailable', 'unknown', None] or demand in ['unavailable', 'unknown', None] %}
            {{ 'unavailable' }}
          {% else %}
            {% set solar = solar | float(0) %}
            {% set demand = demand | float(0) %}
            {% if demand < 0 %}
              {{ demand | abs }}
            {% else %}
              {% set export = solar - demand %}
              {{ export if export > 0 else 0 }}
            {% endif %}
          {% endif %}
  
  - sensor:
      - name: "Solar Power Used"
        unique_id: solar_power_used_sensor
        unit_of_measurement: "W"
        state_class: measurement
        device_class: power
        state: >
          {% set solar = states('sensor.solis_ac_output_total_power') | float(0) %}
          {% set export = states('sensor.solar_power_exported') | float(0) %}
          {% set used = solar - export %}
          {{ used if used > 0 else 0 }}