Azure

Connect to the Azure IoT cloud service platform.

Micropython API IoT_Hub


//Initialize connection
azure = IoT_Hub(connection_string='')

//Certificate access method
azure = IoT_Hub(device_id=``, host_name='', ssl=True, cert_file_path=``, private_key_path='')

//Enable connection
azure.start()

//direct_method information subscription
azure.subscribe_direct_method(topic, azure_direct_fun)

//Monitor cloud data callback
azure.subscribe_C2D_message(azure_C2D_cb)

//Publish data to the cloud
azure.publish_D2C_message()

//Upload data to cloud device instance (Device Twin)
azure.update_twin_reported_properties(key1='value',key2='value')

//Transfer data to the cloud device instance (Device Twin) in response to callback
azure.subscribe_twin_desired_response(azure_desired_cb)

//Get the attributes owned by the cloud device instance (Device Twin)
azure.retrieve_twin_properties()

Micropython API IoT_Central


//Initialize connection
azure = IoT_Central(scope_id=``, device_id='', device_key='')

//Enable connection
azure.start()

//direct_method information subscription
azure.subscribe_direct_method(topic, azure_direct_fun)

//Monitor cloud data callback
azure.subscribe_C2D_message(azure_C2D_cb)

//Publish data to the cloud
azure.publish_D2C_message()

//Upload data to cloud device instance (Device Twin)
azure.update_twin_reported_properties(key1='value',key2='value')

//Transfer data to the cloud device instance (Device Twin) in response to callback
azure.subscribe_twin_desired_response(azure_desired_cb)

//Get the attributes owned by the cloud device instance (Device Twin)
azure.retrieve_twin_properties()
On This Page