tuya / tuya-connect-kit-for-mqtt-embedded-c

Provide core capabilities like device connection, uplink and downlink communication and OTA across platforms and operating systems.
MIT License
64 stars 55 forks source link

Unable to run switch_demo #89

Open nilvng opened 3 years ago

nilvng commented 3 years ago

Hi Tuya team, I have some problem of using the demo. It's said that "MQTT connection failed: 3", more detail about this error can be found in the attached file. Could you please give me a detail instruction on how to run the demo?

debuglog.txt

Origining commented 3 years ago

Hi,nilvng,We checked the problem because the authorization code you downloaded did not configure the cloud access capability. We will fix the problem with the solution configuration as soon as possible. We are very sorry for the inconvenience. I have manually processed the authorization code you are using now. You can try to run the demo again, and communicate with you at any time if you have any questions

nilvng commented 3 years ago

Thank you for your response, the program's working now. But can you show me how to configure Cloud platform so that I can activate the rest of device's IDs? I have already added the product to one of my cloud project, it can be seen in the Devices tab, what else should I do next?

Origining commented 3 years ago

This function is not publicly available now, you need to send me other IDs for configuration,Link SDK is responsible for connecting the device to the Tuya cloud platform. After the device is connected to the cloud platform, you can develop other functions and interact through the DP protocol.

nilvng commented 3 years ago

Problem is that I cannot see the device in my cloud project page so I don't know whether I can custom functions for that product and control it from the app that I may develop using your mobile app SDK?

thecapn32 commented 2 years ago

Hi,nilvng,We checked the problem because the authorization code you downloaded did not configure the cloud access capability. We will fix the problem with the solution configuration as soon as possible. We are very sorry for the inconvenience. I have manually processed the authorization code you are using now. You can try to run the demo again, and communicate with you at any time if you have any questions

I also have this problem how it can be fixed?

Origining commented 2 years ago

How did you get the authorization code? Is the authorization code purchased after choosing the Link SDK development method?

