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

Abode integration needs to re-auth after every HA restart #88334

Open
nathang21 opened this issue Feb 17, 2023 · 50 comments
Open

Abode integration needs to re-auth after every HA restart #88334

nathang21 opened this issue Feb 17, 2023 · 50 comments

Comments

@nathang21
Copy link

The problem

Every time I restart HA for any reason, the Abode integration fails to start up, and shows that it needs to be re-authenticated on the Integration page.

Upon logging in, and entered my 2FA code, everything starts working again, and remains stable (until the next restart).

What version of Home Assistant Core has the issue?

2023.2.5

What was the last working version of Home Assistant Core?

2023.1.7

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Abode

Link to integration documentation on our website

https://www.home-assistant.io/integrations/abode/

Diagnostics information

home-assistant_abode_2023-02-17T14-42-12.427Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: config_entries.py:406
First occurred: 09:35:38 (1 occurrences)
Last logged: 09:35:38

Config entry 'nathanpguenther@gmail.com' for abode integration could not authenticate: Invalid credentials: Multifactor authentication code required for login.

Additional information

No response

@home-assistant
Copy link

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

Code owner commands

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

(message by CodeOwnersMention)


abode documentation
abode source
(message by IssueLinks)

@zim514
Copy link
Contributor

zim514 commented Feb 19, 2023

This only occurs for me when a new version of Abode is installed, but the log entry is the same.

The python lib that's used creates a file called abodepy_cache.pickle that contains the credentials and it continues to exist.

cc: @tradel Who I think discussed this issue in another ticket I can't find.

@nathang21
Copy link
Author

nathang21 commented Feb 20, 2023

By chance are you talking about #86765, I originally thought that was my issue, but then opened this?

Edit: Also I just restarted, and didn't need to re-auth this time, so perhaps it's not every time, but still more frequently than expected. I will update here if I can find any sort of pattern worth mentioning.

@asjimene
Copy link

I've noticed it is every time I Home Assistant updates, not every reboot.

@fwedler
Copy link

fwedler commented Mar 2, 2023

I am also seeing it with every Home Assistant update.

@tradel
Copy link
Contributor

tradel commented Mar 2, 2023 via email

@guitarflipper
Copy link

Adding me to the list of those affected. For clarification, in my case, I use 2FA on my goabode account and I use the Yubico Authenticator which requires using a Yubico hardware key.

The HA log entry states: "Config entry 'Abode' for abode integration could not authenticate: Invalid credentials: Multifactor authentication code required for login." - It makes sense. Abode does not supply an API key for integration so the HA integration is completely dependent upon your username/password and in my case a 2FA six digit PIN. I'm guessing that if I turned off 2FA (which is a really bad idea) I wouldn't experience this problem. What puzzles me is that I've had 2FA turned on for a long time but, it wasn't until just that last few months that this problem reared it's ugly head.

@fwedler
Copy link

fwedler commented Apr 18, 2023

@tradel Congrats on the nuptials! If we can drag drag you away from the marital bliss for a few minutes, any chance you have an update on this one? Most appreciated!

@optiz0r
Copy link

optiz0r commented Apr 24, 2023

As an additional datapoint, I find I don't need to reauthenticate if I restart home-assistant using the restart button in developer tools, but I do if the home-assistant docker container itself is restarted. The pickle file exists in the configuration directory which is bind-mounted into the container. I see the same Invalid credentials: Multifactor authentication code required for login error message. I have also had 2FA enabled on the abode account for well over a year, but have only noticed the integration failing to authenticate on full restart over the last couple of months. I'm almost certain the authenticated session used to survive across home-assistant container restarts previously.

@derekcroft
Copy link

derekcroft commented May 3, 2023

Is there any update on this? I'm having the issue on every restart too. Also, congrats!

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@fwedler
Copy link

fwedler commented Aug 1, 2023

This issue has occurred after every update to Home Assitant and still appears after installing the latest update (2023.7.3) but did not occur after a subsequent restart.

@github-actions github-actions bot removed the stale label Aug 1, 2023
@guitarflipper
Copy link

I had to re-auth after the 2023.7.3 update. I rebooted HA and did not have an issue (2023.7.3)

@grainsoflight
Copy link

Contributing my experience, never noticed it on reboot, but needs reauthentication on every update. Minor inconvenience, but would prefer to not have to reauthenticate so often.

@wtadler
Copy link

wtadler commented Aug 4, 2023

I too have to reauthenticate after each update, but not after reboots.

@tradel
Copy link
Contributor

tradel commented Aug 4, 2023 via email

@zim514
Copy link
Contributor

zim514 commented Aug 5, 2023

@tradel Pretty sure that's what it is. It's being stored in : /root/.local/share/Abode/cookies.json in my HassOS setup. In addition it looks like this location isn't grabbed as part of the built-in back up system, so restoring from backup probably causes this bug as well.

I had to use the information here to find it, and this addon made it easier.

jaraco.abode uses the python lib platformdirs to decide on this location, so I suspect it may store it in different places based on OS / installation method.

It probably needs to be stored in a HA configentry instead to make sure it's saved reliably. I haven't been able to figure out how to do this. The jaraco.abode lib changed quite a bit and all the constants the integration relies on were moved, but it was more complex than I could figure out.

@tradel
Copy link
Contributor

tradel commented Aug 5, 2023 via email

@optiz0r
Copy link

optiz0r commented Aug 6, 2023

