pbrunier / node-red-contrib-dyson-purelink

This Node RED module can control dyson purifier (tested with dyson hot&cool pure link)
Other
11 stars 4 forks source link

Unable to login to dyson through this node #24

Closed mrmorgul closed 3 years ago

mrmorgul commented 3 years ago

Just got my first dyson DP04, created a new dyson user. Installed config in node red, with email & password, and tried different country codes (DA, DK, EU & US) with no luck, node is unable to discover the fan, even i have provided ip. I have tried with another solution in Homebridge, here i got “unable to login at dyson”

Any one with similar login issues at dyson?

wonder if its dyson 2factor login for new devices that is the issue ? 888E565D-D346-4DA9-82EF-4EC83B4A8CE6

naimo84 commented 3 years ago

Hi @mrmorgul,

sorry for the late response.

May you please try this URL with your account informations in any browser?

https://appapi.cp.dyson.com/v1/userregistration/userstatus?country=DA&email=you@example.com

All of these api calls aref ailing for me. It seems, that I'm blocked... https://www.google.com/search?q=cloudflare+1020 I'm also unable to login. I'm getting the following error: image

I don't know, how to solve this problem. Sorry.

Regards, Benjamin

mrmorgul commented 3 years ago

Hi, it’s me who thanks for yor work :-)

I get the same error when using the links.

My suspicion is that it’s the initial login, that need the 2factor id.

Best regards Rene

Den 6. apr. 2021 kl. 16.23 skrev Benjamin @.***>:

 Hi @mrmorgul,

sorry for the late response.

May you please try this URL with your account informations in any browser?

@.***

All of these api calls aref ailing for me. It seems, that I'm blocked... I'm also unable to login. I'm getting the following error:

I don't know, how to solve this problem. Sorry.

Regards, Benjamin

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

mrmorgul commented 3 years ago

Thanks for your reply, i have tried to get in contact with dyson with no luck, but found this thread, hope it can bring some solutions?

https://github.com/home-assistant/core/issues/46400

Best Regards

Den 6. apr. 2021 kl. 16.23 skrev Benjamin @.***>:

 Hi @mrmorgul,

sorry for the late response.

May you please try this URL with your account informations in any browser?

@.***

All of these api calls aref ailing for me. It seems, that I'm blocked... I'm also unable to login. I'm getting the following error:

I don't know, how to solve this problem. Sorry.

Regards, Benjamin

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

RamikOaken commented 3 years ago

hi @naimo84 it looks like they've found a solution here: https://github.com/home-assistant/core/issues/46400

naimo84 commented 3 years ago

Hey @RamikOaken, @mrmorgul ,

thanks for searching other issues with the dyson-cloud. Perhaps I can fix this issue with the 2FA/OTP. BUT: I don't have an idea how you query the otp. I know, that there is a RED.notify, to display a read only notification to the user. But no "input" notification, to enter the OTP Code.

alternatively storing the otp as a config-settings? But I don't like the idea of storing one time things in the config ;)

Best regards

RamikOaken commented 3 years ago

I think storing the OTP in config-settings is better than nothing. At least folks can make the decision to not use the integration if they're uncomfortable.

mrmorgul commented 3 years ago

I agree, the code is a result of the Dyson API, and onetime stuf in config is a ok workaround, name the field accordingliy “one time setup code” Thanks for you effort Naimo :-)

naimo84 commented 3 years ago

Please be patient,

currently I'm getting the following error

response: {
    status: 429,
    statusText: 'Too Many Requests',
    headers: {
      date: 'Tue, 27 Apr 2021 04:44:49 GMT',
      'content-type': 'application/json',     
      server: 'cloudflare',
    },
    config: {
      url: 'https://appapi.cp.dyson.com/v3/userregistration/email/userstatus?country=DE',

So, testing the API is pain. My IP seems to be blocked, because I tried to often....

eibalinchen commented 3 years ago

hello all, with the current version 0.3.1 I get the following messages in the node red log when trying to authenticate to get otp... hope this helps to find a solution... P.S.: my Country Code is "DE"

Error: ENOENT: no such file or directory, unlink './dyson_cookie' at Object.unlinkSync (fs.js:1136:3) at DysonCloud.<anonymous> (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:186:30) at step (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:33:23) at Object.next (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:14:53) at /home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:8:71 at new Promise (<anonymous>) at __awaiter (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:4:12) at DysonCloud.authenticate (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:131:16) at sensorNode.<anonymous> (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:59:57) at step (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:33:23) at Object.next (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:14:53) at /home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:8:71 at new Promise (<anonymous>) at __awaiter (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:4:12) at /home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:52:80 at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5) at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/usr/lib/node_modules/node-red/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5) at /usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:281:22 at Function.process_params (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:335:12) at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:275:10) at expressInit (/usr/lib/node_modules/node-red/node_modules/express/lib/middleware/init.js:40:5) at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:317:13) at /usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:335:12) at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:275:10) { errno: -2, syscall: 'unlink', code: 'ENOENT', path: './dyson_cookie' }

