Enable Trust#172
Conversation
|
FYI I'm testing the code in a dev container, still waiting for the extra log entry (where the issue used to be) to pop up. |
|
Tested it, for a while now. Unfortunately it does not seem to work. Although I got a better error log at least: And I need to log in again in HA. |
|
Sadly, not the result I was hoping for, but it does give use useful information. |
|
Currently we send all cookies on every request, assuming that the server would only read the ones that it needs. I'm not sure if leaving out unnecessary cookies will help, but it might be worth a shot. |
revert commit 7428917
Attempt loging with trust cookie (if any) and username/password
|
@Olen Can you update your dev env and retest please, I'll do the same but haven't seen the issue in my dev env so far. |
Improve code quality
|
I wonder why we don't see the 'reauth' issue anymore. Is it because we're handling the 500 responses differently (since 2023.08) or did something change with the Verisure API. If it's the former, why did @Olen still see the issue after 2023.08? If it's the later, ... we might be trying to fix something that isn't broken. I truly doubt adding 'trust' will change anything. As far as I can see, the only reason to get the trust cookie is to re-authenticate without user interaction (entering the MFA code), i.e. when the session-, refresh- or vid cookie expires or is lost, like when you update the app for example. Love to hear your thoughts on the matter. |
|
The changes have been tested extensivly and without any error. @Olen was finally able to reproduce the 'reauth' issue and recovered: home-assistant/core#97885 (comment) @persandstrom please review these changes |
|
I can verify that my installation has now been running for more than 48 hours without requiring reconfiguration. That has not happened for a long time, so it seems like this is working. I have seen two "Cookie expired"- messages about 25 hours apart since then: If it still is running fine tomorrow, I will do a test where I will change the password, just to verify that this is detected by HA and that I will be asked to supply the new password in the GUI. |
|
Looks good! Let's wait for @Olen final test |
|
Sorry. Forgot to add the result here as well. It ran fine for four days and recovered from all errors Verisure decided to throw at me. So all seems fine now. Thanks for the effort. |
Please review and test these changes.
Changes
_stepupvariable as it was not being used anywherevalidate_mfamethod and update cookies accordinglylogin_cookiemethod to attempt login with the trust cookielogoutmethod to remove trust between server and the local instance