Skip to content

Remove STATE_CLASS_TOTAL and last_reset from sensor#54755

Merged
emontnemery merged 14 commits intohome-assistant:devfrom
emontnemery:kill_state_class_total
Aug 18, 2021
Merged

Remove STATE_CLASS_TOTAL and last_reset from sensor#54755
emontnemery merged 14 commits intohome-assistant:devfrom
emontnemery:kill_state_class_total

Conversation

@emontnemery
Copy link
Copy Markdown
Contributor

@emontnemery emontnemery commented Aug 17, 2021

Proposed change

Simplify sensor:

  • Remove STATE_CLASS_TOTAL
  • Remove the last_reset attribute from sensor

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@Danielhiversen
Copy link
Copy Markdown
Member

Regarding Mill:
The values are reset to 0, but the first value we receive might not be 0 (It is not updated that often)
Will it still be correct to use STATE_CLASS_TOTAL_INCREASING ? Is it always assumed that the value is reset to 0?

@frenck
Copy link
Copy Markdown
Member

frenck commented Aug 17, 2021

@Danielhiversen That is solved by #54751

@Danielhiversen
Copy link
Copy Markdown
Member

Ahh, then the changes to the Mill integration looks good 👍

@fsaris
Copy link
Copy Markdown

fsaris commented Aug 17, 2021

Okay with #54523 this was added and there was also some reasoning added to the PR about the idea behind it.

Now one of the new state classes is removed. I think this is because total is equal to measurement and obsolete.

But can not follow it fully. Where are such changes discussed and documented? Searched PR messages here, the discussion's on the architecture repo and discord. Try to understand and follow the changes (my way of getting into HA development and see where I can contribute 😄 )

@emontnemery emontnemery changed the title Remove STATE_CLASS_TOTAL Remove STATE_CLASS_TOTAL and last_reset from sensor Aug 17, 2021
@emontnemery emontnemery force-pushed the kill_state_class_total branch 2 times, most recently from f8c5d3f to fa82039 Compare August 17, 2021 19:12
@emontnemery
Copy link
Copy Markdown
Contributor Author

@fsaris the blog post introducing #54523 has been updated as well

Comment on lines +188 to +189
"Assistant Core 2021.11. Please update your configuration if "
"state_class is manually configured, otherwise %s",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Assistant Core 2021.11. Please update your configuration if "
"state_class is manually configured, otherwise %s",
"Assistant Core 2021.11. Please update your configuration and set state class to 'total_increasing' if "
"state_class is manually configured, otherwise %s",

@emontnemery emontnemery force-pushed the kill_state_class_total branch from 9bcb45f to e3b6007 Compare August 17, 2021 21:09
@balloob balloob mentioned this pull request Aug 18, 2021
21 tasks
@emontnemery emontnemery merged commit e1926ca into home-assistant:dev Aug 18, 2021
This was referenced Aug 18, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants