[已解决]mbedtls_ssl_handshake错误导致添加设备失败
设备已经成功完成了配网过程并获取了IP,但在接下来的激活过程中报 mbedtls_ssl_handshake returned 7200 -29184 这个错误,并不断重试,最终导致添加设备失败。MBEDTLS_SSL_MAX_CONTENT_LEN 为 16384,有尝试过将tuya_iot_config.h中的OPERATING_SYSTEM设置为101以保证其他头文件中该值均为最大,但结果一样。有尝试更换UUID和秘钥,但结果一样。
以下为获取IP后的部分log:
Code: Select all
I (17627) tcpip_adapter: sta ip: 192.168.31.52, mask: 255.255.255.0, gw: 192.168.31.1
I (17627) wifi station: Got IP:192.168.31.52
I (17951) wifi: Set ps type: 1
[01-01 18:12:31 TUYA D][tuya_tls.c:319] load tls_ca_cnt fail. no ca in local db
[01-01 18:12:31 TUYA D][iot_httpc.c:1179] http_iot_dns_get_cloud_url start
[01-01 18:12:31 TUYA D][iot_httpc.c:1204] sign_buffer:env=3WFj®ion=AY&ts=16&uuid=uuid3d52871c9ec1b1f3
[01-01 18:12:31 TUYA D][iot_httpc.c:1212] sign_base64_encode:ddI7jjpLitE6tEgIBxA3qp/Fxu/mx4wk6MyLU5+RrtA=
[01-01 18:12:31 TUYA D][uni_network.c:417] set_dns_region:1
[01-01 18:12:31 TUYA D][iot_httpc.c:1283] http_dns send: {"region":"AY","env":"3WFj","uuid":"xxxxxxxxxxx","ts":16,"sign":"ddI7jjpLitE6tEgIBxA3qp/Fxu/mx4wk6MyLU5+RrtA=","config":[{"key":"httpUrl","need_ca":false},{"key":"mqttUrl","need_ca":false},{"key":"httpsSelfUrl","need_ca":true},{"key":"mqttsSelfUrl","need_ca":true}]}
[01-01 18:12:31 TUYA D][iot_httpc.c:1288] get url config:https://h2.iot-dns.com/v2/url_config
[01-01 18:12:31 TUYA D][tuya_tls.c:376] tls register constant xxxxxxx xxxxxxx
[01-01 18:12:31 TUYA D][httpc.c:813] Connect: h2.iot-dns.com Port: 443 -->>
[01-01 18:12:31 TUYA D][uni_network.c:314] unw_gethostbyname h2.iot-dns.com, prio 2
[01-01 18:12:31 TUYA D][uni_network.c:365] use system dns ip 42.192.31.222 for domain h2.iot-dns.com
[01-01 18:12:31 TUYA D][uni_network.c:268] cache dns [h2.iot-dns.com]<->[42.192.31.222]
[01-01 18:12:31 TUYA D][httpc.c:477] ----got ipaddr:42,192,31,222
[01-01 18:12:31 TUYA D][httpc.c:815] Connect: h2.iot-dns.com Port: 443 --<< ,r:0
[01-01 18:12:31 TUYA D][tuya_tls.c:1269] ----enable_cert:1,DEFAULT_LOAD_CERT:1
[01-01 18:12:31 TUYA D][tuya_tls.c:1312] TUYA_TLS Begin Connect h2.iot-dns.com:443 CustomNet:TRUE Enable_Cert:TRUE Default:TRUE
[01-01 18:12:31 TUYA D][tuya_tls.c:1387] load tuya cert.
[01-01 18:12:31 TUYA D][tuya_iot_com_api.c:271] tuya iot dns
[01-01 18:12:31 TUYA D][tuya_tls.c:1503] socket fd is set. set to inner send/recv to handshake
[01-01 18:12:31 TUYA D][tuya_tls.c:1519] tls handshake ret:0x7200, flags:0
[01-01 18:12:31 TUYA E][tuya_tls.c:1541] mbedtls_ssl_handshake returned 7200 -29184
[01-01 18:12:31 TUYA D][tuya_tls.c:1643] TUYA_TLS Disconnect ENTER
[01-01 18:12:31 TUYA D][tuya_tls.c:1698] TUYA_TLS Disconnect Success
[01-01 18:12:31 TUYA E][http_inf.c:51] Open session failed: https://h2.iot-dns.com/v2/url_config (-8)
[01-01 18:12:31 TUYA E][iot_httpc.c:1299] fail to get cloud url -2050
[01-01 18:12:32 TUYA D][tuya_iot_wifi_api.c:381] wifi netstat changed to:6 -->>
[01-01 18:12:32 TUYA N][tuya_device.c:439] wf_nw_status_cb, wifi_status:6
[01-01 18:12:32 TUYA D][tuya_iot_wifi_api.c:384] wifi netstat changed to:6 <<--
[01-01 18:12:32 TUYA D][app_agent.c:698] udp ip: 192.168.31.52
[01-01 18:12:32 TUYA D][tuya_tls.c:319] load tls_ca_cnt fail. no ca in local db
[01-01 18:12:32 TUYA D][iot_httpc.c:1179] http_iot_dns_get_cloud_url start
[01-01 18:12:32 TUYA D][iot_httpc.c:1204] sign_buffer:env=3WFj®ion=AY&ts=17&uuid=xxxxxxx
[01-01 18:12:32 TUYA D][iot_httpc.c:1212] sign_base64_encode:J/25ln6ySrlJd6DyGF7fcTljJjH+uWMh4Efs9hGhHYw=
[01-01 18:12:32 TUYA D][uni_network.c:417] set_dns_region:1
[01-01 18:12:32 TUYA D][iot_httpc.c:1283] http_dns send: {"region":"AY","env":"3WFj","uuid":"uuid3d52871c9ec1b1f3","ts":17,"sign":"J/25ln6ySrlJd6DyGF7fcTljJjH+uWMh4Efs9hGhHYw=","config":[{"key":"httpUrl","need_ca":false},{"key":"mqttUrl","need_ca":false},{"key":"httpsSelfUrl","need_ca":true},{"key":"mqttsSelfUrl","need_ca":true}]}
[01-01 18:12:32 TUYA D][iot_httpc.c:1288] get url config:https://h2.iot-dns.com/v2/url_config
[01-01 18:12:32 TUYA D][tuya_tls.c:376] tls register constant xxxxx xxxx
[01-01 18:12:32 TUYA D][httpc.c:813] Connect: h2.iot-dns.com Port: 443 -->>
[01-01 18:12:32 TUYA D][uni_network.c:314] unw_gethostbyname h2.iot-dns.com, prio 2
[01-01 18:12:32 TUYA D][uni_network.c:353] use dynamic dns ip:42.192.31.222 for domain:h2.iot-dns.com
[01-01 18:12:32 TUYA D][httpc.c:477] ----got ipaddr:42,192,31,222
[01-01 18:12:32 TUYA D][httpc.c:815] Connect: h2.iot-dns.com Port: 443 --<< ,r:0
[01-01 18:12:32 TUYA D][tuya_tls.c:1269] ----enable_cert:1,DEFAULT_LOAD_CERT:1
[01-01 18:12:32 TUYA D][tuya_tls.c:1312] TUYA_TLS Begin Connect h2.iot-dns.com:443 CustomNet:TRUE Enable_Cert:TRUE Default:TRUE
[01-01 18:12:32 TUYA D][tuya_tls.c:1387] load tuya cert.
[01-01 18:12:32 TUYA D][tuya_iot_com_api.c:271] tuya iot dns
[01-01 18:12:32 TUYA D][tuya_tls.c:1503] socket fd is set. set to inner send/recv to handshake
[01-01 18:12:33 TUYA D][tuya_tls.c:1519] tls handshake ret:0x7200, flags:0
[01-01 18:12:33 TUYA E][tuya_tls.c:1541] mbedtls_ssl_handshake returned 7200 -29184
感谢!