Loop component
The custom component
Greengrass component — a versioned unit of software on the core (AWS public components or custom recipes such as GgEdgeLoop / ZoneAnomaly).
com.example.GgEdgeLoop subscribes to pubsub
Greengrass interprocess pub/sub — in-process messaging between components on the core (the closed-loop component uses it for sensor/actuator topics).
topic gg-edge/sensor and publishes JSON commands on gg-edge/actuator/<thing>.
The
MQTT bridge
aws.greengrass.clientdevices.mqtt.Bridge — maps topics between LocalMqtt (Moquette), Pubsub (components), and IotCore. maps those topics to
Moquette
aws.greengrass.clientdevices.mqtt.Moquette — local MQTT broker on the core. Not Mosquitto; client devices connect here over mTLS. (
ESP32-S3
Espressif ESP32-S3 — Wi‑Fi microcontroller used here as the Greengrass client device (not a second core).) and
IoT Core
AWS IoT Core — cloud MQTT and device identity service. Client devices use it for discovery; the MQTT bridge forwards zone topics here, where IoT rules route them to other AWS services..
Manual Nucleus install does not include
greengrass-cli
Greengrass CLI — local tool under /greengrass/v2/bin/greengrass-cli for listing components and creating local deployments on the core. — add Cli in a cloud
deployment that keeps Auth / Moquette / Bridge / IPDetector (a new deployment
to the Thing group replaces the previous root set).
This page deploys the loop locally to prove the LAN path first. After Prove the LAN loop, Deploy from the cloud replaces it with a cloud-registered version from S3.
Steps on this page:
- 1
Deploy greengrass-cli
create-deploymentcloud - 2
Copy recipe + artifact
cp → /opt/gg-edgeNUC - 3
Local deploy
greengrass-cli … --mergeNUC - 4
Verify RUNNING
component list · tail logNUC
greengrass-cli. RUNNING + asubscribed to gg-edge/sensor log line = good.1. Deploy greengrass-cli (cloud)
Section titled “1. Deploy greengrass-cli (cloud)”Render deployment JSON (client stack + Cli)
Section titled “Render deployment JSON (client stack + Cli)”CORE_THING_GROUP_ARN=$(aws iot describe-thing-group \ --thing-group-name "$CORE_THING_GROUP" \ --query thingGroupArn --output text)CLI_VER=$(aws greengrassv2 list-components --scope PUBLIC \ --query "components[?componentName=='aws.greengrass.Cli'].latestVersion.componentVersion" \ --output text)echo "Cli=$CLI_VER"sed -e "s|TARGET_THING_GROUP_ARN|${CORE_THING_GROUP_ARN}|g" \ -e "s|CLIENT_THING_PREFIX|${CLIENT_THING_PREFIX}|g" \ -e "s|CLI_COMPONENT_VERSION|${CLI_VER}|g" \ artifacts/deployments/client-device-support-with-cli.json \ > /tmp/gg-edge-with-cli.jsonaws greengrassv2 create-deployment \ --cli-input-json file:///tmp/gg-edge-with-cli.jsonCli=2.18.3{ "deploymentId": "2ab5a9fe-c150-4ec8-aa4e-2de4e4d67ecc"}Wait until list-effective-deployments shows SUCCEEDED, then on the NUC:
sudo /greengrass/v2/bin/greengrass-cli -VGreengrass CLI Version: 2.18.32. Copy recipe and artifact on the NUC
Section titled “2. Copy recipe and artifact on the NUC”Requires awsiotsdk on the NUC (installed in Install Nucleus).
Without it, com.example.GgEdgeLoop goes BROKEN
(ModuleNotFoundError: awsiot).
Preferred: keep a checkout of this repo on the NUC, then copy into /opt/gg-edge
(SSH/scp from the workstation also works).
On the NUC (repo root of the checkout):
sudo mkdir -p /opt/gg-edge/recipes \ /opt/gg-edge/artifacts/com.example.GgEdgeLoop/1.0.1sudo cp artifacts/components/recipes/com.example.GgEdgeLoop-1.0.1.yaml \ /opt/gg-edge/recipes/sudo cp artifacts/components/artifacts/com.example.GgEdgeLoop/1.0.1/loop.py \ /opt/gg-edge/artifacts/com.example.GgEdgeLoop/1.0.1/(no output)For local deploy, Nucleus reads artifacts from --artifactDir. The recipe’s
s3:// URI is used later when you ship it from the cloud.
3. Local deploy with greengrass-cli
Section titled “3. Local deploy with greengrass-cli”Still on the NUC:
sudo /greengrass/v2/bin/greengrass-cli deployment create \ --recipeDir /opt/gg-edge/recipes \ --artifactDir /opt/gg-edge/artifacts \ --merge "com.example.GgEdgeLoop=1.0.1"Local deployment submitted! Deployment Id: …4. Verify
Section titled “4. Verify”List components
Section titled “List components”sudo /greengrass/v2/bin/greengrass-cli component listComponent Name: com.example.GgEdgeLoop Version: 1.0.1 State: RUNNING…Tail component log
Section titled “Tail component log”sudo tail -f /greengrass/v2/logs/com.example.GgEdgeLoop.log… subscribed to gg-edge/sensorExpect a log line that the component subscribed to gg-edge/sensor.
Next: Flash zones.