Skip to content

Remove state class from daily net sensors in DSMR Reader#75864

Merged
MartinHjelmare merged 1 commit into
devfrom
frenck-2022-1556
Jul 28, 2022
Merged

Remove state class from daily net sensors in DSMR Reader#75864
MartinHjelmare merged 1 commit into
devfrom
frenck-2022-1556

Conversation

@frenck
Copy link
Copy Markdown
Member

@frenck frenck commented Jul 28, 2022

Proposed change

This PR fixes entities tracking a net total (and not an increasing total) in the DSMR Reader integration. Fixes warnings like:

integration dsmr_reader has state class total_increasing, but its state is not strictly increasing

Causing these not to work with statistics.

Technically, it should be possible to convert these into a total state class with a last_reset; however, these have no value to keep, as this integration already provides sensors with the increasing totals.

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)
  • Deprecation (breaking change to happen in the future)
  • 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.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • 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:

@probot-home-assistant
Copy link
Copy Markdown

Hey there @depl0y, mind taking a look at this pull request as it has been labeled with an integration (dsmr_reader) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@frenck frenck added this to the 2022.8.0 milestone Jul 28, 2022
@MartinHjelmare MartinHjelmare merged commit 1012064 into dev Jul 28, 2022
@MartinHjelmare MartinHjelmare deleted the frenck-2022-1556 branch July 28, 2022 16:13
@Glodenox
Copy link
Copy Markdown
Contributor

The pull request doesn't fully fix the issue. I just ran the updated code locally for a bit and got this error for another entity:
[homeassistant.components.sensor.recorder] Entity sensor.dsmr_reading_electricity_delivered_2 from integration dsmr_reader has state class total_increasing, but its state is not strictly increasing. Triggered by state 15973.350 (15973.351) with last_updated set to 2022-07-28T21:50:39.862644+00:00.. There are also two entities for gas meter values that probably could do without the state class for the same reason.

I had code waiting locally that would prevent the sensor from using data if it was only a tiny bit smaller than the previous value, so the total_increasing class could remain. Just removing the state class seems to not have any negative effect on the visualisation of the data, so I guess that's even better.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DSMR reader sensor has state class total_increasing, but its state is not strictly increasing

4 participants