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 button platform to devolo Home Network #85834

Merged
merged 11 commits into from May 7, 2023

Conversation

Shutgun
Copy link
Contributor

@Shutgun Shutgun commented Jan 13, 2023

Proposed change

Add the button platform to the devolo Home Network integration. As the button platform does not require a coordinator, I introduced a basic non-coordinated entity and had to duplicate a few lines. If there is a better way, please let me know.

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 @2Fake, mind taking a look at this pull request as it has been labeled with an integration (devolo_home_network) you are listed as a code owner for? Thanks!

Code owner commands

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

Copy link
Member

@gjohansson-ST gjohansson-ST left a comment

Choose a reason for hiding this comment

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

Made suggestion

homeassistant/components/devolo_home_network/entity.py Outdated Show resolved Hide resolved
@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 February 12, 2023 21:29
@Shutgun Shutgun marked this pull request as ready for review February 13, 2023 10:44
Copy link
Member

@gjohansson-ST gjohansson-ST left a comment

Choose a reason for hiding this comment

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

Something more

@home-assistant home-assistant bot marked this pull request as draft March 25, 2023 05:15
@Shutgun Shutgun marked this pull request as ready for review March 26, 2023 21:33
Copy link
Contributor

@allenporter allenporter left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for making the changes.

except DevicePasswordProtected as ex:
self.entry.async_start_reauth(self.hass)
raise HomeAssistantError(
f"Device {self.entry.title} is password protected"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the right error message? Seems like it's something like auth is expired or invalidated and needs to be reauthenticated?

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 devolo devices are a bit nasty here. As a user, you don't have to set a password and if you do you can still get data without using the password. On top, there is no non-writing endpoint I could check. So the first time Home Assistent notices a protected device is a failing action.

That's why chose this message.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh interesting. Let me see if I understand correctly, the flow is:

  • set up the device in the config flow (either zero conf or user enters ip address). no password is set
  • users presses button and the command fails, and starts reauth
  • user enters password for the first time via the "reauth" flow

What exception is thrown if the password is incorrect? I'm assuming it's the same exception so maybe something like this:

f"Device {self.entry.title} requires password or needs re-authenticatication"

Copy link
Member

Choose a reason for hiding this comment

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

I think this topic remains to be set.
I could also see a message something like f"Device {self.entry.title} require re-authenticatication to set or change the password"

Copy link
Contributor

@allenporter allenporter left a comment

Choose a reason for hiding this comment

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

Looks good to me, i had one minor suggestion w.r.t. the error message but otherwise looks good, thanks

@Shutgun
Copy link
Contributor Author

Shutgun commented May 6, 2023

Hi @allenporter , @gjohansson-ST , I updated this MR to adapt to the recent development (#90471 and #80126). Could we finish this?

@gjohansson-ST
Copy link
Member

Hi @allenporter , @gjohansson-ST , I updated this MR to adapt to the recent development (#90471 and #80126). Could we finish this?

I think only the error message to the user remains as I also just commented. Setting this to draft until updated.

@gjohansson-ST gjohansson-ST marked this pull request as draft May 7, 2023 08:42
@Shutgun Shutgun marked this pull request as ready for review May 7, 2023 12:18
@Shutgun
Copy link
Contributor Author

Shutgun commented May 7, 2023

I updated the message, @gjohansson-ST . Originally I thought that it was a recommendation, so I didn't change it right away. Now everything should be set.

@gjohansson-ST gjohansson-ST merged commit f165a41 into home-assistant:dev May 7, 2023
24 checks passed
@Shutgun Shutgun deleted the hn_button branch May 7, 2023 13:21
@github-actions github-actions bot locked and limited conversation to collaborators May 8, 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.

None yet

3 participants