Integration - Riemann sum integral: Value Graph is broken

I’ve identified a strange behavoiur of a value graph produced by Riemann sum integral:

image

Riemann Input:

image

# ########## Start: Inverter Input Power with Correction ##########
#
# - for Riemann Integration:
#   - for real Solar Input Energy (Solar Yield )
#
template:
  - sensor:
      - name: inverter_input_power_with_correction
        unique_id: inverter_input_power_with_correction
        #friendly_name: "Inverter input power"
        state_class: measurement
        device_class: power
        unit_of_measurement: "W"
        icon: mdi:solar-power
        state: >-
          {# For SUN2000-3-10KTL-M1 (High Current Version) #}
          {# Check the Input Voltage of connected MPPTs #}
          {# Assuming an Input Voltage above 600 V #}

          {# Adjust this value to the rated power of your inverter #}
          {% set inv_rating = 6000 %}

          {% set inv_input_power = states('sensor.inverter_input_power')|float(0) %}

          {% if inv_input_power < (inv_rating*0.05) %}
            {# inv_input_power < 300 W - For above rated power of 6000 W #}
            {{ (inv_input_power * 1.00)|float(0) }}
          {% elif inv_input_power < (inv_rating*0.1) %}
            {# inv_input_power < 600 W - For above rated power of 6000 W #}
            {{ (inv_input_power * 1.00)|float(0) }}
          {% elif inv_input_power < (inv_rating*0.15) %}
            {# inv_input_power < 900 W - For above rated power of 6000 W #}
            {{ (inv_input_power * 1.00)|float(0) }}
          {% elif inv_input_power < (inv_rating*0.2) %}
            {# inv_input_power < 1200 W - For above rated power of 6000 W #}
            {{ (inv_input_power * 1.00)|float(0) }}
          {% elif inv_input_power < (inv_rating*0.25) %}
            {# inv_input_power < 1500 W - For above rated power of 6000 W #}
            {{ (inv_input_power * 1.00)|float(0) }}
          {% elif inv_input_power < (inv_rating*0.3) %}
            {# inv_input_power < 1800 W - For above rated power of 6000 W #}
            {{ (inv_input_power * 1.0038)|float(0) }}
          {% else %}
            {# inv_input_power >= 1800 W - For above rated power of 6000 W #}
            {{ (inv_input_power * 1.0063)|float(0) }}
          {% endif %}
        availability: >-
          {{ (states('sensor.inverter_input_power')|is_number) }}
#
# ########## End: Inverter Input Power with Correction ##########

Riemann Output:

# ########## Start: Integration Sensors ##########
#
sensor:
  #
  # Solar Yield with Inverter Input Power Correction
  #
  # - For Production and used in the cards
  #
  - platform: integration
    name: solar_yield
    unique_id: solar_yield
    source: sensor.inverter_input_power_with_correction
    unit_prefix: k
    method: left
#
# ########## End: Integration Sensors ##########

Any ideas in which way it can be ensured that the graph will have continuous data even if the values are not changing during the night?

If I rember me correctly the riemann graph was good at least 3-4 weeks ago.
In my opinion it is broken by updating HA to the last versions.

Any help is appreciated.

There are some github issues for this and similar - hopefully it will be resolved soon. It has to do with zeros and “unknowns” which it is not dealing with properly any more. It’s affecting things like plugs that are used sporadically too (i.e. washing machine etc.).

Show the history graph for the sensor you used in your availability template.

sensor.inverter_input_power:

=> All sensors in the chain to feed Riemann integration sensor are fine.

That’s not showing the same date range as your previous history graphs.

image

image

All solar_yield related template sensors are broken too …
A nightmare.

In which way can I switch back to previous HA versions?
In my opinion until end of april it was OK.

https://www.home-assistant.io/common-tasks/os/#run-a-specific-version


ha core update --version 2023.4.6

Jepp - I’ve also found this peace of documentation.

I’m already making a full backup of 2023.5.2
and then i will downgrade to 2023.4.6

After downgrading to 2023.4.6 the value graph produced by Riemann sum integral is working again.

Seems to be a bug in 2023.5.1 or 2023.5.2.

These are the currently open issues:

never mind. seems like it was caused by restarting hass at night :innocent: