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

Add support for whole apsystems ez1 series #123356

Merged

Conversation

mawoka-myblock
Copy link
Contributor

@mawoka-myblock mawoka-myblock commented Aug 8, 2024

Proposed change

As there are more inverters of the ez1 series by apsystems with each having another max output, this PR queries the inverter on first setup and saves the max output which is then reused for the number entity. This PR depends on #123225 and would resolve #122979

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. (TODO)
  • Local tests pass. Your PR cannot be merged unless tests pass (TODO)
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works. (TODO)

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.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Aug 8, 2024

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

Code owner commands

Code owners of apsystems can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign apsystems Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

…put at setup to match the value by the inverter
@mawoka-myblock mawoka-myblock marked this pull request as ready for review August 19, 2024 14:22
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft August 19, 2024 14:23
@mawoka-myblock mawoka-myblock marked this pull request as ready for review August 19, 2024 14:36
@home-assistant home-assistant bot requested a review from joostlek August 19, 2024 14:36
@joostlek
Copy link
Member

We do have a coordinator right? You can move this to _async_setup a new lifecycle function for the coordinator

@mawoka-myblock
Copy link
Contributor Author

Okay, so I've now moved it into the coordinator

Comment on lines 38 to 39
max_power = (await self.api.get_device_info()).maxPower
self.api.max_power = max_power
Copy link
Member

Choose a reason for hiding this comment

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

Why do we store this in self.api? Shouldn't we store this at the coordinator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the api needs this as well, as it checks against that as well and why storing it in the api and the coordinator when the api needs it regardless of the coordinator?

Copy link
Member

Choose a reason for hiding this comment

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

It sounds strange that the API requires it tbh, why do we receive the value to set it afterwards, why don't we call a function for the api to just set it themselves.

Also, can this raise? We should raise UpdateFailed in that case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is that the API shouldn't run any IO in the init function so that it can be initialized when the inverter is offline

@joostlek joostlek merged commit e3ab30a into home-assistant:dev Aug 19, 2024
22 checks passed
@mawoka-myblock
Copy link
Contributor Author

Thanks!

@mawoka-myblock mawoka-myblock deleted the apsystems-dynamic-max-power branch August 19, 2024 14:58
@github-actions github-actions bot locked and limited conversation to collaborators Aug 20, 2024
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.

Integration:APsystems - the output limit setting needs to be extended from max 800Watts to at least 1800Watts
2 participants