Once a firmware is defined for the thing definition, you can perform firmware updates by using the Thing Firmware widget or via API requests.
In each case, when a firmware update is triggered, the cloud sends a message to the remote product.
If you are using the STC Connector, based on the MQTT protocol, here is an example of an update message.
TOPIC <username>/<asset-id>(/<thing-path>)?/update
PAYLOAD
{
data: {
"command" : "UPDATE_FIRMWARE",
"name": "wifi",
"size": 1572864,
"md5": "b95b38725d3d341ca13e6187530d2821",
"version": "1.2.3",
"downloadUrl": "https://api.servitly.com/123456y7uhgbnht5r6"
}
}
Once the message is received, the connected product must:
- Download the file from the given download URL.
- Verify the MD5 checksum.
- Apply the update and reboot.
- Publish the metric with the new version of the firmware, informing the cloud the firmware update has completed.
Supported IoT Connectors
The firmware update also works with other bidirectional IoT Connector, for instance:
- AWS IoT Core: if configured in the plugin, a request is made to AWS IoT Jobs to schedule the firmware update
- Azure Service Bus: the message is published on the remote queue.
- HTTP Connector: the message is sent to the remote control endpoint configured in the plugin.
External API invocation throttling
In case of external API invocation (e.g. AWS IoT Core, HTTP Connector), firmware update messages are sent with a maximum of 2 parallel requests at a time. This means that if 1000 devices are to be updated, and each API request takes 1 second to complete, the entire update process will take 500 seconds.
Comments
0 comments
Please sign in to leave a comment.