home-assistant / home-assistant.io

:blue_book: Home Assistant User documentation
https://www.home-assistant.io
Other
4.9k stars 7.26k forks source link

Ability to change units of created Statistics helpers. #34371

Closed Kagey-cmd closed 1 week ago

Kagey-cmd commented 2 months ago

Feedback

My use case: I've created a "Total" Statistics helper that gives me total precipitation over the previous 24 hours using hourly precipitation data from a weather integration. My issue: The resulting sum should have units [in.], not [in./hr], but I don't think there's a way to change that. I think this should be an option in the Statistics options UI.

URL

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

Version

2024.8.2

Additional information

No response

home-assistant[bot] commented 2 months ago

Hey there @thomdietrich, mind taking a look at this feedback 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 feedback. - `@home-assistant rename Awesome new title` Renames the feedback. - `@home-assistant reopen` Reopen the feedback. - `@home-assistant unassign statistics` Removes the current integration label and assignees on the feedback, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information) to the feedback. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information) on the feedback.
ThomDietrich commented 2 months ago

Hello @Kagey-cmd, I agree and this ability to freely overwrite the unit should be added. It is on my personal todo list of new additions to the component but I won't realistically attend to this soon. Contributions are always welcome!

In the meantime I suggest to add a template sensor "in front" of the statistics sensor.

That said, could you please re-check your issue? The "total" characteristic does not alter the unit_of_measurement taken from the source sensor. See: https://github.com/home-assistant/core/blob/0f90a3cf606e2665d9576b97f8709cb7e9d803c1/homeassistant/components/statistics/sensor.py#L156 Edit: Now I get it. Your hourly source sensor is in "in/hr", therefore, that unit is carried over. Got you. This is a good example for why this PR would make sense. Teaser: The correct unit would be "in/day" :-P

github-actions[bot] commented 1 week ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved. If this issue is still relevant, please let us know by leaving a comment 👍 This issue has now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

frenck commented 1 week ago

Thank you for reaching out. We use GitHub for tracking issues, not for providing support or tracking feature requests.

If you want to suggest a feature, you should try our Community Forum: Feature Requests.

If you have additional questions, feel free to join our Discord chat server.

Thanks! 👍