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

get_devices.py results in libdyson.exceptions.DysonInvalidAuth #15

Closed
dbdmdbdmdbdm opened this issue Sep 11, 2021 · 24 comments
Closed

get_devices.py results in libdyson.exceptions.DysonInvalidAuth #15

dbdmdbdmdbdm opened this issue Sep 11, 2021 · 24 comments
Assignees

Comments

@dbdmdbdmdbdm
Copy link

Trying to get the credentials and getting this exception.

@nomis52
Copy link

nomis52 commented Sep 12, 2021

I found that you need to sign out from the dyson app. Once you do that, it asks for a passport and then emails the verification code.

@chmolto
Copy link

chmolto commented Sep 24, 2021

Same problem here, logging out from the app didn't help.

@chmolto
Copy link

chmolto commented Sep 24, 2021

After reseting the machine and linking it to new mail account, now it retrieves the devices.

@FireHelmet
Copy link

Hello,

I got the same issue as you I guess,

Traceback (most recent call last): File "C:\Users\User\Downloads\libdyson-0.8.8\get_devices.py", line 22, in <module> verify = account.login_email_otp(email, region) File "C:\Users\User\Downloads\libdyson-0.8.8\libdyson\cloud\account.py", line 127, in login_email_otp response = self.request( File "C:\Users\User\Downloads\libdyson-0.8.8\libdyson\cloud\account.py", line 119, in request raise DysonInvalidAuth libdyson.exceptions.DysonInvalidAuth

@christianfus what's machine did you reset ? could you give me more detail?

Thank you !

@chmolto
Copy link

chmolto commented Nov 20, 2021

I was trying to make it work with a Dyson Pure Cool, I reset the machine and then link it to a new account with the Dyson app. But that was the temporal solution, the final solution is to connect it via mqtt connection.

@Kakise Kakise self-assigned this Nov 24, 2021
@Kakise
Copy link
Collaborator

Kakise commented Nov 24, 2021

Thanks @FireHelmet for pinging me here, so I figured out on another issue that this can be resolved by trying to disconnect your phone from Dyson Link right before running the get_devices script for some reason. It can take a few tries too, the auth flow is not consistent right now.

@FireHelmet
Copy link

@Kakise , thanks I will try, I keep you informed !

@FireHelmet
Copy link

@Kakise , I tried twice and I got this error below:

R5O0anTU6I

Could you help ?

I will also try more times...

Thank you !

@FireHelmet
Copy link

@Kakise I tried multiple times in different days, by signing out or not from Dyson mobile app and the issue persist. Could take a look in the code ?

Thank you !

@mjmcg
Copy link

mjmcg commented Dec 3, 2021

I'm getting the same issue...I used Dyson Cloud to add my Dyson Pure Hot+Cool to Dyson Local. It stopped working so I deleted it from Dyson Local and tried to setup Dyson Cloud to add it again. No luck. I'm getting the same error that FireHelmet posted. Any help would be most appreciated! This integration has been rock solid since I set it up.

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/dyson_cloud/init.py", line 43, in async_setup_entry
devices = await hass.async_add_executor_job(account.devices)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/libdyson/cloud/account.py", line 167, in devices
File "/usr/local/lib/python3.9/site-packages/libdyson/cloud/account.py", line 113, in request
auth=self._auth if auth else None,
libdyson.exceptions.DysonInvalidAuth

@BenAChilds
Copy link

BenAChilds commented Jan 29, 2022

Dropping in to say that the logging out from the app worked for me to at least allow me to finish Dyson Cloud HASS integration setup, but once that was complete I was given another log and the integration was inoperable.
Log entry:

2022-01-29 16:42:12 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry <email>@gmail.com (AU) for dyson_cloud
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/dyson_cloud/__init__.py", line 43, in async_setup_entry
    devices = await hass.async_add_executor_job(account.devices)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/libdyson/cloud/account.py", line 167, in devices
    response = self.request("GET", API_PATH_DEVICES)
  File "/usr/local/lib/python3.9/site-packages/libdyson/cloud/account.py", line 113, in request
    raise DysonInvalidAuth
libdyson.exceptions.DysonInvalidAuth

I tried to delete the integration setup to start over, just in case this was a glitch, but now I'm flat out being blocked from logging in there - no amount of logging out from the app seems to fix it.

@Fulg
Copy link

Fulg commented Feb 9, 2022

On my end just launching the companion app on my phone (with it connected to my Dyson fan) was enough to fix this, no need to log out or reset anything. Then getting the credentials works fine.

If it's been a while since I launched the Dyson app, then I get DysonInvalidAuth as initially reported.

@FireHelmet
Copy link

I still have the issue. I tried 3 times with and without being connected in the companion app.
I already tried to create a new dyson account too.

any chance to get this fixed?

74DFF600-6C85-4B17-980B-717629DBA89B

Thanks!

@gazzmundo
Copy link

+1 to this same issue, failing after asking for password and successfully receiving verification code.

@cyberlu
Copy link

cyberlu commented Mar 7, 2022

+1
Logged out of the app. Tried during login. Repeatet 10 times without success.
Please choose your account region 1: Mainland China 2: Rest of the World Region [1/2]: 2 Region code: CH Email: xyz@xxxxx.com Traceback (most recent call last): File "D:\libdyson-main\get_devices.py", line 22, in <module> verify = account.login_email_otp(email, region) File "D:\libdyson-main\libdyson\cloud\account.py", line 122, in login_email_otp response = self.request( File "D:\libdyson-main\libdyson\cloud\account.py", line 114, in request raise DysonInvalidAuth libdyson.exceptions.DysonInvalidAuth

@kastrom
Copy link

kastrom commented Apr 2, 2022

+1

Still getting the DysonInvalidAuth error immediately after entering my email address (unlike some I don’t even reach the password or OTP fields). This happens whether I try to configure directly within HA or using command line on a Ubuntu instance running in Docker. I don’t have a Windows machine to try.

IMG_0637

Steps I’ve tried:

  • Logging out of the Dyson app and website
  • Removing the fan from my Dyson account, setting up a new account and re-registering the device
  • Running a VPN to check my ISP wasn’t somehow blocking the connection (I’m running 5G broadband so this happens occasionally)

I’ve seen some people have had success by changing the user agent, is this still a viable workaround? Any other suggestions?

@Ulrar
Copy link

Ulrar commented Apr 6, 2022

Same issue here, I get that exception as soon as I enter my email, no password.
I don't even have the app installed anymore so I can't log out, I've been using the dyson local integration for so long but it's been acting weird lately so I wanted to re-set it up

@Kakise
Copy link
Collaborator

Kakise commented Apr 8, 2022

I updated libdyson to v0.8.11, only change I made is changing the user agent used to connect to the api. It should fix further connection problems.

Same issue here, I get that exception as soon as I enter my email, no password.
I don't even have the app installed anymore so I can't log out, I've been using the dyson local integration for so long but it's been acting weird lately so I wanted to re-set it up

Please reinstall the app, login to your account and then log out, I was able to reproduce your issue by uninstalling the app before logout

@Kakise Kakise closed this as completed Apr 8, 2022
@Ulrar
Copy link

Ulrar commented Apr 8, 2022

That does solve it, thanks !

@kastrom
Copy link

kastrom commented Apr 10, 2022

I’m still getting the same error…

I’ve updated ha-dyson to v0.16.4-4, ha-dyson-cloud to v0.14.0 and Home Assistant core to 2022.4.1, and I’ve logged into and out of the Dyson app multiple times.

Is there something I’m missing? 🤔


Logger: aiohttp.server
Source: custom_components/dyson_cloud/config_flow.py:71 
Integration: Dyson Cloud (documentation, issues) 
First occurred: 10:45:30 (6 occurrences) 
Last logged: 10:57:30

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 219, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 206, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 335, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/dyson_cloud/config_flow.py", line 71, in async_step_email
    self._verify = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/libdyson/cloud/account.py", line 122, in login_email_otp
    response = self.request(
  File "/usr/local/lib/python3.9/site-packages/libdyson/cloud/account.py", line 114, in request
    raise DysonInvalidAuth
libdyson.exceptions.DysonInvalidAuth

@FireHelmet
Copy link

FireHelmet commented Apr 10, 2022

@kastrom , yes you missed to use libdyson with Dyson Local component. Please re-read https://github.com/shenxn/ha-dyson/#setup-manually

When your credential is generated with libdyson, you need to use it in Dyson Local component from HA.
Don’t use Dyson cloud in this setup

@kastrom
Copy link

kastrom commented Apr 10, 2022

Ah yes, I’d missed that this time around.

But after deleting and re-cloning libdyson (and logging in and out of the Dyson app) I’m still getting a DysonInvalidAuth failure:

IMG_0639

@FireHelmet
Copy link

@kastrom

Retry after waiting more time between the logout from Dyson app and the login into libdyson.

I had same issue the first time and after it has worked

@kastrom
Copy link

kastrom commented Apr 12, 2022

@FireHelmet thank you, you're a genius — I’d all but given up at this point.

And also thanks to @Kakise for the fix.

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