Closed Sesshoumaru-sama closed 5 months ago
Hey there @dgomes, mind taking a look at this issue as it has been labeled with an integration (integration
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
integration documentation integration source (message by IssueLinks)
Sounds like you probably have the wrong integration method:
https://www.home-assistant.io/integrations/integration/#method
It should be set to left
. The default will give incorrect values for sparsely updated sensors. From your graph I'm guessing it's trapezoidal.
I see no way to change the method and even no statement of which method is being used. Is there a magic trick to change this configuration? (It should be left, but as I said I can't see it anywhere)
Still: Something be that wrong must be avoidable. Thats a million percent error.
The only way I know to check is to look in your .storage
folder, I think it is in core.config_entries.
e,g.:
{
"entry_id": "bfca90a5d96433682d2df6b9889d93fa",
"version": 1,
"domain": "integration",
"title": "test",
"data": {},
"options": {
"name": "test",
"source": "sensor.tr951_temperature",
"method": "trapezoidal",
"round": 2.0,
"unit_prefix": "none",
"unit_time": "h"
},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"unique_id": null,
"disabled_by": null
},
Unfortunately AFAIK it's not changeable or even viewable in the frontend, it's only set when you create it.
I will check. Would it be a feature request with with good prospects to ask to have the integration method configurable? The error is so big that something has to be done.
I am sure I selected "left", but the config entry actually said "trapezoidal". I changed it in the config now, restarted and will watch. Thanks for the input.
You have more control if you use yaml instead of the helper. In my sensor.yaml I have an entry like this:
I have noticed that after a change a restart of HA core is necessary.
I can confirm this bug:
If I check last sensor values I guess that the integration is calculating between the actual and the last value. If the sensor was updated long ago, the calculation is using a too long period of time to calculate the update value.
This helper seems to have a lot of issues. As a user of this I shouldn't really be expected to make a good choice about what configuration options fit and then be burnt when they don't work out. This is the job of the integration. What if I have a sensor that sometimes changes all the time and then for a lot of the day never does?
At the moment, in a lot of my use cases, this helper is pretty much garbage.
Could you run the left and trapezoid algorithms at the same time and use the most sensible result that given the number of updates that have happened in a second?
You can now change the integration method https://github.com/home-assistant/core/pull/116740
The problem
Hi
I am reading the current active power from a Varta Element 6 via Modbus. Positive and negative values are split into charge and discharge sensors. These sensors (W) are then input to the Riemann Sum Utility to track the energy (kwh). In arbitrary intervals, maybe once a week or so, the energy calculated by the Riemann Integration is vastly deviating from the actual value (see below)
A very short small pike of 700W suddenly causes a jump of 28 kwh in the energy.
What version of Home Assistant Core has the issue?
core-2023.12.2
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
Riemann Sum Integration
Link to integration documentation on our website
https://www.home-assistant.io/integrations/integration/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response