sur l'appareil et dans la console IoT Platform, consultez les journaux..
Informations générales
Pour plus d'informations, consultez Exemple.
no heading
Journaux de l'appareil
Consultez les résultats d'exécution sur l'appareil.
-
Journaux de connexion :
[1626317181.277][LK-0313] MQTT user calls aiot_mqtt_connect api, connect [1626317181.277][LK-0317] LightSwitch&a1wP****** [1626317181.277][LK-0318] 97B797D367BF307A0573979CF6CCA5675719F6790B361F2596E01B72AC6813B4 core_sysdep_network_establish host iot-06******.mqtt.iothub.aliyuncs.comuncs.com port 1883, type 0 establish tcp connection with server(host='iot-06******.mqtt.iothub.aliyuncs.comuncs.com', port=[1883]) success to establish tcp, fd=3 local port: 38522 [1626317181.300][LK-1000] establish mbedtls connection with server(host='iot-06******.mqtt.iothub.aliyuncs.comuncs.com', port=[1883]) [1626317181.388][LK-1000] success to establish mbedtls connection, (cost 44947 bytes in total, max used 47859 bytes) [1626317181.388][LK-0319] a1wP******.LightSwitch|timestamp=2524608000000,_ss=1,_v=sdk-c-4.1.0,securemode=2,signmethod=hmacsha256,ext=3,_conn=tls_6b| [1626317181.433][LK-0313] MQTT connect success in 161 ms AIOT_MQTTEVT_CONNECT -
Journaux générés lorsque l'appareil soumet des données d'état
-
Journaux de requête
[1626317187.433][LK-0309] pub: /shadow/update/a1wP******/LightSwitch [LK-030A] > 7B 22 6D 65 74 68 6F 64 22 3A 22 75 70 64 61 74 | {"method":"update", [LK-030A] > 65 22 2C 22 73 74 61 74 65 22 3A 7B 22 72 65 70 | "state":{"reported" [LK-030A] > 6F 72 74 65 64 22 3A 7B 22 4C 69 67 68 74 53 77 | :{"LightSwitch" [LK-030A] > 69 74 63 68 22 3A 31 7D 7D 2C 22 76 65 72 73 69 | :1}},"versi [LK-030A] > 6F 6E 22 3A 30 7D | on":0} -
Journaux de réponse
[1626317187.477][LK-0309] pub: /shadow/get/a1wP******/LightSwitch [LK-030A] < 7B 22 6D 65 74 68 6F 64 22 3A 22 72 65 70 6C 79 | {"method":"reply [LK-030A] < 22 2C 22 70 61 79 6C 6F 61 64 22 3A 7B 22 73 74 | ","payload":{"st [LK-030A] < 61 74 75 73 22 3A 22 73 75 63 63 65 73 73 22 2C | atus":"success", [LK-030A] < 22 76 65 72 73 69 6F 6E 22 3A 30 7D 2C 22 63 6C | "version":0},"cl [LK-030A] < 69 65 6E 74 54 6F 6B 65 6E 22 3A 22 6E 75 6C 6C | ientToken":"null [LK-030A] < 22 2C 22 74 69 6D 65 73 74 61 6D 70 22 3A 31 36 | ","timestamp":16 [LK-030A] < 32 36 33 31 37 31 38 37 7D | 26317187} [1626317187.477][LK-1304] SHADOW recv get_reply message demo_shadow_recv_handler, type = 0, productKey = a1wP******, deviceName = LightSwitch payload = "{"status":"success","version":0}", status = success, timestamp = 1626317187
-
-
Journaux générés lorsque les applications modifient l'état de l'appareil
-
IoT Platform envoie une propriété souhaitée à l'appareil.
Dans cet exemple, IoT Platform envoie la propriété souhaitée
{"LightSwitch":0}à l'appareil. Après réception du message, l'appareil imprime les données de journal suivantes :[1626319658.166][LK-0309] pub: /shadow/get/a1wP******/LightSwitch [LK-030A] < 7B 22 6D 65 74 68 6F 64 22 3A 22 63 6F 6E 74 72 | {"method":"contr [LK-030A] < 6F 6C 22 2C 22 70 61 79 6C 6F 61 64 22 3A 7B 22 | ol","payload":{" [LK-030A] < 73 74 61 74 65 22 3A 7B 22 64 65 73 69 72 65 64 | state":{"desired [LK-030A] < 22 3A 7B 22 4C 69 67 68 74 53 77 69 74 63 68 22 | ":{"LightSwitch" [LK-030A] < 3A 30 7D 7D 2C 22 6D 65 74 61 64 61 74 61 22 3A | :0}},"metadata": [LK-030A] < 7B 22 64 65 73 69 72 65 64 22 3A 7B 22 4C 69 67 | {"desired":{"Lig [LK-030A] < 68 74 53 77 69 74 63 68 22 3A 7B 22 74 69 6D 65 | htSwitch":{"time [LK-030A] < 73 74 61 6D 70 22 3A 31 36 32 36 33 31 39 36 35 | stamp":162631965 [LK-030A] < 38 7D 7D 7D 7D 2C 22 74 69 6D 65 73 74 61 6D 70 | 8}}}},"timestamp [LK-030A] < 22 3A 31 36 32 36 33 31 39 36 35 38 2C 22 76 65 | ":1626319658,"ve [LK-030A] < 72 73 69 6F 6E 22 3A 34 7D | rsion":0} [1626319658.166][LK-1304] SHADOW recv control message demo_shadow_recv_handler, type = 1, productKey = a1wP******, deviceName = LightSwitch payload = "{"state":{"desired":{"LightSwitch":0}},"metadata":{"desired":{"LightSwitch":{"timestamp":1626319658}}}}", version = 4 -
L'appareil soumet la dernière propriété après avoir mis à jour la propriété locale.
ImportantLe code d'exemple est fourni à titre indicatif uniquement. Dans les scénarios professionnels réels, spécifiez la logique de traitement pour mettre à jour automatiquement la propriété locale.
[1626317203.433][LK-0309] pub: /shadow/update/a1wP******/LightSwitch [LK-030A] > 7B 22 6D 65 74 68 6F 64 22 3A 22 75 70 64 61 74 | {"method":"update", [LK-030A] > 65 22 2C 22 73 74 61 74 65 22 3A 7B 22 72 65 70 | "state":{"rep [LK-030A] > 6F 72 74 65 64 22 3A 7B 22 4C 69 67 68 74 53 77 | orted":{"LightSw [LK-030A] > 69 74 63 68 22 3A 31 7D 7D 2C 22 76 65 72 73 69 | itch":0}},"versi [LK-030A] > 6F 6E 22 3A 30 7D | on":1} -
L'appareil envoie une requête pour supprimer la propriété souhaitée dans IoT Platform.
[1626320515.566][LK-0309] pub: /shadow/update/a1wP******/LightSwitch [LK-030A] > 7B 22 6D 65 74 68 6F 64 22 3A 22 75 70 64 61 74 | {"method":"update", [LK-030A] > 65 22 2C 22 73 74 61 74 65 22 3A 7B 22 64 65 73 | "state":{"desired" [LK-030A] > 69 72 65 64 22 3A 22 6E 75 6C 6C 22 7D 2C 22 76 | :"null"},"version" [LK-030A] > 65 72 73 69 6F 6E 22 3A 35 7D | :2} -
IoT Platform renvoie une réponse.
[1626320515.600][LK-0309] pub: /shadow/get/a1wP******/LightSwitch [LK-030A] < 7B 22 6D 65 74 68 6F 64 22 3A 22 72 65 70 6C 79 | {"method":"reply [LK-030A] < 22 2C 22 70 61 79 6C 6F 61 64 22 3A 7B 22 73 74 | ","payload":{"st [LK-030A] < 61 74 75 73 22 3A 22 73 75 63 63 65 73 73 22 2C | atus":"success", [LK-030A] < 22 76 65 72 73 69 6F 6E 22 3A 35 7D 2C 22 63 6C | "version":5},"cl [LK-030A] < 69 65 6E 74 54 6F 6B 65 6E 22 3A 22 6E 75 6C 6C | ientToken":"null [LK-030A] < 22 2C 22 74 69 6D 65 73 74 61 6D 70 22 3A 31 36 | ","timestamp":16 [LK-030A] < 32 36 33 32 30 35 31 35 7D | 26320515} [1626320515.600][LK-1304] SHADOW recv get_reply message demo_shadow_recv_handler, type = 0, productKey = a1wP******, deviceName = LightSwitch payload = "{"status":"success","version":5}", status = success, timestamp = 1626320515
-
-
Journaux générés lorsque l'appareil demande le Device Shadow
-
Journaux de requête
[1626320690.499][LK-0309] pub: /shadow/update/a1wP******/LightSwitch [LK-030A] > 7B 22 6D 65 74 68 6F 64 22 3A 22 67 65 74 22 7D | {"method":"get"} -
Journaux de réponse :
Les données de journal suivantes indiquent que la propriété souhaitée et la propriété soumise n'existent pas dans le Device Shadow :
[1626320690.522][LK-0309] pub: /shadow/get/a1wP******/LightSwitch [LK-030A] < 7B 22 6D 65 74 68 6F 64 22 3A 22 72 65 70 6C 79 | {"method":"reply [LK-030A] < 22 2C 22 70 61 79 6C 6F 61 64 22 3A 7B 22 73 74 | ","payload":{"st [LK-030A] < 61 74 75 73 22 3A 22 73 75 63 63 65 73 73 22 2C | atus":"success", [LK-030A] < 22 73 74 61 74 65 22 3A 7B 22 72 65 70 6F 72 74 | "state":{"report [LK-030A] < 65 64 22 3A 7B 7D 7D 2C 22 6D 65 74 61 64 61 74 | ed":{}},"metadat [LK-030A] < 61 22 3A 7B 22 72 65 70 6F 72 74 65 64 22 3A 7B | a":{"reported":{ [LK-030A] < 7D 7D 7D 2C 22 74 69 6D 65 73 74 61 6D 70 22 3A | }}},"timestamp": [LK-030A] < 31 36 32 36 33 32 30 36 39 30 2C 22 76 65 72 73 | 1626320690,"vers [LK-030A] < 69 6F 6E 22 3A 35 2C 22 63 6C 69 65 6E 74 54 6F | ion":5,"clientTo [LK-030A] < 6B 65 6E 22 3A 22 6E 75 6C 6C 22 7D | ken":"null"} [1626320690.522][LK-1304] SHADOW recv generic_reply message demo_shadow_recv_handler, type = 2, productKey = a1wP******, deviceName = LightSwitch payload = "{"status":"success","state":{"reported":{}},"metadata":{"reported":{}}}", version = 5
-
-
Journaux générés lorsque l'appareil supprime toutes les propriétés du Device Shadow
-
Journaux de requête
Les données de journal suivantes indiquent que l'appareil souhaite supprimer toutes les propriétés :
[1626321049.222][LK-0309] pub: /shadow/update/a1wP******/LightSwitch [LK-030A] > 7B 22 6D 65 74 68 6F 64 22 3A 22 64 65 6C 65 74 | {"method":"delete", [LK-030A] > 65 22 2C 22 73 74 61 74 65 22 3A 7B 22 72 65 70 | "state":{"reported" [LK-030A] > 6F 72 74 65 64 22 3A 7B 22 4C 69 67 68 74 53 77 | :{"LightSwitch" [LK-030A] > 69 74 63 68 22 3A 22 6E 75 6C 6C 22 7D 7D 2C 22 | :"null"}}," [LK-030A] > 76 65 72 73 69 6F 6E 22 3A 39 7D | version":2} -
Journaux de réponse
Les données de journal suivantes indiquent qu'IoT Platform a reçu la requête :
[1626321049.255][LK-0309] pub: /shadow/get/a1wP******/LightSwitch [LK-030A] < 7B 22 6D 65 74 68 6F 64 22 3A 22 72 65 70 6C 79 | {"method":"reply [LK-030A] < 22 2C 22 70 61 79 6C 6F 61 64 22 3A 7B 22 73 74 | ","payload":{"st [LK-030A] < 61 74 75 73 22 3A 22 73 75 63 63 65 73 73 22 2C | atus":"success", [LK-030A] < 22 76 65 72 73 69 6F 6E 22 3A 39 7D 2C 22 63 6C | "version":2},"cl [LK-030A] < 69 65 6E 74 54 6F 6B 65 6E 22 3A 22 6E 75 6C 6C | ientToken":"null [LK-030A] < 22 2C 22 74 69 6D 65 73 74 61 6D 70 22 3A 31 36 | ","timestamp":16 [LK-030A] < 32 36 33 32 31 30 34 39 7D | 26321049} [1626321049.255][LK-1304] SHADOW recv get_reply message demo_shadow_recv_handler, type = 0, productKey = a1wP******, deviceName = LightSwitch payload = "{"status":"success","version":2}", status = success, timestamp = 1626321049
-
no heading
Journaux IoT Platform
Consultez l'état de l'appareil et les journaux dans la console IoT Platform.
Dans le volet de navigation de gauche, choisissez . Recherchez votre appareil et vérifiez son état. Un état Online indique que l'appareil est connecté avec succès à IoT Platform.
Dans le volet de navigation de gauche, sélectionnez , puis sélectionnez un produit pour afficher les journaux relatifs aux Device Shadows.