I am trying to register and provision the devices(using Azure python sdk) on IoT central using the example : Github- Iot_Central_Python_Sample
This sample code also has an option to assign a template to a device during the registration and it is done using:
provisioning_device_client.provisioning_payload = '{"iotcModelId":"%s"}' % (model_identity)
And device info on IoT central once it gets registered
Here the idea is to send info in payload during registration of the device. Similarly we can send any other info in payload as well. Now what I want is to change the name of Device to lets say "xyz_device". I tried sending the name of device in above mentioned payload as:
provisioning_device_client.provisioning_payload = '{"iotcModelId":"%s", "iotcDisplayName":"%s"}' % (model_identity,"xyz_device")
But was unable to change the name of device on IoT central. Instead of using "iotcDisplayName" as key I also tried using "iotcDeviceName" but still no success.
Can some help me out that how can we change the name of device on IoT central during device registration.
Any help would really be appreciated.
There is no document which will be described a payload object for customizing a device provisioning for IoT Central app. Some feature of using a payload for passing additional properties during the device registration call is here.
However, for changing a device name you can use the REST API Devices - Set, see the following example:
PUT
https://rk2020iotc.azureiotcentral.com/api/preview/devices/groupdpsttestdevice2
headers:
Authorization:<sas-token>
body:
{
"displayName":"xyz_device",
"instanceOf":"urn:q4wlmqvfhh:modelDefinition:ckuivfcyep"
}