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

Fixing State class and device class missmatch #288 #309

Merged
merged 2 commits into from
May 22, 2023

Conversation

frli4797
Copy link

Fixing #288 by simply setting state class to SensorStateClass.TOTAL.

@Hellowlol Hellowlol merged commit 609b9dd into custom-components:master May 22, 2023
@kandsten
Copy link

I'd argue that this is in fact the wrong fix; what the integration is providing isn't a Total, it's a Measurement. It's a bit annoying that HA makes a strong assumption that device_class Monetary == always a Total value (i.e running tab), but it seems to me that it'd make more sense to drop the device_class altogether, keep state_class measurement and voilà, hourly prices get stored to LTS, warning goes away. Presenting it as total will also store the data to LTS, but it'll be junk.

I may be missing something really obvious here, of course, not having looked excessively at the code base.

@Hellowlol
Copy link
Collaborator

I dont use this feature so i havnt looked into it. Please send a pr if you think you have a better solution

@kandsten
Copy link

Roger wilco. May be a day or three, but I'll see about testing it properly and sending a PR once done.

@StSaens
Copy link

StSaens commented Dec 16, 2023

Came here after the recent changes in HA wrt long term statistics.
State class total is wrong for nordpool (https://developers.home-assistant.io/blog/2021/05/25/sensor_attributes?_highlight=state_class#state_class)

State_class should be measurement (given the options) and maybe device_class should be removed (to allow for state_class=measurement to be allowed)

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.

4 participants