------------------ 原始邮件 ------------------ 发件人: "tuya/tuya-iot-link-sdk-embedded-c" @.>; 发送时间: 2022年7月11日(星期一) 下午5:07 @.>; @.**@.>; 主题: Re: [tuya/tuya-iot-link-sdk-embedded-c] Unable to run switch_demo (#89)

Hi,nilvng,We checked the problem because the authorization code you downloaded did not configure the cloud access capability. We will fix the problem with the solution configuration as soon as possible. We are very sorry for the inconvenience. I have manually processed the authorization code you are using now. You can try to run the demo again, and communicate with you at any time if you have any questions

I also have this problem

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

thecapn32 commented 2 years ago

How did you get the authorization code? Is the authorization code purchased after choosing the Link SDK development method?

I don't know about that. I used this https://github.com/Gitshaoxiang/ESP32-TuyaLink-Relay-CTL and works!

ViktorVerchenko commented 2 years ago

How did you get the authorization code? Is the authorization code purchased after choosing the Link SDK development method? ------------------ 原始邮件 ------------------ 发件人: "tuya/tuya-iot-link-sdk-embedded-c" @.>; 发送时间: 2022年7月11日(星期一) 下午5:07 @.>; @.**@.>; 主题: Re: [tuya/tuya-iot-link-sdk-embedded-c] Unable to run switch_demo (#89) Hi,nilvng,We checked the problem because the authorization code you downloaded did not configure the cloud access capability. We will fix the problem with the solution configuration as soon as possible. We are very sorry for the inconvenience. I have manually processed the authorization code you are using now. You can try to run the demo again, and communicate with you at any time if you have any questions I also have this problem — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

About my project: I've used "switch_demo" sources and compiled it with my own esp32 project (without submodules by tuya). In tuya platform (iot.tuya.com), I've created device based on "TuyaOS" and WBR1 module (PID: 2ukdeznumqeta9wd).

Questions: I have the same issue "Connection not authorized(11)", but I've purchased 2 free licenses for my device. So, if I have free licenses, can I connect my device to European data center or only to the China data center? Is there any lifetime for free license? Is it right created iot project? Long time ago I created iot project based on TuyaLink, but I couldn't connect my device to "Smart Life" app, only to "Smart Industry", but we want to use "Smart Life"

ViktorVerchenko commented 1 year ago

It seems, there were some troubles with key generation. I've created new account and generated new keys there. It's working fine

sjinks commented 1 year ago

Followed instructions from this article but face the same error:

03:32:05 INFO  tuya_iot.c:499: tuya_iot_init
03:32:05 DEBUG tuya_iot.c:516: software_ver:1.0.0
03:32:05 DEBUG tuya_iot.c:517: productkey:mtfsg0kyuvuyeu4b
03:32:05 DEBUG tuya_iot.c:518: uuid:26eeebc3abf1c3da66qqew
03:32:05 DEBUG tuya_iot.c:519: authkey:3a9d850604fb2e07
03:32:05 DEBUG storage_wrapper.c:47: key:region, len:3
03:32:05 WARN  storage_wrapper.c:51: cannot open file
03:32:05 ERROR tuya_endpoint.c:129: local_storage_get region fail:0xffffffff
03:32:05 INFO  tuya_endpoint.c:200: endpoint_mgr.region:
03:32:05 INFO  tuya_endpoint.c:201: endpoint_mgr.regist_key:
03:32:05 INFO  tuya_endpoint.c:171: Environment:pro
03:32:05 INFO  tuya_endpoint.c:181: Host region:AY
03:32:05 DEBUG storage_wrapper.c:47: key:26eeebc3abf1c3da66qqew, len:512
03:32:05 WARN  storage_wrapper.c:51: cannot open file
03:32:05 WARN  tuya_iot.c:93: activate config not found:-1
03:32:05 DEBUG tuya_iot.c:617: STATE_START
03:32:05 INFO  tuya_iot.c:631: Activation data read fail, go activation mode...
03:32:05 DEBUG switch_demo.c:73: Tuya Event ID:1(TUYA_EVENT_BIND_START)
03:32:05 TRACE iotdns.c:145: out post data len:100, data:{"config":[{"key":"httpsSelfUrl","need_ca":true},{"key":"mqttsSelfUrl","need_ca":true}],"env":"pro"}
03:32:05 DEBUG iotdns.c:170: http request send!
03:32:05 DEBUG network_wrapper.c:100: Loading the CA root certificate...
03:32:05 DEBUG network_wrapper.c:108: ok (0 skipped)
03:32:05 DEBUG network_wrapper.c:133: Connecting to h2.iot-dns.com/443...
03:32:05 DEBUG network_wrapper.c:155: ok
03:32:05 DEBUG network_wrapper.c:160: Setting up the SSL/TLS structure...
03:32:05 DEBUG network_wrapper.c:198: SSL state connect: 0 
03:32:05 DEBUG network_wrapper.c:199: Performing the SSL/TLS handshake...
03:32:05 DEBUG network_wrapper.c:216: TLS handshake complete.
03:32:05 DEBUG network_wrapper.c:217: Release CA x509 parse.
03:32:05 DEBUG network_wrapper.c:220: ok
    [ Protocol is TLSv1.2 ]
    [ Ciphersuite is TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256 ]

03:32:05 DEBUG network_wrapper.c:223:     [ Record expansion is 21 ]

03:32:05 DEBUG http_client_wrapper.c:134: tls connencted!
03:32:05 DEBUG http_client_wrapper.c:159: http request send!
03:32:05 DEBUG http_client_wrapper.c:44: HTTP header add key:value
key=Content-Type : value=application/x-www-form-urlencoded;charset=UTF-8
03:32:05 INFO  http_client_wrapper.c:65: Sending HTTP POST request to h2.iot-dns.com/v2/url_config
03:32:05 TRACE http_client_wrapper.c:90: Response Headers:
content-length: 2919
date: Tue, 07 Mar 2023 01:32:05 GMT
content-type: text/plain; charset=utf-8
server: https
Response Status:
200
Response Body:
{"caArr":["MIIHzjCCBrYCCQCMfl925AlBQjANBgkqhkiG9w0BAQsFADCCAqYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMREwDwYDVQQHDAhTYW4gSm9zZTEZMBcGA1UECgwQVHV5YSBHbG9iYWwgSW5jLjEVMBMGA1UEAwwMKi50dXlhY24uY29tMRUwEwYDVQQDDAwqLnR1eWFldS5jb20xFTATBgNVBAMMDCoudHV5YXJmLmNvbTEVMBMGA1UEAwwMKi50dXlhanAuY29tMRUwEwYDVQQDDAwqLnR1eWFpbi5jb20xFTATBgNVBAMMDCoudHV5YWFzLmNvbTEVMBMGA1UEAwwMKi50dXlhYWYuY29tMRUwEwYDVQQDDAwqLnR1eWFzYS5jb20xFDASBgNVBAMMCyoud2dpbmUuY29tMRYwFAYDVQQDDA0qLnR1eWEtaW5jLmNuMRUwEwYDVQQDDAwqLnR1eWF1cy5jb20xEzARBgNVBAMMCioudHV5YS5jb20xDTALBgNVBAsMBFR1eWExITAfBgkqhkiG9w0BCQEWEmlvdF93b3JsZEB0dXlhLmNvbTEVMBMGA1UdEQwMKi50dXlhdXMuY29tMRUwEwYDVR0RDAwqLnR1eWFjbi5jb20xFTATBgNVHREMDCoudHV5YWV1LmNvbTEUMBIGA1UdEQwLKi53Z2luZS5jb20xFjAUBgNVHREMDSoudHV5YS1pbmMuY24xFTATBgNVHREMDCoudHV5YWpwLmNvbTEVMBMGA1UdEQwMKi50dXlhaW4uY29tMRUwEwYDVR0RDAw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ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALac/mvDYSFT9b+fdAOvDbVi3Pbiho3F2ZInVEMUa7tJtxXcc9f3qFivQs6/w/DVHO1DzphOnKLj8bGZ3G4n+XX2qXWiVuk20p5YmWOEbiyiAF7XcQxWlzn/Eg2c5TTcUJGFllRLSaeXDrCox7EEkGZ6Epev+pgmNYzbwRwCkjfHx1sHq7eXLyA/IpZko+3ZD4cccLMqE7adhTj4i9Qne9UOrl9h+lWkdMUKGc0q5zyziWSnr4zQhIobH3INT2Ndrz80czu7IeM5egLeioWoJ6XSVtfkzuOsVVjZl/fOymDkWBKR7K8YXlqHX78KhjrU6AhjbbHdLZ37O0feiRHcZ/kCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEALRRv+amZHP1fAkGXrWItyaxl1ch/GWqMdmwJZRVU1WrCp/Gnhla7Yv8i04T+3FeaAcnN067a9iU+l5OC6HMUUlR2/Wx+dYrpXa5+QcDb+pv3davUko0mfuOZlLwKqKiRFAatapNlh7LhcOfTNzai0VmdqMO1PICS44l1DYFdzY+JFIfpiV6lkDpfyG+hPxnIrBhWgqpuqHuXCMUndB+7N9LloMcCQKoG5DR9ItwOfpf1sGlSC10rt+nDkzq+8Lb/Ry5oUaHY+rHDPIFonnh5ATeF089Jj1Tqo0vvqKPoLxoUQnvVzsGLA10YrkMrpNqyatKrVWZIqGgM2GPGYY8pcA=="],"httpsSelfUrl":{"addr":"https://a2.tuyaeu.com/d.json","ips":["3.125.199.146","3.125.234.101","35.157.101.18"]},"mqttsSelfUrl":{"addr":"m2.tuyaeu.com:8883","ips":["18.184.31.90","3.120.92.134","35.156.44.172"]},"psk_key":"","ttl":600}

03:32:05 TRACE iotdns.c:83: httpsSelfUrl:https://a2.tuyaeu.com/d.json
03:32:05 TRACE iotdns.c:84: mqttsSelfUrl:m2.tuyaeu.com:8883
03:32:05 TRACE iotdns.c:90: endport->atop.host = "a2.tuyaeu.com"
03:32:05 TRACE iotdns.c:91: endport->atop.port = 443
03:32:05 TRACE iotdns.c:92: endport->atop.path = "/d.json"
03:32:05 TRACE iotdns.c:97: endport->mqtt.host = "m2.tuyaeu.com"
03:32:05 TRACE iotdns.c:98: endport->mqtt.port = 8883
03:32:05 INFO  mqtt_service.c:505: clientid:acon_26eeebc3abf1c3da66qqew
03:32:05 INFO  mqtt_service.c:506: username:acon_26eeebc3abf1c3da66qqew
03:32:05 DEBUG mqtt_service.c:507: password:ad46288ceb71342a
03:32:05 INFO  mqtt_service.c:508: topic_in:d/ai/26eeebc3abf1c3da66qqew
03:32:05 INFO  mqtt_service.c:509: topic_out:
03:32:05 INFO  mqtt_service.c:510: tuya_mqtt_start...
03:32:05 DEBUG network_wrapper.c:100: Loading the CA root certificate...
03:32:05 DEBUG network_wrapper.c:108: ok (0 skipped)
03:32:05 DEBUG network_wrapper.c:133: Connecting to m2.tuyaeu.com/8883...
03:32:06 DEBUG network_wrapper.c:155: ok
03:32:06 DEBUG network_wrapper.c:160: Setting up the SSL/TLS structure...
03:32:06 DEBUG network_wrapper.c:198: SSL state connect: 0 
03:32:06 DEBUG network_wrapper.c:199: Performing the SSL/TLS handshake...
03:32:06 DEBUG network_wrapper.c:216: TLS handshake complete.
03:32:06 DEBUG network_wrapper.c:217: Release CA x509 parse.
03:32:06 DEBUG network_wrapper.c:220: ok
    [ Protocol is TLSv1.2 ]
    [ Ciphersuite is TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256 ]

03:32:06 DEBUG network_wrapper.c:223:     [ Record expansion is 29 ]

03:32:06 DEBUG mqtt_client_wrapper.c:169: TLS connected.
03:32:06 ERROR mqtt_client_wrapper.c:189: mqtt connect err: Connection not authorized(11)
03:32:06 ERROR mqtt_service.c:517: MQTT connect fail:3
03:32:06 ERROR mqtt_bind.c:110: tuya mqtt connect fail:-7692, retry..
balint603 commented 11 months ago

Hi @Origining, can you help me please to active my device? ProductID: vt8ritbs6h9wgmbb DeviceID: 265e6c2c5194e5b2camnhd

Thank you!