Thanks for investigating this, I've had the same issue every time my docker container restarts (but not when home-assistant is restarted using the developer tools, where the container itself is not restarted). If anyone else using containers has the same issue, adding a host volume mount to /root/.local/share to persist the token across restarts will workaround it in the interim.

docker run ... --volume /path/to/hass/root-share:/root/.local/share ...

@danielbcook
Copy link

Is there any update on this? I'm having the issue on every restart too. Also, congrats!

Excuse my noobie-ness but how does one go about reauthenticating after a restart? There is no explicit command for that. I've tried to Reload the integration, and tried to Reinstall it. The latter didn't work because I'm allowed only one instance of the integration at a time.

@wtadler
Copy link

wtadler commented Aug 8, 2023

@danielbcook, If you go to Settings>Integrations, the Abode integration should have a big "reconfigure" button. Click that, and re-enter your username and password.

@danielbcook
Copy link

danielbcook commented Aug 8, 2023

Hmm. I can go to Settings, where I then see "Devices & Services" and a subheading under that says "Integrations, devices, entities and helpers". When I drill into that I see the list of Integrations (the default tab) and Abode is my first one in the list. But neither at that level, nor once I drill into Abode, do I see a Reconfigure button. I see only this:
image
(and "Reload" does nothing of note)

@wtadler
Copy link

wtadler commented Aug 8, 2023

Hm, are you actually having the same problem that others are? Are all of your Abode devices and entities available or unavailable?

@danielbcook
Copy link

They're all unavailable, which just started in the past few days. When I look at the list of entities each of them says "This entity is no longer being provided by the abode integration. If the entity is no longer in use, delete it in settings."

My assumption was that a recent restart caused the integration to de-authenticate and made the entities unavailable. But it's certainly possible I have another issue. The last known event from the integration was about 20 hours ago when the alarm was set to Standby.

@wtadler
Copy link

wtadler commented Aug 8, 2023

I don't know why it's not prompting you to reconfigure! You may indeed have a different issue.

@danielbcook
Copy link

I installed all the latest updates and then restarted HA. My entities are now re-enabled, but I still don't have an option to configure the integration as I do with many others. So that part remains a mystery but thanks for the support anyhow!

@guitarflipper
Copy link

I just updated to Home Assistant 2023.8.2 and had to reauthenticate the Abode integration. Is anything being done about this?

@grainsoflight
Copy link

Credentials did not survive 2023.8.3 update

@guitarflipper
Copy link

Same here.

@tradel
Copy link
Contributor

tradel commented Aug 20, 2023 via email

@grainsoflight
Copy link

@guitarflipper @tradel do either of you have two factor authentication turned on for abode

@tradel
Copy link
Contributor

tradel commented Aug 20, 2023 via email

@grainsoflight
Copy link

I do, I'm wondering if this only affects users with 2FA or if any non 2FA users experience

@jsmarion
Copy link

jsmarion commented Aug 20, 2023 via email

@hokfujow
Copy link

hokfujow commented Aug 22, 2023

This is happening with me as well. It's not just limited to restarts, which I do rarely. I'm not sure if it's due to updates - but I find I have to login back in every few days. (Actually I just did a HA OS udpate and Abode is still logged in). I use 2FA.
This happens to me with Hubitat's Abode integration as well - but much less frequently and not with every update or restart. Perhaps once every few months with hubitat vs every few days with HA.

@evanmoses-okta
Copy link

I just took a look at the jaraco.abode source. I think it'll need to be refactored to make this work properly. It manages its state in two parts: a _token and _oauth_token that it keeps in memory, and cookies that it persists to disk using a ShelvedCookieJar (from a lib also developed by the author). I don't actually know anything about the abode api so I'm not sure whether the cookies are necessary in each request, or whether just returning with the _token and _oauth_token to the Hass integration and letting it set them at startup (instead of just setting username and password from config like it does now) would work, I'll have to experiement when I have some time.

If that would work, it would probably be pretty straightforward to ignore all the cookie stuff and be able to pass in the tokens as part of the Client constructor, leaving all the old behavior in place if you don't pass in the tokens.

@mikenelson-io
Copy link

This is still an issue. Any progress on a fix yet?

@Sumtin
Copy link

Sumtin commented Dec 15, 2023

Happening for me as well. Every update. At least now I know why. 👍

@tradel
Copy link
Contributor

tradel commented Dec 15, 2023 via email

@mikenelson-io
Copy link

mikenelson-io commented Dec 15, 2023 via email

@nathang21
Copy link
Author

nathang21 commented Dec 15, 2023 via email

@grainsoflight
Copy link

grainsoflight commented Dec 15, 2023 via email

@jsmarion
Copy link

jsmarion commented Dec 15, 2023 via email

@tradel
Copy link
Contributor

tradel commented Dec 15, 2023 via email

@jsmarion
Copy link

jsmarion commented Dec 15, 2023 via email

@Sumtin
Copy link

Sumtin commented Dec 15, 2023

HAOS on rPi, 2FA on.

@mikenelson-io
Copy link

mikenelson-io commented Dec 15, 2023 via email

@grainsoflight
Copy link

A year later now, still needs reauth on each update

@grainsoflight
Copy link

Have we kinda decided that the only resolution to this is to turn off 2FA for the home security system?

@grainsoflight
Copy link

Ultimately ended up removing 2FA. Probably an awful idea for a home security system, but having to reauthorize multiple times a month is very annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests