tuya / tuya-homebridge

Homebridge custom plugin for controlling Powered by Tuya (PBT) devices in HomeKit. This plugin is officially maintained by the Tuya Developer Team.
MIT License
351 stars 179 forks source link

devices not adding #41

Closed tcarr85 closed 3 years ago

tcarr85 commented 3 years ago

I setup the api key and all that in the guide, I see my project is under cloud which is different than the screen shot, i am in us and set my county code to 1, i am not seeing errors, but none of my devices are appearing whilst they are in the cloud dashboard. I am not sure what i am doing incorrectly.

tcarr85 commented 3 years ago

this is actally an error i found ' or 'null'. at TuyaSHOpenAPI._refreshAccessTokenIfNeed (/usr/local/lib/node_modules/homebridge-tuya-platform/lib/tuyashopenapi.js:46:63) at process._tickCallback (internal/process/next_tick.js:68:7) (node:28033) 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(). (rejection id: 1)

Hanh94 commented 3 years ago

Hi @adorabletechguy ,We have known your situation. This problem is generally due to your Access ID and Access Key are expired, please check here. We have also provided a hint for this in the latest version 1.2.1

PNWOregon commented 3 years ago

Im having the exact same issue. Its not throwing any errors, but when the plug in is added I get HB supervisor and it appears to be running in service mode.

Account, passwords, access ID and keys are all correct.

tcarr85 commented 3 years ago

Hi @adorabletechguy ,We have known your situation. This problem is generally due to your Access ID and Access Key are expired, please check here. We have also provided a hint for this in the latest version 1.2.1

You linked me to an issue response to check my credentials, I have checked my credentials, and I can confirm they are correct. I also created a new account to verify, and it still isn't working.

Hanh94 commented 3 years ago

