-
Notifications
You must be signed in to change notification settings - Fork 29
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
Adds OAuth (Bosch SingleKey ID support) #173
Conversation
sander1988
commented
Mar 14, 2023
- Adds OAuth (Bosch SingleKey ID support) New Single-Key Authentification #171
- Moved configuration move YAML to GUI.
- Multiple mower are supported ; but the integration should be added multiple times (it checks for a unique mower serial).
- Expose a mower a device in HA linked to it's entities (instead of only separate entities).
- Several other fixes.
- Updated README.
Implemented init using HA config entries. Added config flow + account credential validation. Added support for integration reload. Some restructuring to allow multiple instances of the Indego integration within HA (using different Bosch Indego account).
Fixed reload of the integration. Added support for multiple mowers in HA indego service calls.
WIP: Config flow.
…elaying the next update. Improved code style and comments.
Updated readme. Fixed error in sensor.
Hello, |
It works! Great work. |
I have created a new branch for the Bosch Single Key authentication code. I really appreciate that you have made a new pull request to the new branch. In that way I can commit the code there and test the code. Then merge the (hopefully) working code with the main branch. |
…y the next request)
Another thing: before merging into master, someone have to clean the code and figure out the dependencies. As you have written the code now you have added another dependency to your own github repo. In my opinion the dependencies that this integration should have is pyIndego where we have coded all the logic to set up a session and comunicate with the bosch servers. |
Yes that's fine. Note that your message crossed a commit I just did. I did some small changes in the pyIndego library and this HA component to detect certain scenarios where the Bosch servers are down. In that case we delay the next update a bit to prevent loops. Let first test this version 1 or 2 weeks as I just made this change. |
Yes I will change the library repo URL back as soon as pyIndego has been merged. Anything else? |
No, just keep up the good work!!! :-) |
This is gonna take a bit longer unfortunately. My own mower is broken atm and back to Bosch for repairs :-(. I will continue testing when he's back from repairs. |
Any chance we can get access to the branch via HACS? Just makes it easier to try out and switch versions. Thanks for the great work! |
I tested it for a while now, everything is working as expected. After upgrading to HASS 2023.4.3 the intregration stopped working with this error log:
Upgrading to 2023.4.4 same result. I'll check if the next release also deletes the token or not. |
@Pr0mises - Are you really sure it started after the upgrade? Did you restart HA before just before upgrade without getting this error? I see the same error on some of my HA instances. But I have not upgraded. I think it's an issue with the token refresh based on the stack and error. |
@sander1988 no I didn't restart hass just before the upgrade, it has nothing to do with this push but how hass refreshes the token.
That's what I'm thinking as well. It's no issue at all just wanted to inform you. As you had the same error it's worth mentioning in the readme as an hint, so no new Issue are opened for this behavior as it's known. |
Ok. I see the 400 Bad Request. I will add some more debug output to the logs to see if the refresh is really happening and monitor it for the next few days. FYI: I'm referring to this error:
|
I think I see the why... I have not seen this before (to me it looks like a misconfiguration of the OAuth server): Both the refresh and access token use the same expiry of 1 day (expires_in). HA refreshes around 20 seconds (https://github.com/home-assistant/core/blob/dev/homeassistant/helpers/config_entry_oauth2_flow.py#L42) before expiring. So there is a small window for the (daily) refresh to succeed otherwise you will run into this 400 Bad Request error. I will try to figure out a way to mark the access token as expired a few hours earlier as a workaround for this issue. |
That would explain why I'm stuck at the start screen of indego connect every now and then. After restart the app I've to login again. |
Yes exactly, I have the same issue with their iOS app. I think I have workaround for this HA integration... a way to force refresh it every 12 hours. That works fine in this case as long as HomeAssistant isn't offline for more than 12 hours. If you are offline for longer than 12 hours then the user has to readd the integration. I expect that won't happen for most the users. This is the best I can do here as it's a workaround, the real fix has to be implemented by Bosch on their server side. I hope they do, as it also affects their apps. Have running this workaround in test now. I expect to update the repo within a few days. |
That's awesome, if you need more testing you could upload your fix into another branch so I can check it out. |
Will you please commit to the dev branch instead? I have asked you this before. |
I have changed it. Note that I was under the assumption you can change this as I left allow edits from maintainers enabled. Maybe I'm wrong here, I use GitLab for 99% of my projects. |
Please give me a few more days to fix 2 issues:
|
I already pulled your latest commits and encountered the same issues. If you need any help let me know. |
That's not possible ;-) ... my latest commit is from 3 weeks ago so it doesn't contain the 400 Bad request workaround. But I expect to push something today. |
Fix for error on delayed state update.
I have pushed version 5.0.2 ; this update should fix both issues. All known issues are fixed now. In case you are testing... Please temporary add these logging configuration lines to your HA config:
It helps debugging in case we run into another API related error. Let's monitor the cloud connection for another week. |
I got everything up and running - and the integration works again... Thanks!!! |
I installed this last version, and it works flawlessly |