etheralm / libpurecool

Python library for dyson devices.
Other
66 stars 30 forks source link

Unable to login #42

Closed ThibautLandrein closed 1 day ago

ThibautLandrein commented 9 months ago

Hello, I have forked the repo and have been trying to log in. However i get an error from cloudflare stating that i've been blocked. Are the credentials the same to log in within the Dyson app ? Has anyone encountered this issue ? I have tried to change the User-Agent header to "Mozilla/5.0" but it didn't work

image

troykelly commented 9 months ago

Are you able to authenticate via the app on the same network (assuming you use NAT) address that you are getting the blocked message for? The issue is that Dyson are ... unfriendly.. to people who want to try and incorporate their product into home automation systems.

I don't think cp.dyson.com is actually a valid domain for web traffic?

+ dig ANY cp.dyson.com

; <<>> DiG 9.10.6 <<>> ANY cp.dyson.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48479
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;cp.dyson.com.                  IN      ANY

;; ANSWER SECTION:
cp.dyson.com.           169     IN      MX      10 feedback-smtp.eu-central-1.amazonses.com.
cp.dyson.com.           1759    IN      SOA     andronicus.ns.cloudflare.com. dns.cloudflare.com. 2324820319 10000 2400 604800 1800
cp.dyson.com.           169     IN      MX      10 feedback-smtp.eu-west-1.amazonses.com.

;; Query time: 13 msec
;; SERVER: 2404:79c0:1002:1000:59c5:6de9:33a6:ec24#53(2404:79c0:1002:1000:59c5:6de9:33a6:ec24)
;; WHEN: Fri Dec 15 23:42:57 AEDT 2023
;; MSG SIZE  rcvd: 199

+ dig A cp.dyson.com

; <<>> DiG 9.10.6 <<>> A cp.dyson.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64282
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;cp.dyson.com.                  IN      A

;; Query time: 3 msec
;; SERVER: 2404:79c0:1002:1000:59c5:6de9:33a6:ec24#53(2404:79c0:1002:1000:59c5:6de9:33a6:ec24)
;; WHEN: Fri Dec 15 23:42:57 AEDT 2023
;; MSG SIZE  rcvd: 41

+ dig AAAA cp.dyson.com

; <<>> DiG 9.10.6 <<>> AAAA cp.dyson.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45503
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;cp.dyson.com.                  IN      AAAA

;; Query time: 2 msec
;; SERVER: 2404:79c0:1002:1000:59c5:6de9:33a6:ec24#53(2404:79c0:1002:1000:59c5:6de9:33a6:ec24)
;; WHEN: Fri Dec 15 23:42:57 AEDT 2023
;; MSG SIZE  rcvd: 41
ThibautLandrein commented 9 months ago

Hi Troy, thanks for answering. Indeed they do not seem to make it easy accessing this API... Credentials i used work fine on the app and website. As of now this is my code :

from libpurecool.dyson import DysonAccount
acc = DysonAccount("XXX@gmail.com", "XXXXXX, "FR")
acc.login()

And the screenshot i attached to the issue is the html page I get from the post request on the /userregistration/authenticate endpoint

ThibautLandrein commented 9 months ago

I also tried using the code from https://github.com/etheralm/libpurecool/pull/39 but the problem stays the same

Kill0geR commented 3 weeks ago

With this Project you can easily connect to your Dyson fan https://github.com/Kill0geR/DysonPythonHack

ThibautLandrein commented 3 weeks ago

Thanks @Kill0geR i'm going to check this out