Open czbird77 opened 4 months ago
When HB is restarted, the plugin gets new token just fine... expire time is 7200, then it expires again
It seems that tuya returns expired token earlier than claimed 7200s ... see below - what can be done about it? Thanks!
8:49 token received 10:07 first token expired response logged 10:48 scheduled token refresh failed - token expired response
8:49 token received
^[[37m[2/7/2024, 8:49:53 AM] ^[[39m^[[36m[TuyaPlatform]^[[39m ^[[90mExecuted didFinishLaunching callback^[[39m ^[[37m[2/7/2024, 8:49:53 AM] ^[[39m^[[36m[TuyaPlatform]^[[39m Log in to Tuya Cloud. ^[[37m[2/7/2024, 8:49:53 AM] ^[[39m^[[36m[TuyaPlatform]^[[39m [TuyaOpenAPI] Login to: https://openapi.tuyaeu.com ^[[37m[2/7/2024, 8:49:53 AM] ^[[39m^[[36m[TuyaPlatform]^[[39m [TuyaOpenAPI] Request: method = post endpoint = https://openapi.tuyaeu.com path = /v1.0/iot-01/associated-users/actions/authorized-login query = null headers = { "t": "1707292193945", "client_id": "***", "nonce": "c247a08b-afac-4f06-b4d3-bd52ab91be84", "Signature-Headers": "client_id", "sign": "088119C256C15244350F3D5F59DF4A655073554B75A6DDF0EB7CFFD5D33B8A03", "sign_method": "HMAC-SHA256", "access_token": "", "lang": "en", "dev_lang": "javascript", "dev_channel": "homebridge", "devVersion": "1.7.0-beta.52" } body = { "country_code": 420, "username": "czbird77@gmail.com", "password": "5b4ac9d355c33adda90d4bb9b4299d8a", "schema": "tuyaSmart" } ^[[37m[2/7/2024, 8:49:54 AM] ^[[39mHomebridge v1.7.0 (HAP v0.11.1) (TuyaPlatform) is running on port 59004. ^[[37m[2/7/2024, 8:49:54 AM] ^[[39m^[[36m[homebridge-lg-thinq]^[[39m ^[[90m[request] get https://route.lgthinq.com:46030/v1/service/application/gateway-uri^[[39m ^[[37m[2/7/2024, 8:49:54 AM] ^[[39m^[[36m[TuyaPlatform]^[[39m [TuyaOpenAPI] Response: path = /v1.0/iot-01/associated-users/actions/authorized-login data = { "result": { "access_token": "aa300271ae8a22ba7eacee5c7fae015b", "expire_time": 7200, "platform_url": "https://openapi.tuyaeu.com", "refresh_token": "d518f6e1ab605c465da5d6654c0731cc", "uid": "eu1684426507105GX2vl" }, "success": true, "t": 1707292194252, "tid": "7b228750c58d11eea4757ade033758b0" } ^[[37m[2/7/2024, 8:49:54 AM] ^[[39m^[[36m[TuyaPlatform]^[[39m Start MQTT connection. ^[[37m[2/7/2024, 8:49:54 AM] ^[[39m^[[36m[TuyaPlatform]^[[39m Fetching home list.
10:07 -- token expired ???
[37m[2/7/2024, 10:07:57 AM] [39m[36m[TuyaPlatform][39m [TuyaOpenAPI] Request: method = post endpoint = https://openapi.tuyaeu.com path = /v1.0/devices/bfcb30c94d023b1370nx3p/commands query = null headers = { "t": "1707296877266", "client_id": "***", "nonce": "bfc4aad7-64d9-4f42-9f43-626567606b70", "Signature-Headers": "client_id", "sign": "BD9C628F721D70A4C24C6DD202095DD814E148B7EE402CDF267E95EF91ED125B", "sign_method": "HMAC-SHA256", "access_token": "aa300271ae8a22ba7eacee5c7fae015b", "lang": "en", "dev_lang": "javascript", "dev_channel": "homebridge", "devVersion": "1.7.0-beta.52" } body = { "commands": [ { "code": "work_mode", "value": "white" }, { "code": "temp_value", "value": 215 } ] } [37m[2/7/2024, 10:07:57 AM] [39m[36m[TuyaPlatform][39m [TuyaOpenAPI] Response: path = /v1.0/devices/bf6bccd10c189df0a7bcqi/commands data = { "code": 1010, "msg": "token is expired", "success": false, "t": 1707296877368, "tid": "6283d688c59811eea4757ade033758b0" }
10:48 refresh failed -- expired
[37m[2/7/2024, 10:48:54 AM] [39m[36m[TuyaPlatform][39m [TuyaOpenAPI] Refreshing access_token [37m[2/7/2024, 10:48:54 AM] [39m[36m[TuyaPlatform][39m [TuyaOpenAPI] Request: method = get endpoint = https://openapi.tuyaeu.com path = /v1.0/token/d518f6e1ab605c465da5d6654c0731cc query = undefined headers = { "t": "1707299334492", "client_id": "***", "nonce": "9cc549c8-b137-49fb-99c9-7af55b6d1b52", "Signature-Headers": "client_id", "sign": "3390042D11B74DC0604AAE5B044262C80F54B88816E3A5DAAE5C78B91B64B3FB", "sign_method": "HMAC-SHA256", "access_token": "aa300271ae8a22ba7eacee5c7fae015b", "lang": "en", "dev_lang": "javascript", "dev_channel": "homebridge", "devVersion": "1.7.0-beta.52" } body = null [37m[2/7/2024, 10:48:54 AM] [39m[36m[TuyaPlatform][39m [TuyaOpenAPI] Response: path = /v1.0/token/d518f6e1ab605c465da5d6654c0731cc data = { "code": 1010, "msg": "token is expired", "success": false, "t": 1707299334606, "tid": "1b237872c59e11eea80ac21fcdf0c8ac" }
The issue fixed itself after tuya account password was changed. Please close.
Prerequisite
Cache
Version
1.7.0.-beta52
Device Infomation JSON File
No response
Device Control Mode
None
Logs
Other Infomations
Hi, from yesterday, the plugin only works for 2 hours, then it starts getting "token expired" responses from tuya. It does not refresh the token in time, it seems.