-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Remove auth token from device when removing HomeWizard entry #138596
base: dev
Are you sure you want to change the base?
Conversation
) | ||
|
||
# Ignore any error, because device may be unreachable | ||
with suppress(Exception): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense here to treat all exceptions the same (if the answer is "yes" also fine). I was just thinking, if the device is reachable but we still cannot remove it if we should take action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this described in the PR description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I wasn’t sure if we shouldn’t consider some/retry if makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this is just some cleanup which is not really required. It is fine if it fails, because the user can factory reset the device to clear all tokens if they get into issues.
I think this is just a bit better than doing nothing, any other solution with error handling will just cause issues and confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine by me, but I'd prefer catching and logging a warning then, to give the user a chance to notice something went wrong and is left over in the device (together with "you can factory reset to get rid of it")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be nice indeed 👍
Proposed change
When the user removes a HomeWizard entry, try to clean up the authentication token on the device.
This is just a good practise and does not handle any error, like a device not available or a an invalid token.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: