milo526 / homebridge-tuya-web

Hoobs and Homebridge plugin for Tuya devices using Home Assistant Tuya Web Api
MIT License
220 stars 96 forks source link

Authentication error: you cannot auth exceed once in 60 seconds #122

Closed tmparks01 closed 3 years ago

tmparks01 commented 3 years ago

Hello - just started getting this error yesterday and unable to see any devices in Homebridge. Thanks.

[TuyaWebPlatform] Authentication error: you cannot auth exceed once in 60 seconds

Describe the bug

[TuyaWebPlatform] Authentication error: you cannot auth exceed once in 60 seconds Steps To Reproduce

Start Homebridge Plugin Version

0.4.8 Homebridge Config


{
            "name": "TuyaWebPlatform",
            "options": {
                "username": "XXXXX",
                "password": "XXXXX",
                "countryCode": "1",
                "platform": "smart_life"
            },
            "defaults": [
                {
                    "device_type": "form"
                }
            ],
            "scenes": false,
            "platform": "TuyaWebPlatform"
        }

Device Config

Additional Context

I changed my Tuya password...but still having the issue.

Makk1000 commented 3 years ago

I've been having the same issue for about a week now, I haven't been able to resolve it either, so you're not alone!

Makk1000 commented 3 years ago

I think there is something up with the Tuya Europe site

milo526 commented 3 years ago

No clue what could be triggering this.

I have had it happen a couple of times during development but then I restart my homebridge instance multiple times a minute. A stable homebridge instance should not have this problem.

Whenever this happens please stop homebridge for at least one minute and restart, that should solve it.

tmparks01 commented 3 years ago

Thanks. Will give it a shot.

edwolfe3 commented 3 years ago

I'm getting this error also in the US with SmartLife products. Just started about a week or so ago.

 njstuya booting njstuya +0ms
  njstuya "{argName} value is: 06200045dc4f2236e565_2 +5ms
  njstuya "{argName} value is: cloud +0ms
  njstuya api {"userName":"[blanked]","password":"[blanked]","countryCode":"1","bizType":"smart_life","region":"us"} or [blanked] +3ms
  cloudtuya {"responseStatus":"error","errorMsg":"you cannot auth exceed once in 60 seconds"} +0ms
  cloudtuya {
  cloudtuya   responseStatus: 'error',
  cloudtuya   errorMsg: 'you cannot auth exceed once in 60 seconds'
  cloudtuya } +2ms
  njstuya Token {"responseStatus":"error","errorMsg":"you cannot auth exceed once in 60 seconds"} +496ms
  cloudtuya { devId: '06200045dc4f2236e565_2' } +5ms
  cloudtuya INVAILD_REQUEST_2 +450ms
(node:4481) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'devices' of undefined
    at CloudTuya.find (/etc/openhab2/scripts/node_modules/cloudtuya/cloudtuya.js:101:23)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async CloudTuya.state (/etc/openhab2/scripts/node_modules/cloudtuya/cloudtuya.js:147:19)
    at async runCloud (/etc/openhab2/scripts/node_modules/njstuya/njstuya.js:206:26)
(node:4481) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4481) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
milo526 commented 3 years ago

I'm getting this error also in the US with SmartLife products. Just started about a week or so ago.

 njstuya booting njstuya +0ms
  njstuya "{argName} value is: 06200045dc4f2236e565_2 +5ms
  njstuya "{argName} value is: cloud +0ms
  njstuya api {"userName":"[blanked]","password":"[blanked]","countryCode":"1","bizType":"smart_life","region":"us"} or [blanked] +3ms
  cloudtuya {"responseStatus":"error","errorMsg":"you cannot auth exceed once in 60 seconds"} +0ms
  cloudtuya {
  cloudtuya   responseStatus: 'error',
  cloudtuya   errorMsg: 'you cannot auth exceed once in 60 seconds'
  cloudtuya } +2ms
  njstuya Token {"responseStatus":"error","errorMsg":"you cannot auth exceed once in 60 seconds"} +496ms
  cloudtuya { devId: '06200045dc4f2236e565_2' } +5ms
  cloudtuya INVAILD_REQUEST_2 +450ms
(node:4481) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'devices' of undefined
    at CloudTuya.find (/etc/openhab2/scripts/node_modules/cloudtuya/cloudtuya.js:101:23)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async CloudTuya.state (/etc/openhab2/scripts/node_modules/cloudtuya/cloudtuya.js:147:19)
    at async runCloud (/etc/openhab2/scripts/node_modules/njstuya/njstuya.js:206:26)
(node:4481) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4481) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Hmm I'm not going to be helpful for your problem. You are not running my plugin 😛 Please report this at the problem location (which seems to be https://github.com/unparagoned/cloudtuya)

JDBem commented 3 years ago

I'm getting the same exact error message: [TuyaWebPlatform] Authentication error: you cannot auth exceed once in 60 seconds

Tried restarting homebridge various times but still nothing, also uninstalled and reinstalled the plugin and still getting the same issue.

Any idea on what this could be? Or how to fix it?

milo526 commented 3 years ago

1) Start homebridge and trigger the error. 2) Wait 5 minutes (1 should be enough but many of you are impatient 😛 Be sure that you are well over 1 minute) 3) Restart homebridge

This has always solved this issue for me.

I'll try to see if I can add in yet another ugly workaround.

anx10us commented 3 years ago

Error -

Authentication error: you cannot auth exceed once in 60 seconds

Great plugin, been working for weeks until recently, I suspect its been about 7-8 days since I was able to control Tuya lights via homekit. I've tried restarting, reinstalling and re authenticating, have also tried the fix mentioned above - https://github.com/milo526/homebridge-tuya-web/issues/122#issuecomment-740506098

ledrewski3 commented 3 years ago

I'm getting the same error. Restarting isn't helping.

milo526 commented 3 years ago

I really have no clue what is triggering this 😛 However I have seen it come by often enough now that I will add a work-around for it.

In the next release, whenever this error triggers, the plugin will back-off for 90 seconds and then try again. If the same error is repeated after 90 seconds, the plugin will still fail to start.

anx10us commented 3 years ago

Just to add, it looks like on a restart I get ... Not sure if this helps ?

[11/12/2020, 21:14:56] [TuyaWebPlatform] Initializing TuyaWebPlatform platform... [11/12/2020, 21:14:56] Loading 1 accessories...

7 seconds later I get ....

[11/12/2020, 21:15:03] [TuyaWebPlatform] Authentication error: you cannot auth exceed once in 60seconds``

edwolfe3 commented 3 years ago

I have nothing to reboot has I don't have a homebrige. I'm using it to call Tuya lights defined in smartlife app.

craskul commented 3 years ago

I'm getting the same Authentication error

craskul commented 3 years ago

any word on an update for this issue?

edwolfe3 commented 3 years ago

I updated to the newest version which is supposed to fix it. However, since doing so, I have not been able to successfully authenticate at all. I've been busy so I haven't been able to consistently work on it. Hopefully soon! If I find a solution, I will post.

milo526 commented 3 years ago

There has not yet been a release after my latest comment. Personal life is currently in the way of plugin development. Please be patient with me.

edwolfe3 commented 3 years ago

@milo526 I was referring to the latest versions of njstuya and cloudtuya. Sorry, I should have clarified that better.

ledrewski3 commented 3 years ago

updating to 1.1.7 fixed the authentication issue for me

RC-Mango commented 3 years ago

Quick and dirty solution (that worked for me)

  1. Remove everything in "platforms" in your homebridge config
  2. Perform "Remove Single Cached Accessory" and "Remove All Cached Accessories"
  3. Restart
  4. Reverse the changes to the config file done in [1]
  5. Restart
edwolfe3 commented 3 years ago

Quick and dirty solution (that worked for me)

  1. Remove everything in "platforms" in your homebridge config
  2. Perform "Remove Single Cached Accessory" and "Remove All Cached Accessories"
  3. Restart
  4. Reverse the changes to the config file done in [1]
  5. Restart

I don't have the homebridge. I'm using this as a command line with Tuya compatible equipment via Smart Life.

milo526 commented 3 years ago

This issue is fixed in v0.5.4 which is currently release under the next tag.

You should no longer get the error. If the error was to be triggered, you will now receive a warning that you will have to wait 65 seconds, after this the plugin will start normally.

beereng commented 3 years ago

I get the same authentication error since today:

[3/24/2021, 11:00:57 PM] [TuyaWebPlatform] Cannot acquire token, waiting 65 seconds. [3/24/2021, 11:02:02 PM] [TuyaWebPlatform] Retrying authentication after previous error. [3/24/2021, 11:02:02 PM] [TuyaWebPlatform] Authentication error: you cannot auth exceed once in 60 seconds

This is static now, even after a longer waiting period and after every reboot:-( When I try to login manually on https://auth.tuya.com, my login is invalid now. I even cannot create a new password or sign up with a new account because I never get an email with a verification code:-((( This is embarrassing.

beereng commented 3 years ago

Oh, and my Tuya IOS app is fully working with my current account.

MattRoe84 commented 3 years ago

Hi, looks like this issue is back. I've had it up and running fine with no issue and since last night im now getting this error. [TuyaWebPlatform] Cannot acquire token, waiting 65 seconds. [TuyaWebPlatform] Retrying authentication after previous error. [10/16/2021, 8:48:58 AM] [TuyaWebPlatform] Authentication error: you cannot auth exceed once in 60 seconds

Troepster commented 2 years ago

Getting the same error here as well, latest version

vedmant commented 4 months ago

Any way to cache token and not acquire it every restart?

milo526 commented 4 months ago

Any way to cache token and not acquire it every restart?

Prs welcome