Hi @PNWOregon @adorabletechguy ,Sorry for the bad experience. Please provide the following logs, like this: TuyaOpenAPI request: method = post, endpoint = , path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = {"country_code":86,"username":"","password":"d41d8cd98f00b204e9800998ecf8427e","schema":"tuyaSmart"}, headers = {"t":"1624614126479","client_id":"","nonce":"99a063b1-d599-11eb-8ebc-f1dcfcca1fb9","Signature-Headers":"client_id","sign":"0C22006023F121EAE5C1FB8809A5C1CCD3B101F8DA0BEB50818A4BEC93E9F30B","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} We will quickly locate the problem for you. And we believe this is a relatively easy problem to solve.

tcarr85 commented 3 years ago

Hi @PNWOregon @adorabletechguy ,Sorry for the bad experience. Please provide the following logs, like this: TuyaOpenAPI request: method = post, endpoint = , path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = {"country_code":86,"username":"","password":"d41d8cd98f00b204e9800998ecf8427e","schema":"tuyaSmart"}, headers = {"t":"1624614126479","client_id":"","nonce":"99a063b1-d599-11eb-8ebc-f1dcfcca1fb9","Signature-Headers":"client_id","sign":"0C22006023F121EAE5C1FB8809A5C1CCD3B101F8DA0BEB50818A4BEC93E9F30B","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} We will quickly locate the problem for you. And we believe this is a relatively easy problem to solve.

TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaus.com, path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = {"country_code":1,"username":"****","password":"*****","schema":"tuyaSmart"}, headers = {"t":"1624638139850","client_id":"****","nonce":"8330b2a0-d5d1-11eb-9d4f-013f2b056eff","Signature-Headers":"client_id","sign":"875F825388B227F2ABF377D5DB22C9CCAF71F59E3634E996D54C222BF03D2AE2","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"}

tcarr85 commented 3 years ago

TuyaOpenAPI response: {"code":2406,"msg":"skill id invalid","success":false,"t":1624640281450} path = /v1.0/iot-01/associated-users/actions/authorized-login Please confirm that the Access ID and Access Secret of the Smart Home PaaS project you are using were created after May 25, 2021. Please linked devices by using Tuya Smart or Smart Life app in your cloud project. Failed to get device information. Please check if the config.json is correct.

tcarr85 commented 3 years ago

Any assistance?

Hanh94 commented 3 years ago

Hi @adorabletechguy @PNWOregon ,Sorry for the late reply. Recently, our team has been sorting out interface issues such as code 2406. We will improve the plugin login experience as soon as possible. Hope this doc has been helpful: https://developer.tuya.com/en/docs/iot/Tuya_Homebridge_Plugin?id=Kamcldj76lhzt. Any questions, please contact us.

Hanh94 commented 3 years ago

Hi @adorabletechguy , Please try this https://github.com/tuya/tuya-homebridge/issues/45#issuecomment-871121395

tcarr85 commented 3 years ago

I tried that yesterday, and a few other things. I also recreated a whole new account despite the fact that my other account is a week old. TuyaOpenAPI response: {"code":1004,"msg":"sign invalid","success":false,"t":1625230229901} path = /v1.0/iot-01/associated-users/actions/authorized-login Please confirm that the Access ID and Access Secret of the Smart Home PaaS project you are using were created after May 25, 2021. -- then a few lines below

[7/2/2021, 8:50:31 AM] [TuyaWebPlatform] Missing required id property on device configuration, received: { "device_type": "form" }

tcarr85 commented 3 years ago

i then do a restart

TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaus.com, path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = {"country_code":1,"username":"spazpasz@gmail.com","password":"3b5125607a7f34543c0cb9beffebc1d6","schema":"tuyaSmart"}, headers = {"t":"1625230342093","client_id":"v7jmxdsgapug3m8fhkc8","nonce":"5715f050-db34-11eb-8554-df7330dff46b","Signature-Headers":"client_id","sign":"72AFAB0359F50BB1F5EB7182C733A5DA9A83822175923ED4D5AD114C7945BD84","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"}

PNWOregon commented 3 years ago

Any fix for this yet? No changes with mine.

Hanh94 commented 3 years ago

Hi @adorabletechguy @PNWOregon ,Please try again for code 1004, And check error code for code 2406.

tcarr85 commented 3 years ago

it works, but missing devices

Hanh94 commented 3 years ago

it works, but missing devices

Hi @adorabletechguy , Please show the devices details log.

rikray02 commented 3 years ago

Hi,

I modified TUYASHOPENAPI.JS files with that:
this.tokenInfo = { access_token: 'MY PERSONNAL ACCES TOKEN', refresh_token: '', uid: 'MY PERSONNAL UID', expire: 1653686505, } } async _refreshAccessTokenIfNeed(path) { if (path.startsWith('/v1.0/iot-01/associated-users/actions/authorized-login')) { return; } if ((this.tokenInfo.expire - 60) * 1000 > new Date().getTime()) { return; }

All my credential is correct and i create a new cloud Projet tonight (after 25 may 2021). Now this is the message on my console:

Initializing TuyaPlatform... TuyaOpenAPI request: method = get, endpoint = https://openapi-ueaz.tuyaus.com, path = /v1.0/iot-01/associated-users/devices, params = {"size":100}, body = null, headers = {"t":"1625802078423","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"84d29a60-e067-11eb-a68f-ab56750dda7b","Signature-Headers":"client_id","sign":"MY PERSONNAL CLIENT ID","sign_method":"HMAC-SHA256","access_token":"MY PERSONNAL ACCESS TOKEN","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} Preparing Advertiser for 'Homebridge E1A5' using ciao backend!

TuyaOpenAPI response: {"code":1010,"msg":"token is expired","success":false,"t":1625802078937} path = /v1.0/iot-01/associated-users/devices Failed to get device information. Please check if the config.json is correct.

My JSON config is: { "options": { "username": "riki_raymond@hotmail.com", "password": "MY PASSWORD", "accessId": "gMY ACCESS ID", "accessKey": "MY ACCESS KEY", "lang": "en", "projectType": "2", "appSchema": "tuyaSmart", "endPoint": "https://openapi-ueaz.tuyaus.com", "countryCode": 1, "debug": true }, "name": "TuyaPlatform", "platform": "TuyaPlatform" }

Any suggest???

Hanh94 commented 3 years ago

I modified TUYASHOPENAPI.JS files with that:

Hi @rikray02 ,access_token expires every two hours And need to re-request the token. Please restore the previous code to ensure that the token you are using is not expired. expire is simply an expiration time that determines if a token is to be rerequested.

rikray02 commented 3 years ago

Hi Hanh94,

I have reinstalled the plugin from GitHub source files. I reconfigure the pluggin and now, i have this message:

Initializing TuyaPlatform... TuyaOpenAPI request: method = post, endpoint = https://openapi-ueaz.tuyaus.com, path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = @.**@.>","password":"e8ea5c947c5d8918d13f9404dad3a325","schema":"tuyaSmart"}, headers = {"t":"1625886265876","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"886d2630-e12b-11eb-b0d7-89309f93bae4","Signature-Headers":"client_id","sign":"02D9B4CABBCB3E31B0D15CC506FC7771996EE592FC1FF70A94854487003CEB25","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} Preparing Advertiser for 'Homebridge E1A5' using ciao backend!

And the other one

TuyaOpenAPI response: {"code":1106,"msg":"permission deny","success":false,"t":1625886266467} path = /v1.0/iot-01/associated-users/actions/authorized-login Please confirm that the Access ID and Access Secret of the Smart Home PaaS project you are using were created after May 25, 2021. Please linked devices by using Tuya Smart or Smart Life app in your cloud project.

I really don’t understand why it’s doesn’t work because all my credentials are good.

Thanks for your help. Richard

Le 9 juill. 2021 à 03:06, Hanh94 @.**@.>> a écrit :

I modified TUYASHOPENAPI.JS files with that:

Hi @rikray02https://github.com/rikray02 ,access_token expires every two hours And need to re-request the token. Please restore the previous code to ensure that the token you are using is not expired. expire is simply an expiration time that determines if a token is to be rerequested.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tuya/tuya-homebridge/issues/41#issuecomment-876966200, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKFTTIO3MARPM5OYUF3VENLTW2NYBANCNFSM47EEXRQA.

Hanh94 commented 3 years ago

Hi Hanh94, I have reinstalled the plugin from GitHub source files. I reconfigure the pluggin and now, i have this message: Initializing TuyaPlatform... TuyaOpenAPI request: method = post, endpoint = https://openapi-ueaz.tuyaus.com, path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = @.**@.>","password":"e8ea5c947c5d8918d13f9404dad3a325","schema":"tuyaSmart"}, headers = {"t":"1625886265876","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"886d2630-e12b-11eb-b0d7-89309f93bae4","Signature-Headers":"client_id","sign":"02D9B4CABBCB3E31B0D15CC506FC7771996EE592FC1FF70A94854487003CEB25","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} Preparing Advertiser for 'Homebridge E1A5' using ciao backend! And the other one TuyaOpenAPI response: {"code":1106,"msg":"permission deny","success":false,"t":1625886266467} path = /v1.0/iot-01/associated-users/actions/authorized-login Please confirm that the Access ID and Access Secret of the Smart Home PaaS project you are using were created after May 25, 2021. Please linked devices by using Tuya Smart or Smart Life app in your cloud project. I really don’t understand why it’s doesn’t work because all my credentials are good. Thanks for your help. Richard Le 9 juill. 2021 à 03:06, Hanh94 @.**@.>> a écrit : I modified TUYASHOPENAPI.JS files with that: Hi @rikray02https://github.com/rikray02 ,access_token expires every two hours And need to re-request the token. Please restore the previous code to ensure that the token you are using is not expired. expire is simply an expiration time that determines if a token is to be rerequested. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub<#41 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKFTTIO3MARPM5OYUF3VENLTW2NYBANCNFSM47EEXRQA.

Hi @rikray02 , Please make sure your EndPoint is right, we found in your app login request log, your account should be in the US, the EndPoint should be https://openapi.tuyaus.com. Please try again.

rikray02 commented 3 years ago

Hi Hanh94,

After many unsuccessful attempts, multiple tests and updates, post on the forums, finally, as you can see, tonight it finally works. Thanks for your help.

Now, what happens after one year of TRIAL subscription? Will i need to create a new account with an other email address or it will be possible ton renew a TRIAL subscription?

FIRST MESSAGE _TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaus.com/, path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = {"country_code":1,"username":"riki_raymond@hotmail.com","password":"e8ea5c947c5d8918d13f9404dad3a325","schema":"tuyaSmart"}, headers = {"t":"1626145707739","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"75CEE5838AE3836FBBC542C827305C43E85F2B90001DA9ADFEEA35E6FE30A36D","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","devchannel":"homebridge","devVersion":"1.2.1"} Preparing Advertiser for 'Homebridge E1A5' using ciao backend!

SECOND MESSAGE _TuyaOpenAPI response: {"result":{"access_token":"6cc8680374cf1e7b9b741287d7464995","expire_time":7200,"refresh_token":"cb7d05b882c947a19d4c27aea864923a","uid":"az1617674687208pNBk1"},"success":true,"t":1626145708499} path = /v1.0/iot-01/associated-users/actions/authorized-login TuyaOpenAPI request: method = get, endpoint = https://openapi.tuyaus.com/, path = /v1.0/iot-01/associated-users/devices, params = {"size":100}, body = null, headers = {"t":"1626145708475","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"EBEE3BACC81009552D427F3E004661DA72F87609A06DFF70778AC53706401A4B","sign_method":"HMAC-SHA256","access_token":"6cc8680374cf1e7b9b741287d7464995","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} TuyaOpenAPI response: {"result":{"devices":[{"active_time":1617729180,"biz_type":0,"category":"dj","create_time":1617729180,"icon":"smart/icon/ay15281362075689iOHb/6cf097bb1c19e5def187f2c9d2c66980.png","id":"50727542d8bfc0019a9c","ip":"38.108.91.201","lat":"46.84648321679609","local_key":"2a496b427c033783","lon":"-71.34424597752781","name":"34202 - V2 Rik","online":true,"owner_id":"38621992","product_id":"pu4xpsh4drb0qamb","product_name":"34202 - V2","status":[{"code":"switch_led","value":false},{"code":"work_mode","value":"white"},{"code":"bright_value_v2","value":790},{"code":"temp_value_v2","value":1000},{"code":"colour_data_v2","value":"{\"h\":0,\"s\":0,\"v\":1000}"},{"code":"scene_data_v2","value":"{\"scene_num\":1,\"scene_units\":[{\"bright\":0,\"h\":12,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":50,\"unit_switch_duration\":50,\"v\":1000},{\"bright\":0,\"h\":23,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":50,\"unit_switch_duration\":50,\"v\":1000},{\"bright\":0,\"h\":33,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":50,\"unit_switch_duration\":50,\"v\":1000},{\"bright\":0,\"h\":39,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":50,\"unit_switch_duration\":50,\"v\":1000},{\"bright\":0,\"h\":51,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":50,\"unit_switch_duration\":50,\"v\":1000},{\"bright\":0,\"h\":39,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":50,\"unit_switch_duration\":50,\"v\":1000},{\"bright\":0,\"h\":23,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":50,\"unit_switch_duration\":50,\"v\":1000}]}"},{"code":"countdown_1","value":0},{"code":"control_data","value":""}],"sub":false,"time_zone":"-05:00","uid":"az1617674687208pNBk1","update_time":1626115159,"uuid":"50727542d8bfc0019a9c"},{"active_time":1617675866,"biz_type":0,"category":"dj","create_time":1617651960,"icon":"smart/icon/ay15281362075689iOHb/6cf097bb1c19e5def187f2c9d2c66980.png","id":"075710082cf4328055fe","ip":"38.108.91.201","lat":"46.84648321679609","local_key":"c008e57cbb909e3e","lon":"-71.34424597752781","name":"Portiques","online":false,"owner_id":"38621992","product_id":"pu4xpsh4drb0qamb","product_name":"34202 - V2","status":[{"code":"switch_led","value":true},{"code":"work_mode","value":"colour"},{"code":"bright_value_v2","value":1000},{"code":"temp_value_v2","value":1000},{"code":"colour_data_v2","value":"{\"h\":0,\"s\":750,\"v\":1000}"},{"code":"scene_data_v2","value":"{\"scene_num\":1,\"scene_units\":[{\"bright\":0,\"h\":358,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":55,\"unit_switch_duration\":55,\"v\":1000},{\"bright\":0,\"h\":14,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":55,\"unit_switch_duration\":55,\"v\":1000},{\"bright\":0,\"h\":35,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":55,\"unit_switch_duration\":55,\"v\":1000},{\"bright\":0,\"h\":48,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":55,\"unit_switch_duration\":55,\"v\":1000},{\"bright\":0,\"h\":62,\"s\":1000,\"temperature\":0,\"unit_change_mode\":\"gradient\",\"unit_gradient_duration\":55,\"unit_switch_duration\":55,\"v\":1000}]}"},{"code":"countdown_1","value":0},{"code":"control_data","value":""}],"sub":false,"time_zone":"-05:00","uid":"az1617674687208pNBk1","update_time":1625859090,"uuid":"075710082cf4328055fe"}],"has_more":false,"last_row_key":"E2DBF15694DB77735FAF097C9B410C8A","total":2},"success":true,"t":1626145708938} path = /v1.0/iot-01/associated-users/devices TuyaOpenAPI request: method = get, endpoint = https://openapi.tuyaus.com/, path = /v1.0/devices/functions, params = {"device_ids":"50727542d8bfc0019a9c,075710082cf4328055fe"}, body = null, headers = {"t":"1626145708917","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"DDB2C1248D1AC17AA82AC8AAB825EB67C76E8866274C75F6C4916E981923508F","sign_method":"HMAC-SHA256","access_token":"6cc8680374cf1e7b9b741287d7464995","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} TuyaOpenAPI response: {"result":[{"category":"dj","devices":["50727542d8bfc0019a9c","075710082cf4328055fe"],"functions":[{"code":"switch_led","desc":"switch led","name":"switch led","type":"Boolean","values":"{}"},{"code":"work_mode","desc":"work mode","name":"work mode","type":"Enum","values":"{\"range\":[\"white\",\"colour\",\"scene\",\"music\"]}"},{"code":"bright_value_v2","desc":"bright value v2","name":"bright value v2","type":"Integer","values":"{\"min\":10,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}"},{"code":"temp_value_v2","desc":"temp value v2","name":"temp value v2","type":"Integer","values":"{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}"},{"code":"colour_data_v2","desc":"colour data v2","name":"colour data v2","type":"Json","values":"{}"},{"code":"scene_data_v2","desc":"scene data v2","name":"scene data v2","type":"Json","values":"{}"},{"code":"countdown_1","desc":"countdown 1","name":"countdown 1","type":"Integer","values":"{\"unit\":\"\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"},{"code":"control_data","desc":"control data","name":"control data","type":"Json","values":"{}"}],"product_id":"pu4xpsh4drb0qamb"}],"success":true,"t":1626145709370} path = /v1.0/devices/functions Adding: 34202 - V2 Rik (dj / 50727542d8bfc0019a9c) Creating New Accessory 50727542d8bfc0019a9c Register Platform Accessory 34202 - V2 Rik Adding: Portiques (dj / 075710082cf4328055fe) Creating New Accessory 075710082cf4328055fe Register Platform Accessory Portiques TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaus.com/, path = /v1.0/iot-03/open-hub/access-config, params = null, body = {"uid":"az1617674687208pNBk1","link_id":"97ec7bc0-e387-11eb-84bd-4be76a16232d","link_type":"mqtt","topics":"device","msg_encrypted_version":"1.0"}, headers = {"t":"1626145709376","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"93D8A07487B7B16B3B44EBD0F7B824BBA4F0AF240A0C08AD6A73D27CE37CBF44","sign_method":"HMAC-SHA256","access_token":"6cc8680374cf1e7b9b741287d7464995","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} TuyaOpenAPI response: {"result":{"client_id":"cloud_6eb129881f86931204bd850a07e33749","expire_time":7200,"password":"2720710e58675a1bf019bded6e4ee096","sink_topic":{"device":"cloud/token/out/{device_id}"},"source_topic":{"device":"cloud/token/in/16c7ef6f740ee6d580604babc6b01cc0"},"url":"ssl://m1.tuyaus.com:8883","username":"cloud16c7ef6f740ee6d580604babc6b01cc0"},"success":true,"t":1626145709824} path = /v1.0/iot-03/open-hub/access-config TuyaOpenMQ connecting: ssl://m1.tuyaus.com:8883 TuyaOpenMQ connected

Hanh94 commented 3 years ago

Hi Hanh94,

After many unsuccessful attempts, multiple tests and updates, post on the forums, finally, as you can see, tonight it finally works. Thanks for your help.

Now, what happens after one year of TRIAL subscription? Will i need to create a new account with an other email address or it will be possible ton renew a TRIAL subscription?

FIRST MESSAGE _TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaus.com/, path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = {"country_code":1,"username":"riki_raymond@hotmail.com","password":"e8ea5c947c5d8918d13f9404dad3a325","schema":"tuyaSmart"}, headers = {"t":"1626145707739","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"75CEE5838AE3836FBBC542C827305C43E85F2B90001DA9ADFEEA35E6FE30A36D","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","devchannel":"homebridge","devVersion":"1.2.1"} Preparing Advertiser for 'Homebridge E1A5' using ciao backend!

SECOND MESSAGE _TuyaOpenAPI response: {"result":{"access_token":"6cc8680374cf1e7b9b741287d7464995","expire_time":7200,"refresh_token":"cb7d05b882c947a19d4c27aea864923a","uid":"az1617674687208pNBk1"},"success":true,"t":1626145708499} path = /v1.0/iot-01/associated-users/actions/authorized-login TuyaOpenAPI request: method = get, endpoint = https://openapi.tuyaus.com/, path = /v1.0/iot-01/associated-users/devices, params = {"size":100}, body = null, headers = {"t":"1626145708475","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"EBEE3BACC81009552D427F3E004661DA72F87609A06DFF70778AC53706401A4B","sign_method":"HMAC-SHA256","access_token":"6cc8680374cf1e7b9b741287d7464995","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} TuyaOpenAPI response: {"result":{"devices":[{"active_time":1617729180,"biz_type":0,"category":"dj","create_time":1617729180,"icon":"smart/icon/ay15281362075689iOHb/6cf097bb1c19e5def187f2c9d2c66980.png","id":"50727542d8bfc0019a9c","ip":"38.108.91.201","lat":"46.84648321679609","local_key":"2a496b427c033783","lon":"-71.34424597752781","name":"34202 - V2 Rik","online":true,"owner_id":"38621992","product_id":"pu4xpsh4drb0qamb","product_name":"34202 - V2","status":[{"code":"switch_led","value":false},{"code":"work_mode","value":"white"},{"code":"bright_value_v2","value":790},{"code":"temp_value_v2","value":1000},{"code":"colour_data_v2","value":"{"h":0,"s":0,"v":1000}"},{"code":"scene_data_v2","value":"{"scene_num":1,"scene_units":[{"bright":0,"h":12,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":23,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":33,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":39,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":51,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":39,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":23,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000}]}"},{"code":"countdown_1","value":0},{"code":"control_data","value":""}],"sub":false,"time_zone":"-05:00","uid":"az1617674687208pNBk1","update_time":1626115159,"uuid":"50727542d8bfc0019a9c"},{"active_time":1617675866,"biz_type":0,"category":"dj","create_time":1617651960,"icon":"smart/icon/ay15281362075689iOHb/6cf097bb1c19e5def187f2c9d2c66980.png","id":"075710082cf4328055fe","ip":"38.108.91.201","lat":"46.84648321679609","local_key":"c008e57cbb909e3e","lon":"-71.34424597752781","name":"Portiques","online":false,"owner_id":"38621992","product_id":"pu4xpsh4drb0qamb","product_name":"34202 - V2","status":[{"code":"switch_led","value":true},{"code":"work_mode","value":"colour"},{"code":"bright_value_v2","value":1000},{"code":"temp_value_v2","value":1000},{"code":"colour_data_v2","value":"{"h":0,"s":750,"v":1000}"},{"code":"scene_data_v2","value":"{"scene_num":1,"scene_units":[{"bright":0,"h":358,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":55,"unit_switch_duration":55,"v":1000},{"bright":0,"h":14,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":55,"unit_switch_duration":55,"v":1000},{"bright":0,"h":35,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":55,"unit_switch_duration":55,"v":1000},{"bright":0,"h":48,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":55,"unit_switch_duration":55,"v":1000},{"bright":0,"h":62,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":55,"unit_switch_duration":55,"v":1000}]}"},{"code":"countdown_1","value":0},{"code":"control_data","value":""}],"sub":false,"time_zone":"-05:00","uid":"az1617674687208pNBk1","update_time":1625859090,"uuid":"075710082cf4328055fe"}],"has_more":false,"last_row_key":"E2DBF15694DB77735FAF097C9B410C8A","total":2},"success":true,"t":1626145708938} path = /v1.0/iot-01/associated-users/devices TuyaOpenAPI request: method = get, endpoint = https://openapi.tuyaus.com/, path = /v1.0/devices/functions, params = {"device_ids":"50727542d8bfc0019a9c,075710082cf4328055fe"}, body = null, headers = {"t":"1626145708917","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"DDB2C1248D1AC17AA82AC8AAB825EB67C76E8866274C75F6C4916E981923508F","sign_method":"HMAC-SHA256","access_token":"6cc8680374cf1e7b9b741287d7464995","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} TuyaOpenAPI response: {"result":[{"category":"dj","devices":["50727542d8bfc0019a9c","075710082cf4328055fe"],"functions":[{"code":"switch_led","desc":"switch led","name":"switch led","type":"Boolean","values":"{}"},{"code":"work_mode","desc":"work mode","name":"work mode","type":"Enum","values":"{"range":["white","colour","scene","music"]}"},{"code":"bright_value_v2","desc":"bright value v2","name":"bright value v2","type":"Integer","values":"{"min":10,"scale":0,"unit":"","max":1000,"step":1}"},{"code":"temp_value_v2","desc":"temp value v2","name":"temp value v2","type":"Integer","values":"{"min":0,"scale":0,"unit":"","max":1000,"step":1}"},{"code":"colour_data_v2","desc":"colour data v2","name":"colour data v2","type":"Json","values":"{}"},{"code":"scene_data_v2","desc":"scene data v2","name":"scene data v2","type":"Json","values":"{}"},{"code":"countdown_1","desc":"countdown 1","name":"countdown 1","type":"Integer","values":"{"unit":"","min":0,"max":86400,"scale":0,"step":1}"},{"code":"control_data","desc":"control data","name":"control data","type":"Json","values":"{}"}],"product_id":"pu4xpsh4drb0qamb"}],"success":true,"t":1626145709370} path = /v1.0/devices/functions Adding: 34202 - V2 Rik (dj / 50727542d8bfc0019a9c) Creating New Accessory 50727542d8bfc0019a9c Register Platform Accessory 34202 - V2 Rik Adding: Portiques (dj / 075710082cf4328055fe) Creating New Accessory 075710082cf4328055fe Register Platform Accessory Portiques TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaus.com/, path = /v1.0/iot-03/open-hub/access-config, params = null, body = {"uid":"az1617674687208pNBk1","link_id":"97ec7bc0-e387-11eb-84bd-4be76a16232d","link_type":"mqtt","topics":"device","msg_encrypted_version":"1.0"}, headers = {"t":"1626145709376","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"93D8A07487B7B16B3B44EBD0F7B824BBA4F0AF240A0C08AD6A73D27CE37CBF44","sign_method":"HMAC-SHA256","access_token":"6cc8680374cf1e7b9b741287d7464995","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} TuyaOpenAPI response: {"result":{"client_id":"cloud_6eb129881f86931204bd850a07e33749","expire_time":7200,"password":"2720710e58675a1bf019bded6e4ee096","sink_topic":{"device":"cloud/token/out/{device_id}"},"source_topic":{"device":"cloud/token/in/16c7ef6f740ee6d580604babc6b01cc0"},"url":"ssl://m1.tuyaus.com:8883","username":"cloud16c7ef6f740ee6d580604babc6b01cc0"},"success":true,"t":1626145709824} path = /v1.0/iot-03/open-hub/access-config TuyaOpenMQ connecting: ssl://m1.tuyaus.com:8883 TuyaOpenMQ connected

Hi @rikray02 , glad to hear that. The login steps for the plug-in are not very complicated, Correct username and password, non-expired accessid and key, and correct endpoint. Of course we will optimize the configuration in config.json, such that the endpoint will no longer be manually typed, etc, and will be supported soon. About subscription: After expiration, you can renew the subscription for free. The Trial Edition allows you to use all free API products but puts limits on the quota of API calls. For more information about the quota, see Pricing.

PNWOregon commented 3 years ago

Hi Hanh94,

After many unsuccessful attempts, multiple tests and updates, post on the forums, finally, as you can see, tonight it finally works. Thanks for your help.

Now, what happens after one year of TRIAL subscription? Will i need to create a new account with an other email address or it will be possible ton renew a TRIAL subscription?

FIRST MESSAGE _TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaus.com/, path = /v1.0/iot-01/associated-users/actions/authorized-login, params = null, body = {"country_code":1,"username":"riki_raymond@hotmail.com","password":"e8ea5c947c5d8918d13f9404dad3a325","schema":"tuyaSmart"}, headers = {"t":"1626145707739","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"75CEE5838AE3836FBBC542C827305C43E85F2B90001DA9ADFEEA35E6FE30A36D","sign_method":"HMAC-SHA256","access_token":"","lang":"en","dev_lang":"javascript","devchannel":"homebridge","devVersion":"1.2.1"} Preparing Advertiser for 'Homebridge E1A5' using ciao backend!

SECOND MESSAGE _TuyaOpenAPI response: {"result":{"access_token":"6cc8680374cf1e7b9b741287d7464995","expire_time":7200,"refresh_token":"cb7d05b882c947a19d4c27aea864923a","uid":"az1617674687208pNBk1"},"success":true,"t":1626145708499} path = /v1.0/iot-01/associated-users/actions/authorized-login TuyaOpenAPI request: method = get, endpoint = https://openapi.tuyaus.com/, path = /v1.0/iot-01/associated-users/devices, params = {"size":100}, body = null, headers = {"t":"1626145708475","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"EBEE3BACC81009552D427F3E004661DA72F87609A06DFF70778AC53706401A4B","sign_method":"HMAC-SHA256","access_token":"6cc8680374cf1e7b9b741287d7464995","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} TuyaOpenAPI response: {"result":{"devices":[{"active_time":1617729180,"biz_type":0,"category":"dj","create_time":1617729180,"icon":"smart/icon/ay15281362075689iOHb/6cf097bb1c19e5def187f2c9d2c66980.png","id":"50727542d8bfc0019a9c","ip":"38.108.91.201","lat":"46.84648321679609","local_key":"2a496b427c033783","lon":"-71.34424597752781","name":"34202 - V2 Rik","online":true,"owner_id":"38621992","product_id":"pu4xpsh4drb0qamb","product_name":"34202 - V2","status":[{"code":"switch_led","value":false},{"code":"work_mode","value":"white"},{"code":"bright_value_v2","value":790},{"code":"temp_value_v2","value":1000},{"code":"colour_data_v2","value":"{"h":0,"s":0,"v":1000}"},{"code":"scene_data_v2","value":"{"scene_num":1,"scene_units":[{"bright":0,"h":12,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":23,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":33,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":39,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":51,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":39,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000},{"bright":0,"h":23,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":50,"unit_switch_duration":50,"v":1000}]}"},{"code":"countdown_1","value":0},{"code":"control_data","value":""}],"sub":false,"time_zone":"-05:00","uid":"az1617674687208pNBk1","update_time":1626115159,"uuid":"50727542d8bfc0019a9c"},{"active_time":1617675866,"biz_type":0,"category":"dj","create_time":1617651960,"icon":"smart/icon/ay15281362075689iOHb/6cf097bb1c19e5def187f2c9d2c66980.png","id":"075710082cf4328055fe","ip":"38.108.91.201","lat":"46.84648321679609","local_key":"c008e57cbb909e3e","lon":"-71.34424597752781","name":"Portiques","online":false,"owner_id":"38621992","product_id":"pu4xpsh4drb0qamb","product_name":"34202 - V2","status":[{"code":"switch_led","value":true},{"code":"work_mode","value":"colour"},{"code":"bright_value_v2","value":1000},{"code":"temp_value_v2","value":1000},{"code":"colour_data_v2","value":"{"h":0,"s":750,"v":1000}"},{"code":"scene_data_v2","value":"{"scene_num":1,"scene_units":[{"bright":0,"h":358,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":55,"unit_switch_duration":55,"v":1000},{"bright":0,"h":14,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":55,"unit_switch_duration":55,"v":1000},{"bright":0,"h":35,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":55,"unit_switch_duration":55,"v":1000},{"bright":0,"h":48,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":55,"unit_switch_duration":55,"v":1000},{"bright":0,"h":62,"s":1000,"temperature":0,"unit_change_mode":"gradient","unit_gradient_duration":55,"unit_switch_duration":55,"v":1000}]}"},{"code":"countdown_1","value":0},{"code":"control_data","value":""}],"sub":false,"time_zone":"-05:00","uid":"az1617674687208pNBk1","update_time":1625859090,"uuid":"075710082cf4328055fe"}],"has_more":false,"last_row_key":"E2DBF15694DB77735FAF097C9B410C8A","total":2},"success":true,"t":1626145708938} path = /v1.0/iot-01/associated-users/devices TuyaOpenAPI request: method = get, endpoint = https://openapi.tuyaus.com/, path = /v1.0/devices/functions, params = {"device_ids":"50727542d8bfc0019a9c,075710082cf4328055fe"}, body = null, headers = {"t":"1626145708917","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"DDB2C1248D1AC17AA82AC8AAB825EB67C76E8866274C75F6C4916E981923508F","sign_method":"HMAC-SHA256","access_token":"6cc8680374cf1e7b9b741287d7464995","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} TuyaOpenAPI response: {"result":[{"category":"dj","devices":["50727542d8bfc0019a9c","075710082cf4328055fe"],"functions":[{"code":"switch_led","desc":"switch led","name":"switch led","type":"Boolean","values":"{}"},{"code":"work_mode","desc":"work mode","name":"work mode","type":"Enum","values":"{"range":["white","colour","scene","music"]}"},{"code":"bright_value_v2","desc":"bright value v2","name":"bright value v2","type":"Integer","values":"{"min":10,"scale":0,"unit":"","max":1000,"step":1}"},{"code":"temp_value_v2","desc":"temp value v2","name":"temp value v2","type":"Integer","values":"{"min":0,"scale":0,"unit":"","max":1000,"step":1}"},{"code":"colour_data_v2","desc":"colour data v2","name":"colour data v2","type":"Json","values":"{}"},{"code":"scene_data_v2","desc":"scene data v2","name":"scene data v2","type":"Json","values":"{}"},{"code":"countdown_1","desc":"countdown 1","name":"countdown 1","type":"Integer","values":"{"unit":"","min":0,"max":86400,"scale":0,"step":1}"},{"code":"control_data","desc":"control data","name":"control data","type":"Json","values":"{}"}],"product_id":"pu4xpsh4drb0qamb"}],"success":true,"t":1626145709370} path = /v1.0/devices/functions Adding: 34202 - V2 Rik (dj / 50727542d8bfc0019a9c) Creating New Accessory 50727542d8bfc0019a9c Register Platform Accessory 34202 - V2 Rik Adding: Portiques (dj / 075710082cf4328055fe) Creating New Accessory 075710082cf4328055fe Register Platform Accessory Portiques TuyaOpenAPI request: method = post, endpoint = https://openapi.tuyaus.com/, path = /v1.0/iot-03/open-hub/access-config, params = null, body = {"uid":"az1617674687208pNBk1","link_id":"97ec7bc0-e387-11eb-84bd-4be76a16232d","link_type":"mqtt","topics":"device","msg_encrypted_version":"1.0"}, headers = {"t":"1626145709376","client_id":"gsr393rvaqjlhzmjhrh7","nonce":"97e24290-e387-11eb-84bd-4be76a16232d","Signature-Headers":"client_id","sign":"93D8A07487B7B16B3B44EBD0F7B824BBA4F0AF240A0C08AD6A73D27CE37CBF44","sign_method":"HMAC-SHA256","access_token":"6cc8680374cf1e7b9b741287d7464995","lang":"en","dev_lang":"javascript","dev_channel":"homebridge","devVersion":"1.2.1"} TuyaOpenAPI response: {"result":{"client_id":"cloud_6eb129881f86931204bd850a07e33749","expire_time":7200,"password":"2720710e58675a1bf019bded6e4ee096","sink_topic":{"device":"cloud/token/out/{device_id}"},"source_topic":{"device":"cloud/token/in/16c7ef6f740ee6d580604babc6b01cc0"},"url":"ssl://m1.tuyaus.com:8883","username":"cloud16c7ef6f740ee6d580604babc6b01cc0"},"success":true,"t":1626145709824} path = /v1.0/iot-03/open-hub/access-config TuyaOpenMQ connecting: ssl://m1.tuyaus.com:8883 TuyaOpenMQ connected

Glad to hear you got it up and running! What was the trick? I haven’t time lately to tinker with mine, but I’m planning on it later this week.

PNWOregon commented 3 years ago

Not sure what changed honestly, but it was an easy setup today without any issues. Thanks for your help @Hanh94!

Hanh94 commented 3 years ago

it works, but missing devices

Hi @adorabletechguy , Have you solved the problem you encountered? If not, please submit the relevant log information according to the issue template format.

Hanh94 commented 3 years ago

Hi guys, Since we haven't received your reply for a long time, we think our latest version should have solved your problem. We will close this issue first. If there is any problem, you can contact us at any time.