eibalinchen commented 3 years ago

hello all, with the current version 0.3.1 I get the following messages in the node red log when trying to authenticate to get otp... hope this helps to find a solution... P.S.: my Country Code is "DE"

Error: ENOENT: no such file or directory, unlink './dyson_cookie' at Object.unlinkSync (fs.js:1136:3) at DysonCloud.<anonymous> (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:186:30) at step (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:33:23) at Object.next (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:14:53) at /home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:8:71 at new Promise (<anonymous>) at __awaiter (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:4:12) at DysonCloud.authenticate (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/dysonCloud.js:131:16) at sensorNode.<anonymous> (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:59:57) at step (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:33:23) at Object.next (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:14:53) at /home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:8:71 at new Promise (<anonymous>) at __awaiter (/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:4:12) at /home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dyson-link.js:52:80 at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5) at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/usr/lib/node_modules/node-red/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5) at /usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:281:22 at Function.process_params (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:335:12) at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:275:10) at expressInit (/usr/lib/node_modules/node-red/node_modules/express/lib/middleware/init.js:40:5) at Layer.handle [as handle_request] (/usr/lib/node_modules/node-red/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:317:13) at /usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:335:12) at next (/usr/lib/node_modules/node-red/node_modules/express/lib/router/index.js:275:10) { errno: -2, syscall: 'unlink', code: 'ENOENT', path: './dyson_cookie' }

naimo84 commented 3 years ago

Hi,

@eibalinchen: Sorry for the circumstances. I found an issue with unlinkSync function. I didn't check if the file exists before. unfortunately this unlinkSync/deleteFile function is used within an catch error during authentication.

I've published a version 0.3.2, in order to get the "real" error message ;)

Greets, Benjamin

eibalinchen commented 3 years ago

Hi Benjamin, no problem for me. if i can support, i will gladly do so. i have updated to version 0.3.2. the error message when trying to get the otp code is now: "Error: ENOENT: no such file or directory, open './dist/dysonpurelink/certs/digicert.crt'". The specified directory contains such a file...

Greets André

eibalinchen commented 3 years ago

Hi Benjamin, thanks for the update. I have just tested this once. unfortunately still with the same error.

"Error: ENOENT: no such file or directory, open './dist/dysonpurelink/certs/digicert.crt'"

Greets André

eibalinchen commented 3 years ago

Hi Benjamin,

I was able to fix the problem now and it works! i changed in the file "dysonCloud.js" the 3 references to "cert" to the actual path:

/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dist/dysonpurelink/certs/digicert.crt" and the path for "dyson_cookie" to:

/home/openhabian/.node-red/node_modules/node-red-contrib-dyson-purelink/dyson_cookie

Then received a mail and was able to verify the code, as well as select and control my Dyson.... ;-)

;-)

naimo84 commented 3 years ago

Hi André,

I should hit the "build button" after changing and before publishing something 😜

This should fix your workaround ;) Thanks for testing anyway 👍

Benjamin

eibalinchen commented 3 years ago

Hi André,

I should hit the "build button" after changing and before publishing something 😜

This should fix your workaround ;) Thanks for testing anyway 👍

Benjamin

:joy: :joy: verified!!! it works.👍👍👍 Thank you very much, summer can now move into my living room.

André

mrmorgul commented 3 years ago

Hi, thanks for the uddate 😀

I have tried, but get some errors. When using “DA” i get: “ Error: Request failed with status code 500” and no email from dyson. When using “DK” i get: “ Error: Request failed with status code 429”, and i get the mail from dyson.

After adding the code from dyson i push validate button, but nothing happens, and node still report. “Wait for otp mail”

Best regards Rene

Den 27. maj 2021 kl. 09.18 skrev eibalinchen @.***>:  Hi André,

I should hit the "build button" after changing and before publishing something 😜

This should fix your workaround ;) Thanks for testing anyway 👍

Benjamin

😂 😂 verified!!! it works.👍👍👍 Thank you very much, summer can now move into my living room.

André

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

eibalinchen commented 3 years ago

hi,

i think 429 i had also received as message in the node-red-log. and after that I received the mail with the ODP PIN. when I then entered this and clicked on "verify", I was able to find my Dyson and control/read out accordingly. my country code is "DE" have you restarted nodered once?

mrmorgul commented 3 years ago

Thanks, great work, i striped all, and recreated it, success

Best regards Rene

Den 27. maj 2021 kl. 15.01 skrev eibalinchen @.***>:

 hi,

i think 429 i had also received as message in the node-red-log. and after that I received the mail with the ODP PIN. when I then entered this and clicked on "verify", I was able to find my Dyson and control/read out accordingly. my country code is "DE" have you restarted nodered once?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

naimo84 commented 3 years ago

glad to read, that it works with the latest update 😀

if you like the node, leave me a star ⭐

I'll close the issue for now. feel free to open it again 😉