"Activating" OTA agent based on AWS IoT's Job creation.

0

Hello,

I am currently implementing OTA functionality on an ESP32-S3 and I am looking for a way to activate the OTA agent on my device based on a notification. I believe I can subscribe to the /notify or /notify-next topic to but my only concern here is that having a constantly open MQTT subscription on the device. Is it possible to start the OTA agent and have a way for it to check for active jobs to determine whether or not to proceed or stop?

kevinah
asked a year ago208 views
1 Answer
0

Hi kevinah. The jobs/notify and jobs/notify-next topics are how your device gets notified that there's a job available for it to process. You need to be subscribed to get the notification. The OTA agent subscribes to jobs/notify-next here: https://github.com/aws/ota-for-aws-iot-embedded-sdk/blob/c3bd5840979cadfe1f9505e13e49cccb87333650/source/ota_mqtt.c#L358

When the OTA agent first starts up, it subscribes to that topic and publishes a /jobs/$next/get to get any jobs that may have been queued while it was offline.

my only concern here is that having a constantly open MQTT subscription

Subscriptions don't incur cost. Connection time and messaging do. Is there another concern?

The OTA agent includes a suspend/resume feature. This is normally used to handle intermittent connectivity. You could also use it suspend under different conditions. For example, a customer might suspend OTA when a device goes onto a cellular network and resume when it goes back on WiFi. Alternatively you might have your own custom topic that allows you to notify your application to suspend OTA (but this would require a subscription of course). More drastically, you could shutdown rather than suspend; this can unsubscribe too.

The OTA demos are worth studying if you haven't already: https://github.com/aws/aws-iot-device-sdk-embedded-C/tree/main/demos/ota

profile pictureAWS
EXPERT
Greg_B
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions