Skip to content
osxdoc edited this page Nov 12, 2023 · 10 revisions

The "Daily Yield" reported by the inverter is the output yield of the inverter, and not the input from your solar panels. For installations which have a battery connected to it, this is a significant difference: it includes the yield from discharging the battery, but misses the yield used to charge the battery. FusionSolar computes the "Yield" by combining the values from "Daily Yield", "Battery Day Charge" and "Battery Day Discharge":

Input Yield = Daily Yield - Battery Day Discharge + Battery Day Charge

However, this simple computation can mean that the input yield value decreases slightly throughout the day, as the 'Battery Day Discharge' value can decrease a bit more than the 'Daily Yield' decreases. This makes it unsuitable for usage in the Home Assistant Energy Dashboard, as this expects a monotonically increasing value.

Computing the 'Daily Solar Yield'

By 'Daily Solar Yield' we mean the yield of your solar panels, minus any efficiency losses by the inverter.

A Simple Approach

A simple approach is to take the Riemann sum from the 'Active Power' sensor:

sensor:
  - platform: integration
    source: sensor.active_power
    name: active_power_riemann
    round: 3

While this approach is very easy to implement and understand, this approach overestimates the actual yield, as it does not take into account the efficiency losses of the inverter. Look to the next section for a better approach.

A Better Approach

A better approach is to take into account the efficiency loss in the inverter.

The following solution was found to approach the real 'Daily Solar Yield' much better. It works by first defining a sensor that takes into account the efficiency loss of the inverter, then defining a simple Riemann integration sensor, similar to the previous section, that utilises the sensor with efficiency loss:

template:
  - sensor:
    - name: "input_power_with_efficiency_loss"
      unique_id: "input_power_with_efficiency_loss"
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      state: >-
        {% set inverter_rating = 3000 %} {# adjust this value to the rated power of your inverter #}
        {% set inpower = states('sensor.inverter_input_power')|float(0) %}
        {% if inpower < (inverter_rating*0.1) %}
          {{ inpower * 0.90 }}
        {% elif inpower < (inverter_rating*0.2) %}  
          {{ inpower * 0.95 }}
        {% else %}
          {{ inpower * 0.98 }}
        {% endif %}

The values above were derived from the inverter datasheet, which features the following graph:

image

The inverter_rating can be derived from the model name of your inverter. Eg. the "SUN2000-3KTL-M1" can output 3000W, whereas the "SUN2000-10KTL-M1" can output 10000W.

Now you can use this adjusted value to get a better Riemann sum:

sensor:
  - platform: integration
    source: sensor.input_power_with_efficiency_loss
    name: solar_energy_riemann
    round: 3

The snippets should be added to your configuration.yaml file. If you already have template or sensor sections, then add the content to the relevant section, without the first line, e.g. without sensor: or template:.

Energy Calculation from the Inverter and Battery sensors values (without Riemann Integration)

As the above properly wrote formula:

PV Daily Input Yield = Daily Yield - Battery Day Discharge + Battery Day Charge

And the generic consequent formula:

PV Total Input Yield = Total Yield - Battery Total Discharge + Battery Total Charge

It is possible to calculate the values exactly how those are calculated by Fusion Solar app: The daily values calculated in this way meet the Fusion Solar app values.

These are the lines to add in the configuration.yaml file in the sensors section:

template:
  - sensor:
      - name: "energy_pv"
        unique_id: "PV Energy"
        state: >
          {{ (states('sensor.inverter_total_yield') | float) - (states('sensor.battery_total_discharge') | float) + (states('sensor.battery_total_charge') | float) }}
        device_class: energy
        state_class: total_increasing
        unit_of_measurement: 'kWh'

      - name: "energy_pv_daily"
        unique_id: "PV Energy daily"
        state: >
          {{ (states('sensor.inverter_daily_yield') | float) - (states('sensor.battery_day_discharge') | float) + (states('sensor.battery_day_charge') | float) }}
        device_class: energy
        state_class: total_increasing
        unit_of_measurement: 'kWh'

Note that during the night, because of inverter's power loss, those values should be negative.