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

Re-add missing Growatt TLX values #84040

Merged
merged 4 commits into from Dec 16, 2022

Conversation

muppet3000
Copy link
Contributor

@muppet3000 muppet3000 commented Dec 15, 2022

Proposed change

  • Re-adds missing values for the Growatt TLX types that were being registered through a different route.
    This implements the majority of the missing statistics to solve 90% of the ticket and get people working again.
    In the future the remaining 10% will be added as this is dependent on an upstream library change which will take longer to implement.
  • Fixes parts of Growatt integration missing but basic entities #81470 - there will be more work in the future.

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

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

Code owner commands

Code owners of growatt_server 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 growatt_server Removes the current integration label and assignees on the issue, add the integration domain after the command.

@muppet3000
Copy link
Contributor Author

muppet3000 commented Dec 15, 2022

I'm a bit confused about the failing coverage report, is this a new feature that has been added to PRs? I'm not sure how I'm supposed to add tests for the comment that I added ......

Also, this integration does not yet have tests written for the core sensor or the sensor types. Is it possible to get this approved and merged without the tests in the interests of re-instating the missing functionality and I can then follow up with a new PR to add test coverage to the rest of the integration in a separate PR?

@muppet3000
Copy link
Contributor Author

Answered my own question, turns out there were a load of files missing from coveragerc, I plan to add the test cases in the future but for now the files have been excluded from the coverage checks.

@MartinHjelmare MartinHjelmare changed the title Growatt - Re-adding missing TLX values (#81470) Re-add missing Growatt TLX values Dec 16, 2022
@MartinHjelmare
Copy link
Member

If you don't want to close an issue, take care what verbs you write before the issue link in the PR description. GitHub will automatically close issues that are prefixed with fixes, closes, and similar verbs in a PR description. I updated the PR description to remove the auto close connection for the issue.

homeassistant/components/growatt_server/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/growatt_server/sensor.py Outdated Show resolved Hide resolved
# - will return 0 until a non-zero value is registered
# 2 - System has been running fine but temporarily resets to 0 briefly at midnight:
# - will return the previous value
# 3 - HA is restarted during the midnight 'outage' - Not handled:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe solve 3 by inheriting from RestoreSensor and restoring the last state when creating the entity?

class RestoreSensor(SensorEntity, RestoreEntity):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion I'll look into how I can do this - I was wondering if there's a nice way of getting the previous value of an existing sensor, clearly there is!!

If it's ok with you, I'll look to implement this in a future PR rather than this one as I'd like to get this one merged as-is.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. 👍

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

@MartinHjelmare MartinHjelmare added this to the 2022.12.7 milestone Dec 16, 2022
@MartinHjelmare MartinHjelmare merged commit 186e3a6 into home-assistant:dev Dec 16, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2022
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.

None yet

3 participants