IoT

Building IoT Workflows with MQTT in Nodlyn

MQTT is the default nervous system for IoT — lightweight pub/sub, works on flaky networks, and every major smart-home stack speaks it. This article walks through three real patterns teams build in Nodlyn, not another property-by-property connector tour.

For Inspector settings and node outputs, use the Knowledge Base: MQTT Event (trigger) and MQTT Publish. For a hands-on first workflow, see Your First Workflow.

Pattern 1 — Temperature threshold alert

A factory stores chillers on a local Mosquitto broker. Sensors publish to plant/chiller/+/temperature.

  1. MQTT Event trigger — subscribe to the wildcard topic.
  2. Condition — compare parsed payload against {{$var.tempLimit}} (see Global Variables).
  3. Notification — Slack or email when the limit is exceeded.

Why MQTT here instead of polling HTTP? The PLC gateway already publishes; Nodlyn reacts in milliseconds without opening firewall holes.

Pattern 2 — Command-and-ack loop

A warehouse roller door is controlled via Zigbee2MQTT. Operations wants audit logs in Google Sheets.

  1. Webhook from the WMS when a truck arrives.
  2. MQTT Publishzigbee2mqtt/door_main/set with {"state":"OPEN"}.
  3. MQTT Event (or a second branch) — wait for .../state confirmation.
  4. HTTP Request — append row to Sheets with timestamp and correlation id.

Bidirectional MQTT (listen + command) is the bread-and-butter of home automation and light industrial glue code.

Pattern 3 — Edge broker on a gateway

Air-gapped site: no cloud, broker runs on the same Raspberry Pi as Nodlyn Runtime.

  1. Design and validate in Studio on a laptop.
  2. Export Runtime — see Deploying Workflows to the Edge.
  3. Agent subscribes to localhost MQTT; external PLCs publish to the same broker VLAN.

Schedules, variables, and MQTT subscriptions survive reboots because they ship inside the runtime manifest.

Topic design tips (from the field)

  • Hierarchical topics: site/building/device/metric — easier routing and ACLs.
  • QoS 1 for telemetry you cannot afford to lose once; QoS 0 for high-frequency noise.
  • Keep JSON payloads small — one reading per message beats giant batches on constrained links.
  • Use {{$var.mqttHost}} so dev/staging/prod brokers swap without editing every node.

When not to use MQTT

If the vendor only offers REST webhooks, start with Webhook. If you need request/response semantics with auth headers, HTTP Request is simpler. MQTT shines for fire-and-forget events and fan-out.

Next steps

Nodlyn Assistant
Ask me anything about Nodlyn
Hi! 👋 I'm the Nodlyn assistant. Ask me about the product, workflow components, connectors, agent runtime, agent capabilities, deployment, and more. If I don't know an answer, I'll point you to our contact form.
Nodlyn Assistant
Ask me anything about Nodlyn
Hi! 👋 I'm the Nodlyn assistant. Ask me about the product, workflow components, connectors, agent runtime, agent capabilities, deployment, and more. If I don't know an answer, I'll point you to our contact form.