How to determine that AWS FOTA has completed it's check, and found no update.

I'm working on a IoT device that leverages the AWS IoT and AWS FOTA components from the nRF Connect SDK. The device is battery powered, and so I want to limit the connection time to the minimum possible. To accomplish that I want to affirmatively confirm that the data queue is empty, the shadow is synced, and no firmware updates (or other jobs) are pending. I'm encountering issues on the third condition: make sure no firmware updates are pending.

I can't seem to find any hook into the FOTA library that would allow me to confirm that the jobs topic was checked, evaluated, and found to be empty. My current approach was to subscribe to the same topic, but the FOTA library appears to 'consume' those events, and so they're never seen by our code. We use a similar approach for checking the shadow, and I can see in the FOTA module's debug log that it checked that topic as well, however that event seems to have been passed on and our code is able to handle those results.

Is it currently the case that there's no way to check the incoming job topic results manually, or confirm that the FOTA module itself has checked them? Any guidance would be much appreciated.

Parents Reply Children
  • Hi Hakon, 

    I have; I can share the logs I'm looking at, with some minor data removal:

    [00:00:06.815,185] <inf> app_event_manager: MODEM_EVT_MODEM_STATIC_DATA_READY
    [00:00:10.316,864] <dbg> aws_jobs: reg_topic: Subscribe: $aws/things/[Removed]/jobs/notify-next
    [00:00:10.320,434] <dbg> aws_jobs: reg_topic: Subscribe: $aws/things/[Removed]/jobs/$next/get/#
    [00:00:10.323,333] <dbg> aws_iot: on_connack: MQTT client connected!
    [00:00:10.324,615] <dbg> aws_iot: subscribe: Subscribing to topic: $aws/things/[Removed]/shadow/get/accepted
    [00:00:10.326,873] <dbg> aws_iot: subscribe: Subscribing to topic: $aws/things/[Removed]/shadow/get/rejected
    [00:00:10.329,101] <dbg> aws_iot: subscribe: Subscribing to topic: $aws/things/[Removed]/shadow/update/accepted
    [00:00:10.331,390] <dbg> aws_iot: subscribe: Subscribing to topic: $aws/things/[Removed]/shadow/update/rejected
    [00:00:10.333,679] <dbg> aws_iot: subscribe: Subscribing to topic: $aws/things/[Removed]/shadow/update/delta
    [00:00:10.591,827] <dbg> aws_fota: on_suback_evt: Subscribed to notify-next topic
    [00:00:10.593,383] <dbg> aws_jobs: publish: Publish topic: $aws/things/[Removed]/jobs/$next/get
    [00:00:10.595,397] <dbg> aws_jobs: publish: Publish payload {"clientToken": ""}
    [00:00:10.871,337] <dbg> aws_fota: on_suback_evt: Subscribed to get next-topic
    [00:00:10.872,955] <dbg> aws_iot: on_suback: Received ACK for subscribe message: id = 1984 result = 0
    [00:00:10.874,755] <dbg> aws_iot: aws_iot_send: Using message ID 1
    [00:00:10.876,007] <dbg> aws_iot: aws_iot_send: Publishing to topic: $aws/things/[Removed]/shadow/get
    [00:00:10.878,845] <dbg> aws_iot: device_shadow_document_request: Device shadow document requested
    [00:00:10.880,523] <dbg> aws_module: awsIotEventHandler: AWS_IOT_EVT_CONNECTED
    [00:00:10.881,988] <inf> app_event_manager: AWS_MODULE_EVT_READY
    [00:00:10.883,880] <wrn> aws_module: Cloud connection establishment in progress
    [00:00:10.885,345] <wrn> aws_module: New connection attempt in 32 seconds if not successful
    [00:00:10.887,268] <dbg> aws_module: sub_state_set: Sub state transition SUB_STATE_AWS_DISCONNECTED --> SUB_STATE_AWS_READY
    [00:00:10.889,373] <inf> app_event_manager: DATA_EVENT_DATA_QUEUE_EMPTY
    [00:00:11.137,634] <dbg> aws_iot: on_puback: Received ACK for published message: id = 19440 result = 0
    [00:00:11.139,404] <dbg> aws_module: awsIotEventHandler: AWS_IOT_EVT_PUBACK
    [00:00:11.140,808] <inf> app_event_manager: AWS_MODULE_EVT_PUBACK
    [00:00:11.142,852] <dbg> aws_fota: topic_type_get: Received topic: $aws/things/[Removed]/jobs/$next/get/accepted
    [00:00:11.145,141] <dbg> aws_fota: on_publish_evt: Checking for an available job
    [00:00:11.146,667] <dbg> aws_fota: parse_job_execution: Job doc: {"clientToken":"","timestamp":1745529623}
    [00:00:11.148,712] <dbg> aws_fota: parse_job_execution: Got only one field
    [00:00:11.150,054] <dbg> aws_fota: parse_job_execution: No queued jobs for this device
    [00:00:11.567,108] <dbg> aws_fota: topic_type_get: Received topic: $aws/things/[Removed]/shadow/get/accepted
    [00:00:11.570,709] <dbg> aws_iot: on_publish: Received message: topic = $aws/things/[Removed]/shadow/get/accepted and len = 1020
    [00:00:11.573,272] <dbg> aws_module: awsIotEventHandler: AWS_IOT_EVT_DATA_RECEIVED
    [00:00:11.574,768] <inf> aws_module: awsIotEventHandler received data on topic: $aws/things/[Removed]/shadow/get/accepted
    [00:00:11.577,484] <inf> aws_module: Shadow document received: {[Removed]}
    [00:00:11.594,268] <wrn> aws_module: No desired state found in shadow document
    [00:00:11.596,282] <dbg> aws_module: report_device_shadow: Publishing shadow update: {[Removed]}
    [00:00:11.600,860] <dbg> aws_iot: aws_iot_send: Using message ID 2
    [00:00:11.602,111] <dbg> aws_iot: aws_iot_send: Publishing to topic: $aws/things/[Removed]/shadow/update
    [00:00:12.151,397] <dbg> aws_fota: topic_type_get: Received topic: $aws/things/[Removed]/shadow/update/accepted
    [00:00:12.154,815] <dbg> aws_iot: on_publish: Received message: topic = $aws/things/[Removed]/shadow/update/accepted and len = 663
    [00:00:12.157,440] <dbg> aws_module: awsIotEventHandler: AWS_IOT_EVT_DATA_RECEIVED
    [00:00:12.158,935] <inf> aws_module: awsIotEventHandler received data on topic: $aws/things/[Removed]/shadow/update/accepted
    [00:00:12.161,376] <inf> aws_module: Shadow update accepted received.

Related