Skip to content

Integral value is incorrect when max_sub_interval less than sensor update interval #139099

Open
@gagara

Description

The problem

I have sensor which is updated every 15 sec (instant value of the power produced by solar inverter)
If I create left Riemann integral helper with max_sub_interval=20sec then everything works fine. Calculated integral value is correct (I can confirm this by comparing with the value calculated by solar inverter itself)
But if I use max_sub_interval=10sec then calculated integral is incorrect. Usually it is x2 greater.
It feels like it is calculated twice in this case. i.e. time based calculation happens every 10 sec (because sensor is updated every 15sec) and then usual calculation happens in 5sec when updated value for sensor arrives.
If it is expected behavior then probably doc should explicitly say that max_sub_interval should not be less that update interval of the sensor?

What version of Home Assistant Core has the issue?

2025.2.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions