home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.82k stars 30.08k forks source link

Derivative sensor stuck (when it should become 0) #126414

Open kugel- opened 1 week ago

kugel- commented 1 week ago

The problem

Hello, I have a pesky issues with a derivative helper sensor. Sometimes it becomes stuck at non-zero values for multiple hours, even tough if the underlying sensor does not increase any more. This is very irretating as we don't actually drain power from the grid but the derivative sensor keeps saying we drain lots of power from the grid.

See in the screen shot, the derivative sensor reports 358W all the way since 7:02 (and currently still does, both screenshots are made at ~8:15). grafik

The source for the derivate sensor is a smart meter sensor (from the EDL21 integration). It reads data from an IR sensor attached to the smart meter and the smart meter is pushing data every second. This sensor stopped increasing exactly at 7:02 as well: grafik

It stopped increasing because we really don't drain power from the grid anymore, everything is handled by the PV modules and battery.

So I'm not actually sure if root cause is with the derivative sensor or with the smart meter sensor. However, I am fairly sure that I didn't experience this problem in core-2024.08.x and earlier. I began observing this immediately after updating to core-2024.09.1 and it still happening.

If you need more info, please let me now.

What version of Home Assistant Core has the issue?

core-2024.9.2

What was the last working version of Home Assistant Core?

core-2024.8.x

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

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

kugel- commented 1 week ago

FWIW, I tried a hack in the edl21 integration to push new values to HA every second (i.e. removed the rate limit here https://github.com/home-assistant/core/blob/dev/homeassistant/components/edl21/sensor.py#L420 ) and while I could clearly see that the smart meter sensors now update very frequently, the derivative sensor was unimpressed. It's still stuck at 358W.

So I guess this indicates that the derivative sensor is really the problem, isn't it?

kugel- commented 1 week ago

@emontnemery @dougiteixeira I saw you worked on the derivative sensors recently. Can you please look into this?

home-assistant[bot] commented 17 hours ago

Hey there @afaucogney, mind taking a look at this issue as it has been labeled with an integration (derivative) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `derivative` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign derivative` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


derivative documentation derivative source (message by IssueLinks)