Skip to content

GreengrassV2 Core Device Local Checkin Status

0

Hello,

Apologies in advance if this is in the documentation somewhere but I have been unable to find it.

I am developing a Greengrass core device, specs below for clarity, our device connects to AWS through a cellular connection and is battery powered so cycles the modem on for a short period of time and then powers it off for 60 mins. I want to ensure that the Greengrass service running locally has enough time to report its status and check for component updates, shadow document updates etc before disconnecting.

I am hoping someone can point me in the direction of an API or MQQT/IPC message that I can use to trigger the device locally to check for updates with greengrass, ideally I would be able to start the process then poll/receive updates of its status until I can disconnect from the cellular network again?

Specs

  • Host Raspberry PI CM4 running bookworm
  • Greengrass non-lite nucleus (V2.14.0)
  • Battery powered with cyclic internet connection (~5 mins on, ~60 mins off)

Edit to show my final solution Given the polling frequency in https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html#greengrass-nucleus-component-configuration (Thanks to Greg_B) I am confident that the combination polling for component updates in progress on the IPC operation list components while the connection is established for at least 2 minutes should provide ~7 attempts for the deployment update poll to succeed.

asked a year ago218 views

2 Answers
1
Accepted Answer

if the status check logic you are describing happens on the device, the closest thing we have would be IPC ListComponents API. https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-local-deployments-components.html#ipc-operation-listcomponents

AWS

answered a year ago

EXPERT

reviewed a year ago

  • Thankyou for your response!

    The status check is indeed on the device, as per my original question though what I am really trying to do is have small windows off connectivity but still allow Greengrass to update deployments reliably, what the AI answer correct in saying there is no way to trigger a check for new deployments?

    I am mostly concerned that if I get unlucky with when Greengrass checks for updates, (which to my understanding is periodic?) then my devices may never or not for a very long time receive updates, is this a real concern or would say 1~2 minutes of internet connectivity ensure that the Greengrass service locally would start any changes and that would be reflected in the listComponents IPC messages?

    Apologies for the verbose questions I am trying to ensure that I convey what I am trying to achieve in case there is a better way of doing that

  • Greengrass checks for new deployments at the interval defined by deploymentPollingFrequencySeconds in the Nucleus configuration: https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html#greengrass-nucleus-component-configuration. This is 15s by default.

1

To manage the status updates and check for updates on your Greengrass core device with intermittent connectivity, you have a few options, but there isn't a single API or MQTT/IPC message that will trigger all the checks you're looking for.

For status reporting, AWS IoT Greengrass core devices send status updates at specific times:

  1. When the AWS IoT Greengrass Core software starts
  2. When the core device receives a deployment from the AWS Cloud
  3. When the status of any component on the core device becomes ERRORED, BROKEN, RUNNING, or FINISHED (for Greengrass nucleus 2.12.3 and later)
  4. At a regular interval that you can configure (default is 24 hours)
  5. For AWS IoT Greengrass Core v2.7.0 and later, when local deployment and cloud deployment occurs

Given your device's connectivity pattern, you might want to consider adjusting the regular interval for status updates to align with your 5-minute connection window.

For checking component updates and shadow document updates, you'll need to use different mechanisms:

  1. For component updates: There isn't a direct way to trigger a check for component updates. Greengrass typically checks for updates when it connects to the AWS Cloud. You could potentially force a new deployment to trigger an update check, but this isn't an efficient solution for your use case.

  2. For shadow document updates: You can use the AWS IoT Device SDK to subscribe to shadow update topics. This way, your device can receive updates as soon as they're available when it's connected.

To ensure your device has enough time to complete these processes before disconnecting, you could implement a local health check using the Greengrass local HTTP API. This API allows you to request health information for local worker processes. You can send a GET request to http://localhost:[port]/2016-11-01/health/workers to get health information for all workers.

A potential workflow could be:

  1. Connect to the cellular network
  2. Start the Greengrass core software (if not already running)
  3. Use the local HTTP API to check the health of workers
  4. Subscribe to shadow update topics
  5. Wait for a period of time or until certain conditions are met
  6. Perform a final health check before disconnecting

Remember that this approach doesn't guarantee that all possible updates will be received, especially if there are delays in cloud communication. You may need to fine-tune the connection duration based on your specific needs and network conditions.
Sources
Check Greengrass core device status - AWS IoT Greengrass
Calling the local health check API - AWS IoT Greengrass
GetCoreDevice - AWS IoT Greengrass

answered a year ago

EXPERT

reviewed a year ago

  • It appears as though the local health check API is for use with GreengrassV1, is there an equivalent with V2?

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.