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

tapo.cloudLogin get Error: Unexpected Error Code: -20004 #22

Closed
coffeemilkcrazy opened this issue Apr 27, 2022 · 5 comments · Fixed by #24
Closed

tapo.cloudLogin get Error: Unexpected Error Code: -20004 #22

coffeemilkcrazy opened this issue Apr 27, 2022 · 5 comments · Fixed by #24

Comments

@coffeemilkcrazy
Copy link

Today I just got the error after call tapo.cloudLogin always got error message Error: Unexpected Error Code: -20004 and cannot login, not sure what error -20004 code mean?

Could you please check this error? hope we can fix it

@avalkowsky
Copy link

avalkowsky commented Apr 27, 2022

+1 also observed that one and have no clue what it is about

@rpalfray87
Copy link

Same for me.
Apparently the message means: "API rate limit exceeded"
But I don't know how to solve it :/

@houdang
Copy link

houdang commented Apr 29, 2022

Obviously TP-Link blocked request from specific UUID's and there's only a specific one used in the code.
Check this line in the file here

It supposed to be the UUID from your own account. I guess the only way to found out the number is by checking the requests sent to TP-Link from the TP App, i not yet found time for this.

I just tested the request and sent a random number for the uuid.
That seems to work and i guess TP-Link won't block you if you don't spam there system.

timrogers added a commit to timrogers/tp-link-tapo-connect that referenced this issue May 1, 2022
When you call `cloudLogin` to log in to the TP-Link API, you have
to send a `terminalUUID`. At the moment, this is hard-coded, and
is triggering a `-20004` error:

```json
{"error_code":-20004,"msg":"API rate limit exceeded"}
```

This switches to generate a new terminal UUID on each call using
the `uuid` npm package, which gets around this rate limiting
issue.

Fixes dickydoouk#22.
@timrogers
Copy link
Contributor

I've fixed this in #24 by automatically generating a UUID on each request, rather than using the hard-coded one - we just need to wait for @dickydoouk to have the time to review it 😊

If you want to give my changes a try in the mean time, then you can install my version of the package by running npm install timrogers/tp-link-tapo-connect#random-uuid.

@rpalfray87
Copy link

I've fixed this in #24 by automatically generating a UUID on each request, rather than using the hard-coded one - we just need to wait for @dickydoouk to have the time to review it blush

If you want to give my changes a try in the mean time, then you can install my version of the package by running npm install timrogers/tp-link-tapo-connect#random-uuid.

It works for me. Thank you :)

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