【已解决】【TuyaOS SDK】二维码配网,设备已经连网完成,TUYA DNS查询失败

IPC/NVR/可视门铃等具备多媒体能力的设备,扫地机/AGV等机器人设备


19926824531
Posts: 196

对于TuyaOS SDK开发模式,TuyaOS 3.9.0版本,tkl已经适配完成,二维码配网执行成功,设备已经连网完成,但是目前好像卡在了TUYA DNS查询这一步,串口log有以下的报错信息,请问这可能是什么原因呢?有空麻烦尽快帮忙看下

[LOG_I][tkl_wifi.c: 458] tkl_wifi_station_get_status => status: 6
[DBG_][tkl_wifi.c: 203] tkl_wifi_get_ip => ip:192.168.29.1, mask:255.255.255.0, gateway:192.168.29.1
gethostbyname_r error: Unknown host
[01-01 00:01:42 ty E][uni_network.c:253] fail to gethostbyname -25

[01-01 00:01:42 ty E][uni_network.c:104] get host name err,ret:-5
[01-01 00:01:42 ty E][tcp_transporter.c:41] DNS parser host h6.iot-dns.com failed -5
[01-01 00:01:42 ty E][tls_transporter.c:53] tcp transporter connect failed,ret:-0x7102
[01-01 00:01:42 ty E][http_inf.c:59] Open session failed: https://h6.iot-dns.com/v2/url_config (-28930)
[01-01 00:01:42 ty E][iot_httpc.c:1251] fail to get cloud url -2050
[01-01 00:01:42 ty E][tuya_svc_devos_activate.c:183] activate backoff
[LOG_I][tkl_wifi.c: 458] tkl_wifi_station_get_status => status: 6
[DBG][tkl_wifi.c: 203] tkl_wifi_get_ip => ip:192.168.29.1, mask:255.255.255.0, gateway:192.168.29.1
[LOG_I][tkl_wifi.c: 458] tkl_wifi_station_get_status => status: 6
[DBG
][tkl_wifi.c: 203] tkl_wifi_get_ip => ip:192.168.29.1, mask:255.255.255.0, gateway:192.168.29.1
[LOG_I][tkl_wifi.c: 458] tkl_wifi_station_get_status => status: 6
[DBG][tkl_wifi.c: 203] tkl_wifi_get_ip => ip:192.168.29.1, mask:255.255.255.0, gateway:192.168.29.1
Lease of 192.168.29.4 obtained, lease time 86400
deleting routers
route: SIOCDELRT: No such process
gw is 192.168.29.1
dev is wlan0
adding dns 192.168.29.1
[LOG_I][tkl_wifi.c: 458] tkl_wifi_station_get_status => status: 6
[DBG
][tkl_wifi.c: 203] tkl_wifi_get_ip => ip:192.168.29.4, mask:255.255.255.0, gateway:192.168.29.1
[01-01 00:01:44 ty E][tuya_tls.c:1070] mbedtls_ssl_handshake returned 0x4e00
[01-01 00:01:44 ty E][tuya_tls.c:1110] TUYA_TLS faild Connect h6.iot-dns.com:443
[01-01 00:01:44 ty E][tls_transporter.c:71] tls transporter connect err:-19968
[01-01 00:01:44 ty E][http_inf.c:59] Open session failed: https://h6.iot-dns.com/v2/url_config (-1)
[01-01 00:01:44 ty E][log_seq.c:142] ret:-1027
[01-01 00:01:44 ty E][iot_httpc.c:1251] fail to get cloud url -2050
[01-01 00:01:44 ty E][tuya_svc_devos_activate.c:183] activate backoff
[LOG_I][tkl_wifi.c: 458] tkl_wifi_station_get_status => status: 6
[DBG_][tkl_wifi.c: 203] tkl_wifi_get_ip => ip:192.168.29.4, mask:255.255.255.0, gateway:192.168.29.1
[LOG_I][tkl_wifi.c: 458] tkl_wifi_station_get_status => status: 6

Last edited by 19926824531 on 2024年 Jan 10日 15:24, edited 1 time in total.

Tags:
User avatar
Passat
Posts: 55

Re: 二维码配网,设备已经连网完成,TUYA DNS查询失败

  1. 获取IP后,设备ping外网是否正常?
  2. 请提供完整的设备日志
19926824531
Posts: 196

Re: 二维码配网,设备已经连网完成,TUYA DNS查询失败

Answer: 1. 获取IP后,设备ping外网正常(试过ping百度正常) 2. 以下附件是完整log

Attachments
1-6_log4.txt
(90.84 KiB) Downloaded 150 times
Last edited by 19926824531 on 2024年 Jan 8日 14:09, edited 1 time in total.
User avatar
Passat
Posts: 55

Re: 二维码配网,设备已经连网完成,TUYA DNS查询失败

  1. 可以上传日志文件等附件
  2. SDK日志信息较少,需要打开DEBUG级别的日志。调用 tuya_ipc_set_log_attr(4,NULL);
  3. 二维码信息解析后,是否有调用 tuya_ipc_direct_connect ?用法参考: https://developer.tuya.com/cn/docs/iot- ... 9vbq0c7b4u
19926824531
Posts: 196

Re: 二维码配网,设备已经连网完成,TUYA DNS查询失败

log的398行:
[DBG_][TuyaService.c: 69] tuya_wifi_QrScanCallback => tuya_ipc_direct_connect succ!!!

19926824531
Posts: 196

Re: 二维码配网,设备已经连网完成,TUYA DNS查询失败

SDK debug级别日志

Attachments
2024-01-08_160355_debug级别日志.log
(149.98 KiB) Downloaded 193 times
User avatar
Passat
Posts: 55

Re: 二维码配网,设备已经连网完成,TUYA DNS查询失败

日志中显示获取的 IP地址为 192.168.29.1 应该是不对的,此地址一般是默认网关IP,设备不太可能通过dhcp分配到这个地址

19926824531
Posts: 196

Re: 二维码配网,设备已经连网完成,TUYA DNS查询失败

初始化为AP模式,ip为192.168.29.1,后续配上网切成STA之后,ip变成了192.168.60.102
这个地方ip应该是符合预期的

19926824531
Posts: 196

Re: 二维码配网,设备已经连网完成,TUYA DNS查询失败

请问在设备dhcp分配ip之前获取的这个ip应该给个什么值呢

User avatar
Passat
Posts: 55

Re: 二维码配网,设备已经连网完成,TUYA DNS查询失败

目前看上去,应该是TKL层接口适配有问题,tkl_wifi_station_get_status 应该是在获取到真正IP的时候状态才是 6(WSS_GOT_IP)

Post Reply