跳至內容

"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?

已提問 3 年前檢視次數 337 次
1 個回答
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

AWS
專家
已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。