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
73.78k stars 30.88k forks source link

Statistics sensor with too little data causes invalid repair notice about missing unit in beta 2024.10.0b6 #127143

Open EDelsman opened 1 month ago

EDelsman commented 1 month ago

The problem

The source sensor for a statistics sensor has unit W. However, as it is solar production, at night there's no data in the time window. This causes the statistics sensor to have no unit, which in turn results in a repair notice after each reboot at night.

What version of Home Assistant Core has the issue?

2024.10.0b6

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

statistics

Link to integration documentation on our website

https://www.home-assistant.io/integrations/statistics/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

The screenshot of the statistics sensor and the source sensor showing the graph and the attribute: IMG_0892 IMG_0891

home-assistant[bot] commented 1 month ago

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

Code owner commands Code owners of `statistics` 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 statistics` 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)


statistics documentation statistics source (message by IssueLinks)

emontnemery commented 1 month ago

@EDelsman I think the screenshots show the state of the statistics sensor? Can you also share screenshots which show the state of the input sensor?

EDelsman commented 1 month ago

They are both there: the top is the original with W, the below is the stats without.

gjohansson-ST commented 1 month ago

I found the issue which is that it's only calculating the attributes after the first change from the source sensor. So with no update from your solar panels = no adding of the unit. There is a PR coming but not entirely sure we would bring that into this release.

EDelsman commented 1 month ago

Not bringing it in the release is fine by me, and I understand the reasoning behind it. But sensors staying without updates because they do not change is frequent in HA. So I expect a lot of people will be having these new repair messages and come with questions when it is released today.

gjohansson-ST commented 1 month ago

There has been made a PR to not raise for these events. So the repairs will not be seen for people upgrading after release. I was more expressing in the underlying issue which will not be addressed during this release.