網關與子裝置的功能常式運行後,您可以在裝置端和物聯網平台查看日誌資訊。
前提條件
已配置C Link SDK的網關與子裝置的功能常式,詳細資料,請參見使用樣本。
裝置端日誌
您可以在網關裝置查看作業記錄。
- 以下日誌顯示網關裝置與物聯網平台串連成功。
[1625220273.644][LK-0313] MQTT user calls aiot_mqtt_connect api, connect [1625220273.644][LK-0317] LightSwitchGW&a18wP****** [1625220273.644][LK-0318] 29F9969F10F1AE9728977EA79D31DAC85981B101761E8887548CD4685D****** core_sysdep_network_establish host iot-06******.mqtt.iothub.aliyuncs.com port 443, type 0 establish tcp connection with server(host='a18wP******.iot-as-mqtt.cn-shanghai.aliyuncs.com', port=[443]) success to establish tcp, fd=3 local port: 41574 [1625220273.677][LK-1000] establish mbedtls connection with server(host='a18wP******.iot-as-mqtt.cn-shanghai.aliyuncs.com', port=[443]) [1625220273.744][LK-1000] success to establish mbedtls connection, (cost 44947 bytes in total, max used 47859 bytes) [1625220273.744][LK-0319] a18wP******.LightSwitchGW|timestamp=2524608000000,_ss=1,_v=sdk-c-4.1.0,securemode=2,signmethod=hmacsha256,ext=3,_conn=tls_66| [1625220273.811][LK-0313] MQTT connect success in 168 ms [1625220273.811][LK-0317] cid[10] connected, online channel 10
- 如果選擇自動添加拓撲關係,網關裝置串連後,無需添加拓撲關係,直接通過網關的Topic
/ext/session/a18wP******/LightSwitchGW/combine/batch_login
,向物聯網平台發送批量登入請求。[1625466501.399][LK-0309] pub[2]: /ext/session/a18wP******/LightSwitchGW/combine/batch_login [LK-030A] > 7B 22 69 64 22 3A 22 32 22 2C 22 76 65 72 73 69 | {"id":"2","versi [LK-030A] > 6F 6E 22 3A 22 31 2E 30 22 2C 22 70 61 72 61 6D | on":"1.0","param [LK-030A] > 73 22 3A 7B 22 73 69 67 6E 4D 65 74 68 6F 64 22 | s":{"signMethod" [LK-030A] > 3A 22 68 6D 61 63 53 68 61 32 35 36 22 2C 22 64 | :"hmacSha256","d [LK-030A] > 65 76 69 63 65 4C 69 73 74 22 3A 5B 7B 22 70 72 | eviceList":[{"pr [LK-030A] > 6F 64 75 63 74 4B 65 79 22 3A 22 67 37 68 30 69 | oductKey":"a13FN [LK-030A] > 75 38 54 74 31 61 22 2C 22 64 65 76 69 63 65 4E | ******","deviceN [LK-030A] > 61 6D 65 22 3A 22 4C 69 67 68 74 53 77 69 74 63 | ame":"LightSwitc [LK-030A] > 68 5F 53 75 62 44 65 76 5F 30 31 22 2C 22 63 6C | h_SubDev_01","cl [LK-030A] > 69 65 6E 74 49 64 22 3A 22 67 37 68 30 69 75 38 | ientId":"a13FN** [LK-030A] > 54 74 31 61 2E 4C 69 67 68 74 53 77 69 74 63 68 | ****.LightSwitch [LK-030A] > 5F 53 75 62 44 65 76 5F 30 31 22 2C 22 74 69 6D | _SubDev_01","tim [LK-030A] > 65 73 74 61 6D 70 22 3A 22 31 36 32 35 34 36 36 | estamp":"1625466 [LK-030A] > 35 30 31 33 39 36 22 2C 22 63 6C 65 61 6E 53 65 | 501396","cleanSe [LK-030A] > 73 73 69 6F 6E 22 3A 22 66 61 6C 73 65 22 2C 22 | ssion":"false"," [LK-030A] > 73 69 67 6E 22 3A 22 30 46 41 45 38 43 33 43 33 | sign":"0FAE8C3C3 [LK-030A] > 34 38 44 35 30 37 38 38 43 41 42 38 38 42 36 44 | 48D50788CAB88B6D [LK-030A] > 39 44 34 34 43 35 44 35 36 46 45 46 44 42 33 45 | 9D44C5D56FEFDB3E [LK-030A] > 43 46 41 30 30 35 38 37 32 30 41 43 34 45 37 43 | CFA0058720AC4E7C [LK-030A] > 46 36 44 36 34 44 36 22 7D 2C 7B 22 70 72 6F 64 | F******"},{"prod [LK-030A] > 75 63 74 4B 65 79 22 3A 22 67 37 68 30 69 75 38 | uctKey":"a13FN** [LK-030A] > 54 74 31 61 22 2C 22 64 65 76 69 63 65 4E 61 6D | ****","deviceNam [LK-030A] > 65 22 3A 22 4C 69 67 68 74 53 77 69 74 63 68 5F | e":"LightSwitch_ [LK-030A] > 53 75 62 44 65 76 5F 30 32 22 2C 22 63 6C 69 65 | SubDev_02","clie [LK-030A] > 6E 74 49 64 22 3A 22 67 37 68 30 69 75 38 54 74 | ntId":"a13FN**** [LK-030A] > 31 61 2E 4C 69 67 68 74 53 77 69 74 63 68 5F 53 | **.LightSwitch_S [LK-030A] > 75 62 44 65 76 5F 30 32 22 2C 22 74 69 6D 65 73 | ubDev_02","times [LK-030A] > 74 61 6D 70 22 3A 22 31 36 32 35 34 36 36 35 30 | tamp":"162546650 [LK-030A] > 31 33 39 36 22 2C 22 63 6C 65 61 6E 53 65 73 73 | 1396","cleanSess [LK-030A] > 69 6F 6E 22 3A 22 66 61 6C 73 65 22 2C 22 73 69 | ion":"false","si [LK-030A] > 67 6E 22 3A 22 33 31 36 45 45 36 35 37 33 46 31 | gn":"316EE6573F1 [LK-030A] > 35 37 33 38 36 32 41 34 42 37 35 39 45 32 35 42 | 573862A4B759E25B [LK-030A] > 43 32 34 41 32 30 33 44 35 30 31 43 41 30 42 35 | C24A203D501CA0B5 [LK-030A] > 31 44 30 35 30 30 41 32 32 45 34 39 46 42 38 38 | 1D0500A22E49FB88 [LK-030A] > 39 46 32 42 35 22 7D 2C 7B 22 70 72 6F 64 75 63 | *****"},{"produc [LK-030A] > 74 4B 65 79 22 3A 22 67 37 68 30 69 75 38 54 74 | tKey":"g7h0i**** [LK-030A] > 31 61 22 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 | **","deviceName" [LK-030A] > 3A 22 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 | :"LightSwitch_Su [LK-030A] > 62 44 65 76 5F 30 33 22 2C 22 63 6C 69 65 6E 74 | bDev_03","client [LK-030A] > 49 64 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 | Id":"a13FN****** [LK-030A] > 2E 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 | .LightSwitch_Sub [LK-030A] > 44 65 76 5F 30 33 22 2C 22 74 69 6D 65 73 74 61 | Dev_03","timesta [LK-030A] > 6D 70 22 3A 22 31 36 32 35 34 36 36 35 30 31 33 | mp":"16254665013 [LK-030A] > 39 36 22 2C 22 63 6C 65 61 6E 53 65 73 73 69 6F | 96","cleanSessio [LK-030A] > 6E 22 3A 22 66 61 6C 73 65 22 2C 22 73 69 67 6E | n":"false","sign [LK-030A] > 22 3A 22 37 31 30 43 44 43 37 31 36 34 34 35 36 | ":"710CDC7164456 [LK-030A] > 43 39 43 45 41 36 44 39 43 33 30 41 35 44 38 30 | C9CEA6D9C30A5D80 [LK-030A] > 32 33 42 41 32 46 46 45 42 30 32 41 33 46 36 37 | 23BA2FFEB02A3F67 [LK-030A] > 35 41 37 41 34 39 32 34 33 45 33 33 41 32 31 45 | 5A7A49243E33A21E [LK-030A] > 36 36 44 22 7D 2C 7B 22 70 72 6F 64 75 63 74 4B | ***"},{"productK [LK-030A] > 65 79 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 | ey":"a13FN****** [LK-030A] > 22 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 3A 22 | ","deviceName":" [LK-030A] > 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 | LightSwitch_SubD [LK-030A] > 65 76 5F 30 34 22 2C 22 63 6C 69 65 6E 74 49 64 | ev_04","clientId [LK-030A] > 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 2E 4C | ":"a13FN******.L [LK-030A] > 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 65 | ightSwitch_SubDe [LK-030A] > 76 5F 30 34 22 2C 22 74 69 6D 65 73 74 61 6D 70 | v_04","timestamp [LK-030A] > 22 3A 22 31 36 32 35 34 36 36 35 30 31 33 39 36 | ":"1625466501396 [LK-030A] > 22 2C 22 63 6C 65 61 6E 53 65 73 73 69 6F 6E 22 | ","cleanSession" [LK-030A] > 3A 22 66 61 6C 73 65 22 2C 22 73 69 67 6E 22 3A | :"false","sign": [LK-030A] > 22 38 42 35 39 39 34 44 32 39 37 32 45 43 37 46 | "8B5994D2972EC7F [LK-030A] > 42 36 46 42 31 39 39 32 30 39 36 39 43 39 37 31 | B6FB19920969C971 [LK-030A] > 31 44 38 34 45 36 45 42 32 42 36 37 46 41 39 35 | 1D84E6EB2B67FA95 [LK-030A] > 31 43 33 42 34 35 31 41 38 31 39 41 30 44 32 44 | 1C3B451A819***** [LK-030A] > 45 22 7D 5D 7D 7D | *"}]}}
- 如果未選擇自動添加拓撲關係,日誌如下。
- 網關裝置串連後,通過網關的Topic
/sys/a18wP******/LightSwitchGW/thing/topo/add
,向物聯網平台發送添加拓撲關係的請求,日誌如下:[1625466499.399][LK-0309] pub: /sys/a18wP******/LightSwitchGW/thing/topo/add [LK-030A] > 7B 22 69 64 22 3A 22 31 22 2C 22 76 65 72 73 69 | {"id":"1","versi [LK-030A] > 6F 6E 22 3A 22 31 2E 30 22 2C 22 70 61 72 61 6D | on":"1.0","param [LK-030A] > 73 22 3A 5B 7B 22 70 72 6F 64 75 63 74 4B 65 79 | s":[{"productKey [LK-030A] > 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 22 2C | ":"a13FN******", [LK-030A] > 22 64 65 76 69 63 65 4E 61 6D 65 22 3A 22 4C 69 | "deviceName":"Li [LK-030A] > 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 65 76 | ghtSwitch_SubDev [LK-030A] > 5F 30 31 22 2C 22 63 6C 69 65 6E 74 49 64 22 3A | _01","clientId": [LK-030A] > 22 67 37 68 30 69 75 38 54 74 31 61 2E 4C 69 67 | "a13FN******.Lig [LK-030A] > 68 74 53 77 69 74 63 68 5F 53 75 62 44 65 76 5F | htSwitch_SubDev_ [LK-030A] > 30 31 22 2C 22 74 69 6D 65 73 74 61 6D 70 22 3A | 01","timestamp": [LK-030A] > 22 31 36 32 35 34 36 36 34 39 39 33 39 36 22 2C | "1625466499396", [LK-030A] > 22 73 69 67 6E 6D 65 74 68 6F 64 22 3A 22 68 6D | "signmethod":"hm [LK-030A] > 61 63 53 68 61 32 35 36 22 2C 22 73 69 67 6E 22 | acSha256","sign" [LK-030A] > 3A 22 33 44 44 32 38 36 39 45 30 45 37 46 35 43 | :"3DD2869E0E7F5C [LK-030A] > 41 37 46 43 35 46 30 30 36 37 30 36 44 38 33 45 | A7FC5F006706D83E [LK-030A] > 44 36 46 46 39 35 38 39 46 43 35 43 32 33 45 45 | D6FF9589FC5C23EE [LK-030A] > 32 44 33 41 46 39 33 39 31 44 46 42 46 32 31 30 | 2D3AF9391DFB**** [LK-030A] > 37 34 22 7D 2C 7B 22 70 72 6F 64 75 63 74 4B 65 | **"},{"productKe [LK-030A] > 79 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 22 | y":"a13FN******" [LK-030A] > 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 3A 22 4C | ,"deviceName":"L [LK-030A] > 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 65 | ightSwitch_SubDe [LK-030A] > 76 5F 30 32 22 2C 22 63 6C 69 65 6E 74 49 64 22 | v_02","clientId" [LK-030A] > 3A 22 67 37 68 30 69 75 38 54 74 31 61 2E 4C 69 | :"a13FN******.Li [LK-030A] > 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 65 76 | ghtSwitch_SubDev [LK-030A] > 5F 30 32 22 2C 22 74 69 6D 65 73 74 61 6D 70 22 | _02","timestamp" [LK-030A] > 3A 22 31 36 32 35 34 36 36 34 39 39 33 39 36 22 | :"1625466499396" [LK-030A] > 2C 22 73 69 67 6E 6D 65 74 68 6F 64 22 3A 22 68 | ,"signmethod":"h [LK-030A] > 6D 61 63 53 68 61 32 35 36 22 2C 22 73 69 67 6E | macSha256","sign [LK-030A] > 22 3A 22 34 39 44 38 31 43 44 43 44 41 39 31 30 | ":"49D81CDCDA910 [LK-030A] > 37 36 34 45 32 43 39 42 43 39 44 35 46 31 33 30 | 764E2C9BC9D5F130 [LK-030A] > 31 30 35 44 34 38 37 42 34 43 34 33 33 41 31 39 | 105D487B4C433A19 [LK-030A] > 36 35 32 35 46 33 46 41 38 38 39 31 37 37 30 38 | 6525F3FA88917*** [LK-030A] > 36 31 35 22 7D 2C 7B 22 70 72 6F 64 75 63 74 4B | ***"},{"productK [LK-030A] > 65 79 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 | ey":"a13FN****** [LK-030A] > 22 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 3A 22 | ","deviceName":" [LK-030A] > 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 | LightSwitch_SubD [LK-030A] > 65 76 5F 30 33 22 2C 22 63 6C 69 65 6E 74 49 64 | ev_03","clientId [LK-030A] > 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 2E 4C | ":"a13FN******.L [LK-030A] > 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 65 | ightSwitch_SubDe [LK-030A] > 76 5F 30 33 22 2C 22 74 69 6D 65 73 74 61 6D 70 | v_03","timestamp [LK-030A] > 22 3A 22 31 36 32 35 34 36 36 34 39 39 33 39 36 | ":"1625466499396 [LK-030A] > 22 2C 22 73 69 67 6E 6D 65 74 68 6F 64 22 3A 22 | ","signmethod":" [LK-030A] > 68 6D 61 63 53 68 61 32 35 36 22 2C 22 73 69 67 | hmacSha256","sig [LK-030A] > 6E 22 3A 22 44 33 30 31 46 30 33 31 42 45 37 38 | n":"D301F031BE78 [LK-030A] > 33 44 42 41 35 42 33 33 42 39 44 43 45 30 32 39 | 3DBA5B33B9DCE029 [LK-030A] > 38 33 42 41 30 31 42 46 39 37 46 34 34 32 32 43 | 83BA01BF97F4422C [LK-030A] > 33 39 45 30 31 44 34 32 41 39 34 41 41 37 45 45 | 39E01D42A94AA*** [LK-030A] > 41 33 43 42 22 7D 2C 7B 22 70 72 6F 64 75 63 74 | A***"},{"product [LK-030A] > 4B 65 79 22 3A 22 67 37 68 30 69 75 38 54 74 31 | Key":"a13FN***** [LK-030A] > 61 22 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 3A | *","deviceName": [LK-030A] > 22 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 | "LightSwitch_Sub [LK-030A] > 44 65 76 5F 30 34 22 2C 22 63 6C 69 65 6E 74 49 | Dev_04","clientI [LK-030A] > 64 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 2E | d":"a13FN******. [LK-030A] > 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 | LightSwitch_SubD [LK-030A] > 65 76 5F 30 34 22 2C 22 74 69 6D 65 73 74 61 6D | ev_04","timestam [LK-030A] > 70 22 3A 22 31 36 32 35 34 36 36 34 39 39 33 39 | p":"162546649939 [LK-030A] > 36 22 2C 22 73 69 67 6E 6D 65 74 68 6F 64 22 3A | 6","signmethod": [LK-030A] > 22 68 6D 61 63 53 68 61 32 35 36 22 2C 22 73 69 | "hmacSha256","si [LK-030A] > 67 6E 22 3A 22 43 41 36 46 35 37 38 34 45 37 45 | gn":"CA6F5784E7E [LK-030A] > 45 31 32 32 46 33 35 45 37 41 36 44 36 43 30 31 | E122F35E7A6D6C01 [LK-030A] > 46 42 35 37 42 30 42 32 44 41 43 39 46 45 38 41 | FB57B0B2DAC9FE8A [LK-030A] > 31 44 35 41 44 36 46 38 34 46 32 35 46 39 45 38 | 1D5AD6F84F25F9E* [LK-030A] > 30 31 34 38 45 22 7D 5D 7D | *****"}]}
- 物聯網平台收到上述請求後,通過網關的Topic
/sys/a18wP******/LightSwitchGW/thing/topo/add_reply
,向網關返回應答報文,日誌如下:[1625466499.500][LK-0309] pub: /sys/a18wP******/LightSwitchGW/thing/topo/add_reply [LK-030A] < 7B 22 63 6F 64 65 22 3A 32 30 30 2C 22 64 61 74 | {"code":200,"dat [LK-030A] < 61 22 3A 5B 7B 22 70 72 6F 64 75 63 74 4B 65 79 | a":[{"productKey [LK-030A] < 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 22 2C | ":"a13FN******", [LK-030A] < 22 64 65 76 69 63 65 4E 61 6D 65 22 3A 22 4C 69 | "deviceName":"Li [LK-030A] < 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 65 76 | ghtSwitch_SubDev [LK-030A] < 5F 30 34 22 7D 2C 7B 22 70 72 6F 64 75 63 74 4B | _04"},{"productK [LK-030A] < 65 79 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 | ey":"a13FN****** [LK-030A] < 22 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 3A 22 | ","deviceName":" [LK-030A] < 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 | LightSwitch_SubD [LK-030A] < 65 76 5F 30 33 22 7D 2C 7B 22 70 72 6F 64 75 63 | ev_03"},{"produc [LK-030A] < 74 4B 65 79 22 3A 22 67 37 68 30 69 75 38 54 74 | tKey":"a13FN**** [LK-030A] < 31 61 22 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 | **","deviceName" [LK-030A] < 3A 22 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 | :"LightSwitch_Su [LK-030A] < 62 44 65 76 5F 30 32 22 7D 2C 7B 22 70 72 6F 64 | bDev_02"},{"prod [LK-030A] < 75 63 74 4B 65 79 22 3A 22 67 37 68 30 69 75 38 | uctKey":"a13FN** [LK-030A] < 54 74 31 61 22 2C 22 64 65 76 69 63 65 4E 61 6D | ****","deviceNam [LK-030A] < 65 22 3A 22 4C 69 67 68 74 53 77 69 74 63 68 5F | e":"LightSwitch_ [LK-030A] < 53 75 62 44 65 76 5F 30 31 22 7D 5D 2C 22 69 64 | SubDev_01"}],"id [LK-030A] < 22 3A 22 31 22 2C 22 6D 65 73 73 61 67 65 22 3A | ":"1","message": [LK-030A] < 22 73 75 63 63 65 73 73 22 2C 22 6D 65 74 68 6F | "success","metho [LK-030A] < 64 22 3A 22 74 68 69 6E 67 2E 74 6F 70 6F 2E 61 | d":"thing.topo.a [LK-030A] < 64 64 22 2C 22 76 65 72 73 69 6F 6E 22 3A 22 31 | dd","version":"1 [LK-030A] < 2E 30 22 7D | .0"} msgid : 1 code : 200 product key : a18wP****** device name : LightSwitchGW message : success data : [{"productKey":"a13FN******","deviceName":"LightSwitch_SubDev_04"},{"productKey":"a13FN******","deviceName":"LightSwitch_SubDev_03"},{"productKey":"a13FN******","deviceName":"LightSwitch_SubDev_02"},{"productKey":"a13FN******","deviceName":"LightSwitch_SubDev_01"}]
- 物聯網平台為網關和子裝置添加拓撲關係後,通過網關的Topic
/sys/a18wP******/LightSwitchGW/thing/topo/change
,向網關返回拓撲關係變更通知,日誌如下:[1625466499.533][LK-0309] pub: /sys/a18wP******/LightSwitchGW/thing/topo/change [LK-030A] < 7B 22 6D 65 74 68 6F 64 22 3A 22 74 68 69 6E 67 | {"method":"thing [LK-030A] < 2E 74 6F 70 6F 2E 63 68 61 6E 67 65 22 2C 22 69 | .topo.change","i [LK-030A] < 64 22 3A 22 31 33 31 32 34 35 35 31 37 30 22 2C | d":"1312455170", [LK-030A] < 22 70 61 72 61 6D 73 22 3A 7B 22 73 75 62 4C 69 | "params":{"subLi [LK-030A] < 73 74 22 3A 5B 7B 22 64 65 76 69 63 65 4E 61 6D | st":[{"deviceNam [LK-030A] < 65 22 3A 22 4C 69 67 68 74 53 77 69 74 63 68 5F | e":"LightSwitch_ [LK-030A] < 53 75 62 44 65 76 5F 30 31 22 2C 22 70 72 6F 64 | SubDev_01","prod [LK-030A] < 75 63 74 4B 65 79 22 3A 22 67 37 68 30 69 75 38 | uctKey":"a13FN** [LK-030A] < 54 74 31 61 22 7D 2C 7B 22 64 65 76 69 63 65 4E | ****"},{"deviceN [LK-030A] < 61 6D 65 22 3A 22 4C 69 67 68 74 53 77 69 74 63 | ame":"LightSwitc [LK-030A] < 68 5F 53 75 62 44 65 76 5F 30 32 22 2C 22 70 72 | h_SubDev_02","pr [LK-030A] < 6F 64 75 63 74 4B 65 79 22 3A 22 67 37 68 30 69 | oductKey":"a13FN [LK-030A] < 75 38 54 74 31 61 22 7D 2C 7B 22 64 65 76 69 63 | ******"},{"devic [LK-030A] < 65 4E 61 6D 65 22 3A 22 4C 69 67 68 74 53 77 69 | eName":"LightSwi [LK-030A] < 74 63 68 5F 53 75 62 44 65 76 5F 30 33 22 2C 22 | tch_SubDev_03"," [LK-030A] < 70 72 6F 64 75 63 74 4B 65 79 22 3A 22 67 37 68 | productKey":"a13 [LK-030A] < 30 69 75 38 54 74 31 61 22 7D 2C 7B 22 64 65 76 | FN******"},{"dev [LK-030A] < 69 63 65 4E 61 6D 65 22 3A 22 4C 69 67 68 74 53 | iceName":"LightS [LK-030A] < 77 69 74 63 68 5F 53 75 62 44 65 76 5F 30 34 22 | witch_SubDev_04" [LK-030A] < 2C 22 70 72 6F 64 75 63 74 4B 65 79 22 3A 22 67 | ,"productKey":"a [LK-030A] < 37 68 30 69 75 38 54 74 31 61 22 7D 5D 2C 22 73 | 13FN******"}],"s [LK-030A] < 74 61 74 75 73 22 3A 30 7D 2C 22 76 65 72 73 69 | tatus":0},"versi [LK-030A] < 6F 6E 22 3A 22 31 2E 30 2E 30 22 7D | on":"1.0.0"} msgid : 1312455170 product key : a18wP****** device name : LightSwitchGW params : {"subList":[{"deviceName":"LightSwitch_SubDev_01","productKey":"a13FN******"},{"deviceName":"LightSwitch_SubDev_02","productKey":"a13FN******"},{"deviceName":"LightSwitch_SubDev_03","productKey":"a13FN******"},{"deviceName":"LightSwitch_SubDev_04","productKey":"a13FN******"}],"status":0}
- 添加拓撲關係後,向物聯網平台發送登入子裝置的請求,日誌如下:
[1625466501.399][LK-0309] pub: /ext/session/a18wP******/LightSwitchGW/combine/batch_login [LK-030A] > 7B 22 69 64 22 3A 22 32 22 2C 22 76 65 72 73 69 | {"id":"2","versi [LK-030A] > 6F 6E 22 3A 22 31 2E 30 22 2C 22 70 61 72 61 6D | on":"1.0","param [LK-030A] > 73 22 3A 7B 22 73 69 67 6E 4D 65 74 68 6F 64 22 | s":{"signMethod" [LK-030A] > 3A 22 68 6D 61 63 53 68 61 32 35 36 22 2C 22 64 | :"hmacSha256","d [LK-030A] > 65 76 69 63 65 4C 69 73 74 22 3A 5B 7B 22 70 72 | eviceList":[{"pr [LK-030A] > 6F 64 75 63 74 4B 65 79 22 3A 22 67 37 68 30 69 | oductKey":"a13FN [LK-030A] > 75 38 54 74 31 61 22 2C 22 64 65 76 69 63 65 4E | ******","deviceN [LK-030A] > 61 6D 65 22 3A 22 4C 69 67 68 74 53 77 69 74 63 | ame":"LightSwitc [LK-030A] > 68 5F 53 75 62 44 65 76 5F 30 31 22 2C 22 63 6C | h_SubDev_01","cl [LK-030A] > 69 65 6E 74 49 64 22 3A 22 67 37 68 30 69 75 38 | ientId":"a13FN** [LK-030A] > 54 74 31 61 2E 4C 69 67 68 74 53 77 69 74 63 68 | ****.LightSwitch [LK-030A] > 5F 53 75 62 44 65 76 5F 30 31 22 2C 22 74 69 6D | _SubDev_01","tim [LK-030A] > 65 73 74 61 6D 70 22 3A 22 31 36 32 35 34 36 36 | estamp":"1625466 [LK-030A] > 35 30 31 33 39 36 22 2C 22 63 6C 65 61 6E 53 65 | 501396","cleanSe [LK-030A] > 73 73 69 6F 6E 22 3A 22 66 61 6C 73 65 22 2C 22 | ssion":"false"," [LK-030A] > 73 69 67 6E 22 3A 22 30 46 41 45 38 43 33 43 33 | sign":"0FAE8C3C3 [LK-030A] > 34 38 44 35 30 37 38 38 43 41 42 38 38 42 36 44 | 48D50788CAB88B6D [LK-030A] > 39 44 34 34 43 35 44 35 36 46 45 46 44 42 33 45 | 9D44C5D56FEFDB3E [LK-030A] > 43 46 41 30 30 35 38 37 32 30 41 43 34 45 37 43 | CFA0058720AC4E7C [LK-030A] > 46 36 44 36 34 44 36 22 7D 2C 7B 22 70 72 6F 64 | F******"},{"prod [LK-030A] > 75 63 74 4B 65 79 22 3A 22 67 37 68 30 69 75 38 | uctKey":"a13FN** [LK-030A] > 54 74 31 61 22 2C 22 64 65 76 69 63 65 4E 61 6D | ****","deviceNam [LK-030A] > 65 22 3A 22 4C 69 67 68 74 53 77 69 74 63 68 5F | e":"LightSwitch_ [LK-030A] > 53 75 62 44 65 76 5F 30 32 22 2C 22 63 6C 69 65 | SubDev_02","clie [LK-030A] > 6E 74 49 64 22 3A 22 67 37 68 30 69 75 38 54 74 | ntId":"a13FN**** [LK-030A] > 31 61 2E 4C 69 67 68 74 53 77 69 74 63 68 5F 53 | **.LightSwitch_S [LK-030A] > 75 62 44 65 76 5F 30 32 22 2C 22 74 69 6D 65 73 | ubDev_02","times [LK-030A] > 74 61 6D 70 22 3A 22 31 36 32 35 34 36 36 35 30 | tamp":"162546650 [LK-030A] > 31 33 39 36 22 2C 22 63 6C 65 61 6E 53 65 73 73 | 1396","cleanSess [LK-030A] > 69 6F 6E 22 3A 22 66 61 6C 73 65 22 2C 22 73 69 | ion":"false","si [LK-030A] > 67 6E 22 3A 22 33 31 36 45 45 36 35 37 33 46 31 | gn":"316EE6573F1 [LK-030A] > 35 37 33 38 36 32 41 34 42 37 35 39 45 32 35 42 | 573862A4B759E25B [LK-030A] > 43 32 34 41 32 30 33 44 35 30 31 43 41 30 42 35 | C24A203D501CA0B5 [LK-030A] > 31 44 30 35 30 30 41 32 32 45 34 39 46 42 38 38 | 1D0500A22E49FB88 [LK-030A] > 39 46 32 42 35 22 7D 2C 7B 22 70 72 6F 64 75 63 | *****"},{"produc [LK-030A] > 74 4B 65 79 22 3A 22 67 37 68 30 69 75 38 54 74 | tKey":"g7h0i**** [LK-030A] > 31 61 22 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 | **","deviceName" [LK-030A] > 3A 22 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 | :"LightSwitch_Su [LK-030A] > 62 44 65 76 5F 30 33 22 2C 22 63 6C 69 65 6E 74 | bDev_03","client [LK-030A] > 49 64 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 | Id":"a13FN****** [LK-030A] > 2E 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 | .LightSwitch_Sub [LK-030A] > 44 65 76 5F 30 33 22 2C 22 74 69 6D 65 73 74 61 | Dev_03","timesta [LK-030A] > 6D 70 22 3A 22 31 36 32 35 34 36 36 35 30 31 33 | mp":"16254665013 [LK-030A] > 39 36 22 2C 22 63 6C 65 61 6E 53 65 73 73 69 6F | 96","cleanSessio [LK-030A] > 6E 22 3A 22 66 61 6C 73 65 22 2C 22 73 69 67 6E | n":"false","sign [LK-030A] > 22 3A 22 37 31 30 43 44 43 37 31 36 34 34 35 36 | ":"710CDC7164456 [LK-030A] > 43 39 43 45 41 36 44 39 43 33 30 41 35 44 38 30 | C9CEA6D9C30A5D80 [LK-030A] > 32 33 42 41 32 46 46 45 42 30 32 41 33 46 36 37 | 23BA2FFEB02A3F67 [LK-030A] > 35 41 37 41 34 39 32 34 33 45 33 33 41 32 31 45 | 5A7A49243E33A21E [LK-030A] > 36 36 44 22 7D 2C 7B 22 70 72 6F 64 75 63 74 4B | ***"},{"productK [LK-030A] > 65 79 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 | ey":"a13FN****** [LK-030A] > 22 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 3A 22 | ","deviceName":" [LK-030A] > 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 | LightSwitch_SubD [LK-030A] > 65 76 5F 30 34 22 2C 22 63 6C 69 65 6E 74 49 64 | ev_04","clientId [LK-030A] > 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 2E 4C | ":"a13FN******.L [LK-030A] > 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 65 | ightSwitch_SubDe [LK-030A] > 76 5F 30 34 22 2C 22 74 69 6D 65 73 74 61 6D 70 | v_04","timestamp [LK-030A] > 22 3A 22 31 36 32 35 34 36 36 35 30 31 33 39 36 | ":"1625466501396 [LK-030A] > 22 2C 22 63 6C 65 61 6E 53 65 73 73 69 6F 6E 22 | ","cleanSession" [LK-030A] > 3A 22 66 61 6C 73 65 22 2C 22 73 69 67 6E 22 3A | :"false","sign": [LK-030A] > 22 38 42 35 39 39 34 44 32 39 37 32 45 43 37 46 | "8B5994D2972EC7F [LK-030A] > 42 36 46 42 31 39 39 32 30 39 36 39 43 39 37 31 | B6FB19920969C971 [LK-030A] > 31 44 38 34 45 36 45 42 32 42 36 37 46 41 39 35 | 1D84E6EB2B67FA95 [LK-030A] > 31 43 33 42 34 35 31 41 38 31 39 41 30 44 32 44 | 1C3B451A819***** [LK-030A] > 45 22 7D 5D 7D 7D | *"}]}}
- 網關裝置串連後,通過網關的Topic
- 子裝置登入成功後,物聯網平台向網關返迴響應報文,日誌如下:
[1625466501.500][LK-0309] pub: /ext/session/a18wP******/LightSwitchGW/combine/batch_login_reply [LK-030A] < 7B 22 63 6F 64 65 22 3A 32 30 30 2C 22 64 61 74 | {"code":200,"dat [LK-030A] < 61 22 3A 5B 7B 22 70 72 6F 64 75 63 74 4B 65 79 | a":[{"productKey [LK-030A] < 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 22 2C | ":"a13FN******", [LK-030A] < 22 64 65 76 69 63 65 4E 61 6D 65 22 3A 22 4C 69 | "deviceName":"Li [LK-030A] < 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 65 76 | ghtSwitch_SubDev [LK-030A] < 5F 30 31 22 7D 2C 7B 22 70 72 6F 64 75 63 74 4B | _01"},{"productK [LK-030A] < 65 79 22 3A 22 67 37 68 30 69 75 38 54 74 31 61 | ey":"a13FN****** [LK-030A] < 22 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 3A 22 | ","deviceName":" [LK-030A] < 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 62 44 | LightSwitch_SubD [LK-030A] < 65 76 5F 30 32 22 7D 2C 7B 22 70 72 6F 64 75 63 | ev_02"},{"produc [LK-030A] < 74 4B 65 79 22 3A 22 67 37 68 30 69 75 38 54 74 | tKey":"a13FN**** [LK-030A] < 31 61 22 2C 22 64 65 76 69 63 65 4E 61 6D 65 22 | 1a","deviceName" [LK-030A] < 3A 22 4C 69 67 68 74 53 77 69 74 63 68 5F 53 75 | :"LightSwitch_Su [LK-030A] < 62 44 65 76 5F 30 33 22 7D 2C 7B 22 70 72 6F 64 | bDev_03"},{"prod [LK-030A] < 75 63 74 4B 65 79 22 3A 22 67 37 68 30 69 75 38 | uctKey":"a13FN** [LK-030A] < 54 74 31 61 22 2C 22 64 65 76 69 63 65 4E 61 6D | ****","deviceNam [LK-030A] < 65 22 3A 22 4C 69 67 68 74 53 77 69 74 63 68 5F | e":"LightSwitch_ [LK-030A] < 53 75 62 44 65 76 5F 30 34 22 7D 5D 2C 22 69 64 | SubDev_04"}],"id [LK-030A] < 22 3A 22 32 22 2C 22 6D 65 73 73 61 67 65 22 3A | ":"2","message": [LK-030A] < 22 73 75 63 63 65 73 73 22 7D | "success"} msgid : 2 code : 200 product key : a18wP****** device name : LightSwitchGW message : success data : [{"productKey":"a13FN******","deviceName":"LightSwitch_SubDev_01"},{"productKey":"a13FN******","deviceName":"LightSwitch_SubDev_02"},{"productKey":"a13FN******","deviceName":"LightSwitch_SubDev_03"},{"productKey":"a13FN******","deviceName":"LightSwitch_SubDev_04"}]
- 可選:如果您配置子裝置訂閱Topic相關代碼,網關裝置將收到如下日誌。該日誌表示子裝置已訂閱Topic
/a13FN******/LightSwitch_SubDev_01/user/get
。[1625470230.077][LK-0309] sub: /a13FN******/LightSwitch_SubDev_01/user/get
Topic訂閱成功後,您可以登入物聯網平台控制台,在裝置詳情頁面的Topic列表頁簽,單擊訂閱的Topic操作欄的發布訊息,然後在發布訊息對話方塊的訊息輸入欄中,輸入一條訊息(例如:This is a test message from Alibaba Iot Platform.),類比從物聯網平台向子裝置發送資訊。
網關裝置收到訊息後,列印如下日誌。重要 您需自行編寫代碼邏輯,將網關裝置接收到的訊息轉寄到裝置。[1625472952.433][LK-0309] pub: /a13FN******/LightSwitch_SubDev_01/user/get [LK-030A] < 54 68 69 73 20 69 73 20 61 20 74 65 73 74 20 6D | This is a test m [LK-030A] < 65 73 73 61 67 65 20 66 72 6F 6D 20 41 6C 69 62 | essage from Alib [LK-030A] < 61 62 61 20 49 6F 74 20 50 6C 61 74 66 6F 72 6D | aba Iot Platform [LK-030A] < 2E | . pub, qos: 0, topic: /a13FN******/LightSwitch_SubDev_01/user/get pub, payload: This is a test message from Alibaba Iot Platform.
- 批量上報子裝置訊息的日子如下。
[1629707578.833][LK-0309] pub[4]: /sys/a18Wp******/LightSwitchGW/proxy/batch_post [LK-030A] > 7B 22 69 64 22 3A 22 33 22 2C 22 76 65 72 73 69 | {"id":"3","versi [LK-030A] > 6F 6E 22 3A 22 31 2E 30 22 2C 22 70 61 72 61 6D | on":"1.0","param [LK-030A] > 73 22 3A 5B 7B 22 74 6F 70 69 63 22 3A 22 2F 73 | s":[{"topic":"/s [LK-030A] > 79 73 2F 61 31 58 48 53 67 64 4B 42 37 4F 2F 73 | ys/a13FN******/s [LK-030A] > 75 62 5F 64 65 76 69 63 65 5F 74 65 73 74 5F 30 | ub_device_test_0 [LK-030A] > 30 30 31 2F 74 68 69 6E 67 2F 65 76 65 6E 74 2F | 001/thing/event/ [LK-030A] > 70 72 6F 70 65 72 74 79 2F 70 6F 73 74 22 2C 22 | property/post"," [LK-030A] > 70 61 79 6C 6F 61 64 22 3A 22 65 79 4A 70 5A 43 | payload":"eyJpZC [LK-030A] > 49 36 49 6A 45 69 4C 43 4A 32 5A 58 4A 7A 61 57 | I6IjEiLCJ2ZXJzaW [LK-030A] > 39 75 49 6A 6F 69 4D 53 34 77 49 69 77 69 63 47 | 9uIjoiMS4wIiwicG [LK-030A] > 46 79 59 57 31 7A 49 6A 70 37 49 6E 42 49 49 6A | FyYW1zIjp7InBIIj [LK-030A] > 6F 31 66 58 30 41 22 7D 2C 7B 22 74 6F 70 69 63 | o1fX0A"},{"topic [LK-030A] > 22 3A 22 2F 73 79 73 2F 61 31 58 48 53 67 64 4B | ":"/sys/a13FNgdK [LK-030A] > 42 37 4F 2F 73 75 62 5F 64 65 76 69 63 65 5F 74 | B7O/sub_device_t [LK-030A] > 65 73 74 5F 30 30 30 32 2F 74 68 69 6E 67 2F 65 | est_0002/thing/e [LK-030A] > 76 65 6E 74 2F 70 72 6F 70 65 72 74 79 2F 70 6F | vent/property/po [LK-030A] > 73 74 22 2C 22 70 61 79 6C 6F 61 64 22 3A 22 65 | st","payload":"e [LK-030A] > 79 4A 70 5A 43 49 36 49 6A 45 69 4C 43 4A 32 5A | yJpZCI6IjEiLCJ2Z [LK-030A] > 58 4A 7A 61 57 39 75 49 6A 6F 69 4D 53 34 77 49 | XJzaW9uIjoiMS4wI [LK-030A] > 69 77 69 63 47 46 79 59 57 31 7A 49 6A 70 37 49 | iwicGFyYW1zIjp7I [LK-030A] > 6E 42 49 49 6A 6F 31 66 58 30 41 22 7D 2C 7B 22 | nBIIjo1fX0A"},{" [LK-030A] > 74 6F 70 69 63 22 3A 22 2F 73 79 73 2F 61 31 58 | topic":"/sys/a1X [LK-030A] > 48 53 67 64 4B 42 37 4F 2F 73 75 62 5F 64 65 76 | HS******/sub_dev [LK-030A] > 69 63 65 5F 74 65 73 74 5F 30 30 30 33 2F 74 68 | ice_test_0003/th [LK-030A] > 69 6E 67 2F 65 76 65 6E 74 2F 70 72 6F 70 65 72 | ing/event/proper [LK-030A] > 74 79 2F 70 6F 73 74 22 2C 22 70 61 79 6C 6F 61 | ty/post","payload" [LK-030A] > 64 22 3A 22 65 79 4A 70 5A 43 49 36 49 6A 45 69 | :"eyJpZCI6IjEi [LK-030A] > 4C 43 4A 32 5A 58 4A 7A 61 57 39 75 49 6A 6F 69 | LCJ2ZXJzaW9uIjoi [LK-030A] > 4D 53 34 77 49 69 77 69 63 47 46 79 59 57 31 7A | MS4wIiwicGFyYW1z [LK-030A] > 49 6A 70 37 49 6E 42 49 49 6A 6F 31 66 58 30 41 | Ijp7InBIIjo1fX0A [LK-030A] > 22 7D 2C 7B 22 74 6F 70 69 63 22 3A 22 2F 73 79 | "},{"topic":"/sy [LK-030A] > 73 2F 61 31 58 48 53 67 64 4B 42 37 4F 2F 73 75 | s/a13FN******/su [LK-030A] > 62 5F 64 65 76 69 63 65 5F 74 65 73 74 5F 30 30 | b_device_test_00 [LK-030A] > 30 34 2F 74 68 69 6E 67 2F 65 76 65 6E 74 2F 70 | 04/thing/event/p [LK-030A] > 72 6F 70 65 72 74 79 2F 70 6F 73 74 22 2C 22 70 | roperty/post","p [LK-030A] > 61 79 6C 6F 61 64 22 3A 22 65 79 4A 70 5A 43 49 | ayload":"eyJpZCI [LK-030A] > 36 49 6A 45 69 4C 43 4A 32 5A 58 4A 7A 61 57 39 | 6IjEiLCJ2ZXJzaW9 [LK-030A] > 75 49 6A 6F 69 4D 53 34 77 49 69 77 69 63 47 46 | uIjoiMS4wIiwicGF [LK-030A] > 79 59 57 31 7A 49 6A 70 37 49 6E 42 49 49 6A 6F | yYW1zIjp7InBIIjo [LK-030A] > 31 66 58 30 41 22 7D 2C 7B 22 74 6F 70 69 63 22 | 1fX0A"},{"topic" [LK-030A] > 3A 22 2F 73 79 73 2F 61 31 58 48 53 67 64 4B 42 | :"/sys/a13FNgdKB [LK-030A] > 37 4F 2F 73 75 62 5F 64 65 76 69 63 65 5F 74 65 | 7O/sub_device_te [LK-030A] > 73 74 5F 30 30 30 31 2F 74 68 69 6E 67 2F 65 76 | st_0001/thing/ev [LK-030A] > 65 6E 74 2F 70 72 6F 70 65 72 74 79 2F 70 6F 73 | ent/property/pos [LK-030A] > 74 22 2C 22 70 61 79 6C 6F 61 64 22 3A 22 65 79 | t","payload":"ey [LK-030A] > 4A 70 5A 43 49 36 49 6A 45 69 4C 43 4A 32 5A 58 | JpZCI6IjEiLCJ2ZX [LK-030A] > 4A 7A 61 57 39 75 49 6A 6F 69 4D 53 34 77 49 69 | JzaW9uIjoiMS4wIi [LK-030A] > 77 69 63 47 46 79 59 57 31 7A 49 6A 70 37 49 6E | wicGFyYW1zIjp7In [LK-030A] > 42 49 49 6A 6F 31 66 58 30 41 22 7D 2C 7B 22 74 | BIIjo1fX0A"},{"t [LK-030A] > 6F 70 69 63 22 3A 22 2F 73 79 73 2F 61 31 58 48 | opic":"/sys/a1XH [LK-030A] > 53 67 64 4B 42 37 4F 2F 73 75 62 5F 64 65 76 69 | S******/sub_devi [LK-030A] > 63 65 5F 74 65 73 74 5F 30 30 30 32 2F 74 68 69 | ce_test_0002/thi [LK-030A] > 6E 67 2F 65 76 65 6E 74 2F 70 72 6F 70 65 72 74 | ng/event/propert [LK-030A] > 79 2F 70 6F 73 74 22 2C 22 70 61 79 6C 6F 61 64 | y/post","payload [LK-030A] > 22 3A 22 65 79 4A 70 5A 43 49 36 49 6A 45 69 4C | ":"eyJpZCI6IjEiL [LK-030A] > 43 4A 32 5A 58 4A 7A 61 57 39 75 49 6A 6F 69 4D | CJ2ZXJzaW9uIjoiM [LK-030A] > 53 34 77 49 69 77 69 63 47 46 79 59 57 31 7A 49 | S4wIiwicGFyYW1zI [LK-030A] > 6A 70 37 49 6E 42 49 49 6A 6F 31 66 58 30 41 22 | jp7InBIIjo1fX0A" [LK-030A] > 7D 2C 7B 22 74 6F 70 69 63 22 3A 22 2F 73 79 73 | },{"topic":"/sys [LK-030A] > 2F 61 31 58 48 53 67 64 4B 42 37 4F 2F 73 75 62 | /a13FN******/sub [LK-030A] > 5F 64 65 76 69 63 65 5F 74 65 73 74 5F 30 30 30 | _device_test_000 [LK-030A] > 33 2F 74 68 69 6E 67 2F 65 76 65 6E 74 2F 70 72 | 3/thing/event/pr [LK-030A] > 6F 70 65 72 74 79 2F 70 6F 73 74 22 2C 22 70 61 | operty/post","pa [LK-030A] > 79 6C 6F 61 64 22 3A 22 65 79 4A 70 5A 43 49 36 | yload":"eyJpZCI6 [LK-030A] > 49 6A 45 69 4C 43 4A 32 5A 58 4A 7A 61 57 39 75 | IjEiLCJ2ZXJzaW9u [LK-030A] > 49 6A 6F 69 4D 53 34 77 49 69 77 69 63 47 46 79 | IjoiMS4wIiwicGFy [LK-030A] > 59 57 31 7A 49 6A 70 37 49 6E 42 49 49 6A 6F 31 | YW1zIjp7InBIIjo1 [LK-030A] > 66 58 30 41 22 7D 5D 7D | fX0A"}]} [1629707578.955][LK-0309] pub: /sys/a18Wp******/LightSwitchGW/proxy/batch_post_reply [LK-030A] < 7B 22 63 6F 64 65 22 3A 32 30 30 2C 22 64 61 74 | {"code":200,"dat [LK-030A] < 61 22 3A 5B 7B 22 63 6F 64 65 22 3A 32 30 30 2C | a":[{"code":200, [LK-030A] < 22 74 6F 70 69 63 22 3A 22 2F 73 79 73 2F 61 31 | "topic":"/sys/a1 [LK-030A] < 58 48 53 67 64 4B 42 37 4F 2F 73 75 62 5F 64 65 | XHS******/sub_de [LK-030A] < 76 69 63 65 5F 74 65 73 74 5F 30 30 30 31 2F 74 | vice_test_0001/t [LK-030A] < 68 69 6E 67 2F 65 76 65 6E 74 2F 70 72 6F 70 65 | hing/event/prope [LK-030A] < 72 74 79 2F 70 6F 73 74 22 7D 2C 7B 22 63 6F 64 | rty/post"},{"cod [LK-030A] < 65 22 3A 32 30 30 2C 22 74 6F 70 69 63 22 3A 22 | e":200,"topic":" [LK-030A] < 2F 73 79 73 2F 61 31 58 48 53 67 64 4B 42 37 4F | /sys/a13FN****** [LK-030A] < 2F 73 75 62 5F 64 65 76 69 63 65 5F 74 65 73 74 | /sub_device_test [LK-030A] < 5F 30 30 30 32 2F 74 68 69 6E 67 2F 65 76 65 6E | _0002/thing/even [LK-030A] < 74 2F 70 72 6F 70 65 72 74 79 2F 70 6F 73 74 22 | t/property/post" [LK-030A] < 7D 2C 7B 22 63 6F 64 65 22 3A 32 30 30 2C 22 74 | },{"code":200,"t [LK-030A] < 6F 70 69 63 22 3A 22 2F 73 79 73 2F 61 31 58 48 | opic":"/sys/a1XH [LK-030A] < 53 67 64 4B 42 37 4F 2F 73 75 62 5F 64 65 76 69 | S******/sub_devi [LK-030A] < 63 65 5F 74 65 73 74 5F 30 30 30 33 2F 74 68 69 | ce_test_0003/thi [LK-030A] < 6E 67 2F 65 76 65 6E 74 2F 70 72 6F 70 65 72 74 | ng/event/propert [LK-030A] < 79 2F 70 6F 73 74 22 7D 2C 7B 22 63 6F 64 65 22 | y/post"},{"code" [LK-030A] < 3A 32 30 30 2C 22 74 6F 70 69 63 22 3A 22 2F 73 | :200,"topic":"/s [LK-030A] < 79 73 2F 61 31 58 48 53 67 64 4B 42 37 4F 2F 73 | ys/a13FN******/s [LK-030A] < 75 62 5F 64 65 76 69 63 65 5F 74 65 73 74 5F 30 | ub_device_test_0 [LK-030A] < 30 30 34 2F 74 68 69 6E 67 2F 65 76 65 6E 74 2F | 004/thing/event/ [LK-030A] < 70 72 6F 70 65 72 74 79 2F 70 6F 73 74 22 7D 2C | property/post"}, [LK-030A] < 7B 22 63 6F 64 65 22 3A 32 30 30 2C 22 74 6F 70 | {"code":200,"top [LK-030A] < 69 63 22 3A 22 2F 73 79 73 2F 61 31 58 48 53 67 | ic":"/sys/a13FNg [LK-030A] < 64 4B 42 37 4F 2F 73 75 62 5F 64 65 76 69 63 65 | dKB7O/sub_device [LK-030A] < 5F 74 65 73 74 5F 30 30 30 31 2F 74 68 69 6E 67 | _test_0001/thing [LK-030A] < 2F 65 76 65 6E 74 2F 70 72 6F 70 65 72 74 79 2F | /event/property/ [LK-030A] < 70 6F 73 74 22 7D 2C 7B 22 63 6F 64 65 22 3A 32 | post"},{"code":2 [LK-030A] < 30 30 2C 22 74 6F 70 69 63 22 3A 22 2F 73 79 73 | 00,"topic":"/sys [LK-030A] < 2F 61 31 58 48 53 67 64 4B 42 37 4F 2F 73 75 62 | /a13FN******/sub [LK-030A] < 5F 64 65 76 69 63 65 5F 74 65 73 74 5F 30 30 30 | _device_test_000 [LK-030A] < 32 2F 74 68 69 6E 67 2F 65 76 65 6E 74 2F 70 72 | 2/thing/event/pr [LK-030A] < 6F 70 65 72 74 79 2F 70 6F 73 74 22 7D 2C 7B 22 | operty/post"},{" [LK-030A] < 63 6F 64 65 22 3A 32 30 30 2C 22 74 6F 70 69 63 | code":200,"topic [LK-030A] < 22 3A 22 2F 73 79 73 2F 61 31 58 48 53 67 64 4B | ":"/sys/a13FNgdK [LK-030A] < 42 37 4F 2F 73 75 62 5F 64 65 76 69 63 65 5F 74 | B7O/sub_device_t [LK-030A] < 65 73 74 5F 30 30 30 33 2F 74 68 69 6E 67 2F 65 | est_0003/thing/e [LK-030A] < 76 65 6E 74 2F 70 72 6F 70 65 72 74 79 2F 70 6F | vent/property/po [LK-030A] < 73 74 22 7D 5D 7D | st"}]}
- 可選:如果您配置了子裝置發送訊息的相關代碼,裝置端列印以下日誌,說明子裝置通過Topic
/a13FN******/LightSwitch_SubDev_01/user/update
,向物聯網平台上報了一條訊息。[1625470230.077][LK-0309] pub: /a13FN******/LightSwitch_SubDev_01/user/update [LK-030A] > 7B 22 69 64 22 3A 22 31 22 2C 22 76 65 72 73 69 | {"id":"1","versi [LK-030A] > 6F 6E 22 3A 22 31 2E 30 22 2C 22 70 61 72 61 6D | on":"1.0","param [LK-030A] > 73 22 3A 7B 22 4C 69 67 68 74 53 77 69 74 63 68 | s":{"LightSwitch [LK-030A] > 22 3A 30 7D 7D | ":0}}
物聯網平台日誌
您可以在物聯網平台控制台,查看裝置的狀態和作業記錄。
- 在左側導覽列,選擇 ,找到網關裝置和子裝置,查看裝置狀態。裝置狀態顯示為線上,則表示裝置與物聯網平台成功串連。
在左側導覽列,選擇 ,選擇產品後,查看裝置上線、訂閱Topic和上報訊息的日誌。
- 選擇網關對應的產品後,日誌如下圖所示。您可以查看網關與子裝置建立拓撲關係的過程。
單擊查看按鈕,您可查看每一條日誌訊息的內容。
- 選擇子裝置對應的產品後,日誌如下圖所示。子裝置LightSwitch_SubDev_01登入後,訂閱了Topic,並接收了來自物聯網平台的訊息。
- 選擇網關對應的產品後,日誌如下圖所示。您可以查看網關與子裝置建立拓撲關係的過程。
後續步驟
作業記錄中出現的錯誤資訊,請參見aiot_subdev_api.h中的狀態代碼描述,根據提示解決問題。