Average Sensor not returning values

Hi all,
I’m currently struggeling with the average sensor provided via HACS by Limych.

Maybe one or two words on my use case:
I’m running a solar collector on my roof which is integrated via the SMA integration. As the integration itself only provides some sensors I had to calculate some more sensors (more on that below). Now I can see the current production in Watts, my current usage and the excessive Wattage.
Apart from that I have a pool in my garden with a heatpump, which consumes quite some energy. Thus I only want to run the heatpump when there’s enough energy produced. The heatpump itself should not be turned on /off too frequently thus my idea was to calculate the average excessive energy (lets say over the past 15 minutes) to see when we are near sunset, thus the heatpump should turn off.

Now:
This is the sensors on which I based my calculation of excessive energy

sensor:
# Bezug  >>>> Wattage provided by grid
  - platform: integration
    source: sensor.sn_3009008128_metering_power_absorbed
    name: total_absorbed
    unit_prefix: k
    round: 2
# Einspeisung >>>> Wattage provided to the grid
  - platform: integration
    source: sensor.sn_3009008128_metering_power_supplied
    name: power_supplied
    unit_prefix: k
    round: 2
# Erzeugung >>>> Energy produced on my roof
  - platform: integration
    source: sensor.sn_3009008128_grid_power
    name: grid_power
    unit_prefix: k
    round: 2
    
# Ladung >>>> Energy provided to my battery
  - platform: integration
    source: sensor.sn_1901023494_battery_power_charge_total
    name: ladung
    unit_prefix: k
    round: 2
# Entladung >>>>> Energy consumed from my battery
  - platform: integration
    source: sensor.sn_1901023494_battery_power_discharge_total
    name: entladung
    unit_prefix: k
    round: 2

Based on those sensors I had to do the math of calculating the current excessive energy (as the SMA integration doesn’t provide that out of the box):

template:
  - sensor:

      - name: "Verbrauch"    >>> Consumption
        unit_of_measurement: "W"
        state: >
          {% set erzeugung    = states('sensor.sn_3009008128_grid_power') | float %}
          {% set einspeisung  = states('sensor.sn_3009008128_metering_power_supplied') | float %}
          {% set netzbezug    = states('sensor.sn_3009008128_metering_power_absorbed') | float %}
          
          {% set ladung       = states('sensor.sn_1901023494_battery_power_charge_total') | float %}
          {% set entladung    = states('sensor.sn_1901023494_battery_power_discharge_total') | float %}

          {{ (erzeugung - einspeisung + netzbezug - ladung + entladung) | round(0) }}

      - name: "Überschuss" >>> Excessive energy
        unit_of_measurement: "W"
        state: >
          {% set erzeugung    = states('sensor.sn_3009008128_grid_power') | float %}
          {% set verbrauch    = states('sensor.verbrauch') | float %}
          
          {{ (erzeugung - verbrauch) | round(0)}}

All of the above sensors work fine and provide real time data on my current energy situation in my household.

Coming to an end:
I’d like to calculate the running 15 minute average of the sensor “Überschuss” (correct name is: “sensor.uberschuss”)

I added the following part to my configuration.yaml but the sensor itself is being shown as “Unavailable”

  - platform: average
    name: '15minsRollingUberschuss'
    duration: 00:15:00
    entities:
      - sensor.uberschuss

  - platform: average
    name: '60sekRollingErzeugung'
    duration: 60
    entities:
      - sensor.sn_3009008128_grid_power

Testwise I added a 60 second rolling average based on a sensor provided by the SMA integration which doesn’t work either.

Any ideas of how to proceed?

When was the last time you updated Liam’s third party integration?

There was a fix for a breaking change released a version or so ago.

Yeah okay. I just updated my how HA installation and now it seems to be working.
Thanks for the tip!