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

Fix state class in Enphase Envoy #87397

Merged
merged 2 commits into from Feb 5, 2023

Conversation

vpathuis
Copy link
Contributor

@vpathuis vpathuis commented Feb 4, 2023

Proposed change

The Enphase Envoy integration uses TOTAL_INCREASING for several entities. I think these should be TOTAL.
Documentation says: "It's recommended to use state class total without last_reset whenever possible".

Also this log error appears for two of these entities, as issued in #85172:
Entity sensor.envoy_122131003872_last_seven_days_energy_consumption from integration enphase_envoy has state class total_increasing, but its state is not strictly increasing

Tested this locally and seems to work without a problem.

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.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Feb 4, 2023

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

Code owner commands

Code owners of enphase_envoy can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign enphase_envoy Removes the current integration label and assignees on the issue, add the integration domain after the command.

Copy link
Contributor

@epenet epenet left a comment

Choose a reason for hiding this comment

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

Are all of them causing an issue?
I would think maybe only Last Seven Days sensors need adjustment.

@epenet epenet changed the title Enphase Envoy: change total_increasing to total Fix statd class in Enphase Envoy Feb 4, 2023
@epenet epenet changed the title Fix statd class in Enphase Envoy Fix state class in Enphase Envoy Feb 4, 2023
@vpathuis
Copy link
Contributor Author

vpathuis commented Feb 4, 2023

Are all of them causing an issue? I would think maybe only Last Seven Days sensors need adjustment.

True.
Although I'd also fix the daily sensors. Although these sensors are not created in my instance, These would also have the same problem.
But it's only 6 lines, so why not fix them all.

@epenet
Copy link
Contributor

epenet commented Feb 4, 2023

Are all of them causing an issue? I would think maybe only Last Seven Days sensors need adjustment.

True. Although I'd also fix the daily sensors. Although these sensors are not created in my instance, These would also have the same problem. But it's only 6 lines, so why not fix them all.

If daily is "since midnight" the total_increasing is correct
If daily is "last 24hrs" then total is correct.

I would only correct the ones causing an issue.

@vpathuis
Copy link
Contributor Author

vpathuis commented Feb 4, 2023

If daily is "since midnight" the total_increasing is correct If daily is "last 24hrs" then total is correct.

I would only correct the ones causing an issue.

Good point. Let's make the other sensors something to address later if neccessary.

Copy link
Contributor

@epenet epenet left a comment

Choose a reason for hiding this comment

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

Lgtm 👍

@epenet epenet added this to the 2023.2.2 milestone Feb 4, 2023
@balloob balloob merged commit 65f660b into home-assistant:dev Feb 5, 2023
balloob pushed a commit that referenced this pull request Feb 5, 2023
* Change total_increasing to total

* As suggested in PR: only Last Seven Days TOTAL
@balloob balloob mentioned this pull request Feb 5, 2023
shbatm pushed a commit to shbatm/home-assistant-core that referenced this pull request Feb 5, 2023
* Change total_increasing to total

* As suggested in PR: only Last Seven Days TOTAL
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2023
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.

Enphase Envoy - 2 cumulative sensors are decreasing instead of increasing
3 participants