[TuyaOS SDK 6.1.6] AP配網失敗

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


rachelchen
Posts: 9

您好,

可以看到SmartLife-xxxx (mac last 4 digit), 密碼是空的
要搜尋到device, 需要連SmartLife-xxxx嗎? 還是手機開啟熱點, 開啟wifi (wifi不用連ssid)就可以了
開tuya app一直搜尋不到裝置, 不確定缺少什麼
看執行後的log, AP有成功起來, 但是一直在印 get work mode 和 get ip


[01-01 00:00:14 ty D][tuya_wifi_netcfg.c:575] start ap success:SmartLife-2201
[01-01 00:00:14 ty D][netcfg_module.c:133] type:0x10002,is_set:0
[01-01 00:00:14 ty D][netcfg_module.c:133] type:0x10100,is_set:0
[01-01 00:00:14 ty D][netcfg_module.c:133] type:0x10002,is_set:0
[01-01 00:00:14 ty D][netcfg_module.c:133] type:0x10100,is_set:0
tkl_wifi_get_work_mode[556]

Current mode: AP mode
WIFI Get Mode 3
[01-01 00:00:14 ty N][tuya_wifi_status.c:168] cur stat:2 0x4c6360 -->>
[01-01 00:00:14 ty N][tuya_wifi_status.c:171] wifi netstat changed to:2 -->>
[01-01 00:00:14 ty N][tuya_wifi_status.c:175] report wifi netstat[2] to callback -->>
[01-01 00:00:14 ty E][tuya_ipc_sdk_init.c:330] wf nw status changed to [2], but not notify

[01-01 00:00:14 ty D][netcfg_module.c:334] netcfg module start type:0x10100
[01-01 00:00:14 ty N][tuya_wifi_reset.c:404] timer stated, short timer:0x0, long timer:0x0
[01-01 00:00:14 ty D][tuya_wifi_netcfg.c:787] nc_tp:2, md:0
[01-01 00:00:14 ty N][tuya_svc_devos.c:216] __devos_init_evt success
[01-01 00:00:14 ty D][netcfg_module.c:116] start 0x10100 ret:0
[01-01 00:00:14 ty D][netcfg_module.c:334] netcfg module start type:0x10002
[01-01 00:00:14 ty D][ap_netcfg.c:1282] ap cfg start:65538
tkl_wifi_get_ip[394]

hwl_get_local_ip_info[339]

ip=192.168.2.1
gw=192.168.2.255
mask=255.255.255.0
hwl_get_local_ip_info[339]

ip=192.168.2.1
gw=192.168.2.255
mask=255.255.255.0
WIFI[1] Get IP:192.168.2.1
WIFI[1] Get GW:192.168.2.255
WIFI[1] Get MASK:255.255.255.0
[01-01 00:00:14 ty D][ap_netcfg.c:1160] ap netcfg server ip:192.168.2.1
[01-01 00:00:14 ty I][tal_thread.c:185] thread_create name:ap_tcp_v4,stackDepth:3584,totalstackDepth:24576,priority:5
[01-01 00:00:14 ty D][netcfg_module.c:116] start 0x10002 ret:0
[01-01 00:00:14 ty D][tal_thread.c:204] Thread:ap_tcp_v4 Exec Start. Set to Running Stat
[01-01 00:00:14 ty D][ap_netcfg.c:749] start TCP ap thread
[01-01 00:00:14 ty D][ap_netcfg.c:787] Waiting for a remote connection

tkl_wifi_get_work_mode[556]

Current mode: AP mode
WIFI Get Mode 3
tkl_wifi_get_ip[394]

hwl_get_local_ip_info[339]

ip=192.168.2.1
gw=192.168.2.255
mask=255.255.255.0
hwl_get_local_ip_info[339]

Last edited by rachelchen on 2024年 Nov 21日 18:35, edited 1 time in total.
郭老庄
Posts: 195

Re: [TuyaOS SDK 6.1.6] AP配網失敗

AP配网不用搜到设备。AP配网的操作流程是:

  1. 添加设备
  2. 选择摄像机/锁->智能摄像机(wi-fi)
  3. 右上角选择Wi-Fi配网,按提示,点多次"下一步"
  4. 选择热点配网
  5. 输入ssid和passwd,再点“下一步”
  6. 跳转到WLAN页面,选择设备的热点,smartlife-xxx
  7. 连上后,返回,这时设备和手机就建立了连接,手机把刚输入的ssid等信息发给设备,完成配网
rachelchen
Posts: 9

Re: [TuyaOS SDK 6.1.6] AP配網失敗

您好,

照您的步驟試了之後,
Tuya app -> 新增裝置 -> wifi 配網 -> 輸入手機的熱點資訊 -> WLAN頁面可以選SmartLife-xxxx -> 有一個倒數兩分鐘的偵測
我試了幾次沒辦法連上, 兩分鐘都timeout

Log如下,
[01-01 00:02:33 ty D][tuya_wifi_connect.c:264] status:0,mode:5
[01-01 00:02:33 ty D][tuya_wifi_connect.c:424] start wf connect, ssid:xxxxxxxx, pwd:87654321
[01-01 00:02:33 ty D][tal_wifi_reconnet.c:103] wifi stat link up
[01-01 00:02:33 ty D][tuya_wifi_connect.c:430] wf connect success!
tkl_wifi_get_work_mode[556]

No WiFi mode is currently active.
WIFI Get Mode 5
[01-01 00:02:33 ty D][tuya_svc_devos_activate_token.c:75] token activate get cloud url
[01-01 00:02:33 ty D][simplekv.c:1254] delete key:tls_ca_cnt isFuzzy:0
[01-01 00:02:33 ty D][simplekv.c:1260] cnt:6 delete bit arr len:1
[01-01 00:02:33 ty D][simplekv.c:1293] key:tls_ca_cnt not find
[01-01 00:02:33 ty D][simplekv.c:1254] delete key:tls_ca isFuzzy:1
[01-01 00:02:33 ty D][simplekv.c:1260] cnt:6 delete bit arr len:1
[01-01 00:02:33 ty D][simplekv.c:1293] key:tls_ca not find
[01-01 00:02:33 ty D][simplekv.c:1133] read key:tls_ca_cnt isFuzzy:0 skipCnt:0
[01-01 00:02:33 ty D][simplekv.c:1161] no key find
[01-01 00:02:33 ty D][simplekv.c:1203] __read_kv_raw fail. -3
[01-01 00:02:33 ty D][simplekv.c:1242] __read_kv_with_decode fail. -3
[01-01 00:02:33 ty D][tuya_cert_manager.c:463] load tls_ca_cnt fail. no ca in local db
[01-01 00:02:33 ty D][iot_httpc.c:1193] http_iot_dns_get_cloud_url start
[01-01 00:02:33 ty D][iot_httpc.c:1239] http_dns region AZ, send: {"region":"AZ","env":"18Dr","config":[{"key":"httpUrl","need_ca":false},{"key":"mqttUrl","need_ca":false},{"key":"httpsPSKUrl","need_ca":false},{"key":"mqttsPSK3Url","need_ca":false},{"key":"httpsStdUrl","need_ca":true},{"key":"mqttsStdUrl","need_ca":true},{"key":"ghostUrl","need_ca":true}]}
[01-01 00:02:33 ty D][tuya_register_center.c:434] rcs.urlx:h6-az.iot-dns.com
[01-01 00:02:33 ty D][iot_httpc.c:1243] get url config:https://h6-az.iot-dns.com/v2/url_config

另外發現 設定work_mode為ap後, 會呼叫tkl_wifi_start_ap
tkl_wifi_set_work_mode[498] mode = 3
WIFI Set Mode 3
tkl_wifi_get_mac[452]
tkl_wifi_start_ap[202]

有看到設定work_mode為station, 但是沒看到tkl_wifi_station_connect
tkl_wifi_set_work_mode[498] mode = 2
WIFI Set Mode 2
tkl_wifi_get_work_mode[556]
No WiFi mode is currently active.
WIFI Get Mode 5

因為裝置上沒有iwconfig command,
如果單純設定和查詢mode, 而不是連ap或連station, 我可以用變數存起來mode就好嗎?

謝謝。

Last edited by rachelchen on 2024年 Nov 19日 17:56, edited 1 time in total.
郭老庄
Posts: 195

Re: [TuyaOS SDK 6.1.6] AP配網失敗

你好,我需要更完整的日志

rachelchen
Posts: 9

Re: [TuyaOS SDK 6.1.6] AP配網失敗

您好,

log如附件。

demo.log
(140.17 KiB) Downloaded 7 times
郭老庄
Posts: 195

Re: [TuyaOS SDK 6.1.6] AP配網失敗

日志显示,设备正在ap配网。但存在几个问题:

  1. 设备在收到配网信息前(见打印[ap_netcfg.c:194] Parse ssid:cutepig_iphone),tkl_wifi.c就通过回调wifi_status_cb告诉sdk已经连上wifi,或者获取到ip了
  2. 由于前面的问题,sdk认为可以访问外网了,但此时网络是不通的,一些依赖网络的操作就会失败(见打印:DNS parser host h6-az.iot-dns.com failed -5、tcp transporter connect failed,ret:-0x7102)

如本贴前面的答复,tkl_wifi.c要按照设备实际情况去适配

rachelchen
Posts: 9

Re: [TuyaOS SDK 6.1.6] AP配網失敗

您好,

我昨天有成功用AP配網成功過一次, 但是tuya app看不到camera影像, 只能看到播放tuya影片,
裝置是可以透過VLC開啟rtsp stream 看到camera 影像
在執行demo的時候吃的config檔, 沒有地方可以填rtsp stream

另外請問一下, 因為後來裝置system crash, 正常的狀況下, tuya app移除裝置後, 是能夠反覆做AP配對的對嗎?

謝謝。

Post Reply