Overview

Updated at:

When you develop products using Python, you can use the Python software development kit (SDK) provided by IoT Platform to simplify development and quickly connect devices. This topic describes the features of the Python SDK and provides instructions on how to use it.

Instructions

The Python SDK is available in two series: Paho-SDK and Link SDK.

  • Paho-MQTT Python is based on the open source Paho-Python and provides basic connection and messaging features. It is suitable for users who want to develop their code from scratch. You can integrate advanced features on demand based on the Alink protocol.

  • The Link SDK implements both basic and advanced features of IoT Platform. It is suitable for users who need advanced features, such as Thing Specification Language (TSL) models, over-the-air (OTA) updates, and gateways. This chapter focuses on the Python Link SDK series.

Features

Type

Feature module

Description

References

Device connection

MQTT connection

Establishes a connection between a device and IoT Platform over the Message Queuing Telemetry Transport (MQTT) protocol. This enables communication between the device and IoT Platform.

Important

If you need IoT Platform to actively push messages to a device, connect the device using the MQTT protocol.

Communication based on MQTT topics

Messaging

RRPC

Supports synchronous calls from IoT Platform to a device.

RRPC capabilities

Device management

Thing Specification Model

Manage devices based on TSL models without having to handle the data exchange format between devices and IoT Platform. This reduces development costs.

TSL model communication

Device tags

Define custom IDs for devices to manage them flexibly.

Device tags

Device shadow

Caches device status. When a device is online, it can directly receive instructions from the cloud. After a device goes offline, it can pull instructions from the cloud when it comes back online.

Device shadow

Gateways and sub-devices

Connect a device gateway to IoT Platform. This allows devices without an IP address to connect to IoT Platform indirectly.

Gateways and sub-devices

Monitoring and O&M

OTA update

Enables device-side upgrades through IoT Platform.

  1. A device receives upgrade messages pushed from IoT Platform and downloads the upgrade package.

  2. The device writes the downloaded package to its Flash or ROM to apply the upgrade and complete the OTA update.

Device OTA updates