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

Adding credentials doesn't work #245

Open
GChan21 opened this issue Jan 20, 2024 · 11 comments
Open

Adding credentials doesn't work #245

GChan21 opened this issue Jan 20, 2024 · 11 comments

Comments

@GChan21
Copy link

GChan21 commented Jan 20, 2024

Hi, thanks for creating this, videos online look great! My installation seemed to go fine until i add my email and password i use for Emporia. I then get a spinning wheel and it never completes the install. Eventually it times out with "Unexpected Error". Any ideas?
Thanks!

@yuri-tceretian
Copy link

yuri-tceretian commented Mar 12, 2024

I have similar problem. After upgrading to the latest version of plugin it started failing to authorize.
The logs show

Unexpected exception

Traceback (most recent call last):
  File "/config/custom_components/emporia_vue/config_flow.py", line 76, in async_step_user
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/emporia_vue/config_flow.py", line 47, in validate_input
    if not await hub.authenticate(data[CONF_EMAIL], data[CONF_PASSWORD]):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/emporia_vue/config_flow.py", line 37, in authenticate
    result = await loop.run_in_executor(None, self.vue.login, username, password)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyemvue/pyemvue.py", line 355, in login
    self.auth = Auth(
                ^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyemvue/auth.py", line 57, in __init__
    self.cognito.authenticate(password=password)
  File "/usr/local/lib/python3.12/site-packages/pycognito/__init__.py", line 495, in authenticate
    self._set_tokens(tokens)
  File "/usr/local/lib/python3.12/site-packages/pycognito/__init__.py", line 767, in _set_tokens
    self.verify_token(
  File "/usr/local/lib/python3.12/site-packages/pycognito/__init__.py", line 266, in verify_token
    raise TokenVerificationException(
pycognito.exceptions.TokenVerificationException: Your 'access_token' token could not be verified (The token is not yet valid (iat)).

Rollback to 0.8.3 did not help. It looks like something has changed on API side.

@magico13
Copy link
Owner

@yuri-tceretian your issue is from your server time drifting too far from reality, see #260. The original error for this issue was likely an outage on the Emporia/AWS side or invalid credentials, @GChan21 did you ever get logged in?

@GChan21
Copy link
Author

GChan21 commented Mar 13, 2024

@magico13 , thanks for the reply. I haven't managed to log in yet, but I've not tried for a while.
I'll give it another go and keep you posted.
Cheers!

@RageInvader
Copy link

RageInvader commented Apr 6, 2024

I'm getting same error, cant connect anymore

`This error originated from a custom integration.

Logger: custom_components.emporia_vue.config_flow
Source: custom_components/emporia_vue/config_flow.py:76
integration: Emporia Vue (documentation, issues)
First occurred: 23:24:56 (2 occurrences)
Last logged: 23:45:05

Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/emporia_vue/config_flow.py", line 76, in async_step_user
info = await validate_input(self.hass, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/emporia_vue/config_flow.py", line 47, in validate_input
if not await hub.authenticate(data[CONF_EMAIL], data[CONF_PASSWORD]):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/emporia_vue/config_flow.py", line 37, in authenticate
result = await loop.run_in_executor(None, self.vue.login, username, password)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyemvue/pyemvue.py", line 355, in login
self.auth = Auth(
^^^^^
File "/usr/local/lib/python3.12/site-packages/pyemvue/auth.py", line 59, in init
self.tokens = self.refresh_tokens()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyemvue/auth.py", line 63, in refresh_tokens
self.cognito.renew_access_token()
File "/usr/local/lib/python3.12/site-packages/pycognito/init.py", line 695, in renew_access_token
self._set_tokens(refresh_response)
File "/usr/local/lib/python3.12/site-packages/pycognito/init.py", line 767, in _set_tokens
self.verify_token(
File "/usr/local/lib/python3.12/site-packages/pycognito/init.py", line 266, in verify_token
raise TokenVerificationException(
pycognito.exceptions.TokenVerificationException: Your 'access_token' token could not be verified (The token is not yet valid (iat)).
`

@DabblerIOT
Copy link
Collaborator

Token not yet valid typically means your time on your ha instance or docker containers is wrong.

@RageInvader
Copy link

yeah i have checked and made sure time is correct, could it be daylight savings in the uk?

@DabblerIOT
Copy link
Collaborator

Don't know, your os and all that up to date? Servers are in iad... us east for auth.. time changed here a couple weeks ago.

Where are you trying to authenticate from?

@DabblerIOT
Copy link
Collaborator

reboot host and see how it pans out? Hopefully time sync sorts it all out?

@RageInvader
Copy link

I'm running in a docker on unraid. tried all the reboots nothing helping.

@RageInvader
Copy link

okay, i tried changing timezone on unraid to UTC which takes my clock 1 hour back, and it works now.

@sushain97
Copy link

I'm seeing this issue and unfortunately an NTP sync doesn't fix it.

That is, after running:

home:~# ntpd -d -q -n -p pool.ntp.org
ntpd: 'pool.ntp.org' is 198.60.22.240
ntpd: sending query to 198.60.22.240
ntpd: reply from 198.60.22.240: offset:+0.976274 delay:0.026299 status:0x24 strat:2 refid:0x0260a384 rootdelay:0.014282 reach:0x01
ntpd: sending query to 198.60.22.240
ntpd: reply from 198.60.22.240: offset:+0.976367 delay:0.026415 status:0x24 strat:2 refid:0x0260a384 rootdelay:0.014282 reach:0x03

I'm still seeing this error:

pycognito.exceptions.TokenVerificationException: Your 'access_token' token could not be verified (The token is not yet valid (iat)).

My HA container is configured to use PDT:

home:/config# env | grep TZ
TZ=America/Los_Angeles
home:/config# date
Tue Apr  9 23:11:28 PDT 2024

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

No branches or pull requests

6 participants