twrecked / hass-aarlo

Asynchronous Arlo Component for Home Assistant
GNU Lesser General Public License v3.0
399 stars 79 forks source link

Auth/2FA issue #904

Closed garyo closed 7 months ago

garyo commented 8 months ago

I updated to the latest version a while ago (aarlo 0.8.1a5 with pyarlo 0.8.0.4), things seemed to be working, but now I can't authenticate. In the my.arlo.com website, I have push auth set up to my Android phone. That works OK (I get the notification, approve, and can log in on the website).

I moved my aarlo config into aarlo.py, like this (I commented out the old gmail auth, since I'm not using that anymore):

version: 1
aarlo:
  backend: sse
  tfa_source: push
  tfa_type: PUSH
  username: !secret arlo_username
  password: !secret arlo_password
  #tfa_source: imap
  #tfa_type: email
  #tfa_host: imap.gmail.com:993
  #tfa_username: !secret ha_gmail_username
  #tfa_password: !secret ha_gmail_password

but I get these errors on startup:

unable to connect to Arlo: attempt=1,sleep=15,error=2fa no suitable secondary choice available
unable to connect to Arlo: attempt=2,sleep=30,error=2fa no suitable secondary choice available
unable to connect to Arlo: attempt=3,sleep=60,error=2fa no suitable secondary choice available
unable to connect to Arlo: attempt=4,sleep=120,error=2fa no suitable secondary choice available
unable to connect to Arlo: attempt=1,sleep=15,error=2fa startup failed

and in the logs, I see it's still trying to use imap I think:

2024-03-27 12:26:06.214 INFO (SyncWorker_9) [pyaarlo] pyarlo 0.8.0.4 starting...
2024-03-27 12:26:06.425 ERROR (SyncWorker_9) [pyaarlo] session start failed
2024-03-27 12:26:08.507 ERROR (SyncWorker_9) [pyaarlo] imap connection failedb'[AUTHENTICATIONFAILED] Invalid credentials (Failure)'
2024-03-27 12:26:08.508 ERROR (SyncWorker_9) [pyaarlo] 2fa startup failed
2024-03-27 12:26:10.347 ERROR (SyncWorker_9) [pyaarlo] imap connection failedb'[AUTHENTICATIONFAILED] Invalid credentials (Failure)'
2024-03-27 12:26:10.348 ERROR (SyncWorker_9) [pyaarlo] 2fa startup failed
2024-03-27 12:26:10.358 ERROR (SyncWorker_9) [custom_components.aarlo] unable to connect to Arlo: attempt=4,sleep=120,error=2fa startup failed
2024-03-27 12:26:10.358 ERROR (SyncWorker_9) [custom_components.aarlo] unable to connect to Arlo: stopping retries, too may failures
twrecked commented 8 months ago

The config for username and 2fa has been moved into the standard Home Assistant location, the aarlo.yaml file now contains the less used configuration items. You have 2 choices:

ramdisk00 commented 8 months ago

" twrecked The config for username and 2fa has been moved into the standard Home Assistant location, the aarlo.yaml file now contains the less used configuration items. You have 2 choices:

modify the Aarlo entries in .storage/core.config_entries to match your setup delete and recreate the Arlo instance on the integrations page"

I'm having the same issue can't get 2FA to work any more. What is the aarlo.yaml file and where should it be located? second I don't have aarlo in my .storage/core/core.config_entries, what should be there?

garyo commented 8 months ago

I'm trying to recreate my aarlo config from scratch but it's not working yet. I removed the integration in the UI and deleted aarlo.yaml and restarted, then re-configured from scratch (using IMAP for 2FA) but it fails to configure. Do I also need to remove the aarlo entries in .storage/core.device_registry and .storage/core.entry_registry before re-setting up?

I'm getting several errors, but one repeating one is this -- looks like it's trying to connect to an MQTT host (I didn't configure anything like that, just username/password/2fa IMAP and imap user/pass/host):

2024-04-02 08:16:18.611 ERROR (ArloEventStream) [pyaarlo] general-error=gaierror
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyaarlo/backend.py", line 526, in _mqtt_main
    self._event_client.connect(self._arlo.cfg.mqtt_host, port=443, keepalive=60)
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 914, in connect
    return self.reconnect()
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1044, in reconnect
    sock = self._create_socket_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
    return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/socket.py", line 828, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/socket.py", line 963, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name does not resolve
twrecked commented 8 months ago

@garyo set your backend to sse, if you are on v0.8 try the fix in #871

@ramdisk00 what version are you on?

garyo commented 8 months ago

Yes I am on the latest v0.8 aarlo, just updated via HACS. I deleted the integration, created the aarlo.yaml file as in #871, but then the config flow hung. So I deleted that file, restarted, went through the config flow, got the mqtt errors as above, and then recreated aarlo.yaml to set the sse backend. And sure enough, it's working now! Thanks!

I do have one question remaining. I see that the config entries, including passwords, are now stored in .storage/core.config_entries. Can I use my secrets file with that, like !secret arlo_username? (Either by typing that in to the config flow, or hand-editing the core.config_entries file?)

twrecked commented 8 months ago

re: the secret's file; I'm not sure but I would think not. That's all controlled by the HA team.

But glad it's working.

smrtrich commented 7 months ago

I didnt do any upgrades to home assistant, still on 2024.1.3. Just did a reboot of the server. On reboot got the same errors that garyo was getting (mqtt). I ended up doing what twrecked suggested and modifying my configuration.yaml file (I am using hass-aarlo v7.4.2)

aarlo: backend: sse (left everything else the same)

restarted home assistant and the arlo integration is working again.

Thanks!