Github Repo | C Header | C source | JS source |
---|---|---|---|
mongoose-os-libs/ota-shadow |
This library provides a way to update firmware Over-The-Air via the device shadow mechanism.
In the text below, AWS IoT Shadow will be used.
It works by observing the ota.url
entry in the device shadow. That entry must
be an URL with the valid Mongoose OS firmware, which is a .zip file.
When that entry is changed, this library downloads a firmware from that
URL and kicks off an OTA update. The sequence of actions is as follows:
ota.url
- a new ota.url
valueota.url
with file on flash. If it is the same as new value, stopota.url
locally on flashota_url
ota.code
and string ota.message
entries which indicates the status of the OTA in nearly real timeota.message
ota.url
delta unclearedBuild and flash the https://github.com/mongoose-os-apps/demo-js app, start the console, and provision to AWS IoT. Open the shadow GUI for the device.
Upload built firmware to the Mongoose OS dashboard and copy the firmware URL.
Change the desired
shadow state by adding a section ota
with url
key:
{
"desired": {
"ota": {
"url": "https://mongoose-os.com/dashboard/ota/PATH/TO/APP.zip"
},
...
},
...
}
You can edit device shadow from the AWS IoT dashboard:
When it successfully finishes, it reboots and commits the firmware after the AWS IoT handshake: