Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total -> Total Increasing #145

Merged
merged 1 commit into from
Nov 24, 2024
Merged

Conversation

tleegaard
Copy link
Contributor

As I understand the documentation at https://developers.home-assistant.io/blog/2021/08/16/state_class_total/ and https://developers.home-assistant.io/docs/core/entity/sensor/#available-state-classes these sensors should be TOTAL_INCREASING as they're decreasing at the end of the session.

As I understand the documentation at https://developers.home-assistant.io/blog/2021/08/16/state_class_total/ and https://developers.home-assistant.io/docs/core/entity/sensor/#available-state-classes these sensors should be TOTAL_INCREASING as they're decreasing at the end of the session.
@sveinse
Copy link
Collaborator

sveinse commented Nov 24, 2024

There were an update to the blog here: https://developers.home-assistant.io/blog/2021/09/20/state_class_total/ that states that TOTAL is intended for values that can both increase and decrease, while TOTAL_INCREASING is for sensors that monotonically increase. I know there were some confusion about this a while back, but I think TOTAL is the right choice here, since the two sensors in this PR jumps up and down based on the current session.

Is there a specific reason why you make this proposal? Is there something that affects your usage of Zaptec by having TOTAL here? I knew we had some issues with integrating with the Energy view in HA, but according to the docs https://next.home-assistant.io/docs/energy/faq/#troubleshooting-missing-entities having either TOTAL or TOTAL_INCREASING should work.

@tleegaard
Copy link
Contributor Author

tleegaard commented Nov 24, 2024

My specific reason is that due to the state_class being 'total', the sum is getting negative values, as described at the blog you're linking: https://developers.home-assistant.io/blog/2021/09/20/state_class_total/
I believe the increase and decrease mentioned for 'total' is an example of an energy meter with e.g. solar production.

When using the sensor as individual device in the energy dashboard, the values increase while charging and decrease when the car is unplugged:
image
As I understand the 'total_increasing' state_class, that would fix the problem 😊

From the blog:
image
image

@sveinse
Copy link
Collaborator

sveinse commented Nov 24, 2024

Yes, looking closer at the same document I linked to and inspecting the HA code, I agree and support the fix. ...HA haven't exactly been very clear about this in the past. Let's hope we can finally settle it

@sveinse sveinse merged commit 5c12b2b into custom-components:master Nov 24, 2024
1 check passed
@tleegaard tleegaard deleted the patch-1 branch November 24, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants