← Wiki

Ingredient

MQTT

Also known as: Message Queuing Telemetry Transport

Lightweight publish-subscribe messaging protocol designed for resource-constrained devices over unreliable networks. The de-facto standard for IoT messaging — every farm-electronics ingredient with a network connection speaks MQTT, and every dashboard, automation system, or ML pipeline that consumes IoT data subscribes to MQTT. Architecture: clients connect to a broker (Mosquitto, EMQX, HiveMQ); publishers send messages to topics; subscribers receive messages on topics they've subscribed to. ISO standard (ISO/IEC 20922:2016). Open-source brokers run on a Raspberry Pi or in a Cloudflare Worker.

Inputs / outputs

  • Transport: TCP (port 1883 plaintext, 8883 TLS) or WebSocket
  • QoS levels: 0 (fire-and-forget), 1 (at-least-once), 2 (exactly-once)
  • Topics: hierarchical strings like farm/zone-3/soil/moisture
  • Payload: arbitrary binary; convention is small JSON or raw numeric bytes
  • Retained messages: broker stores last message per topic — new subscribers get current state instantly

Solves / unlocks

  • Distributed sensor → dashboard data flow (ESP32 publishes, Grafana subscribes)
  • Decoupled command-and-control (publish irrigation commands; valves subscribe)
  • Multi-system integration (one MQTT broker connects sensors, automation, ML, alerting)
  • Last-Will-and-Testament (LWT) — broker auto-publishes “offline” message when client disconnects abnormally
  • Replay-capable command bus (with retained messages, late subscribers see current state)

Constraints

  • No built-in persistence beyond retained messages — pair with InfluxDB or TimescaleDB for time-series storage.
  • Topic-design discipline matters — flat namespaces become unsearchable; design hierarchically.
  • TLS is essential for outdoor/deployed networks — plaintext MQTT is wide open.
  • Broker is a single point of failure — for production, run a clustered broker (EMQX, HiveMQ) or Mosquitto with bridging.

Source

See also

Auto-generated from this entry’s typed relations: frontmatter, grouped by relation type so the editorial signal isn’t flattened.

  • Member of: [[ingredient]]
  • Combines with: [[esp32]] · [[raspberry-pi]] · [[home-assistant]] · [[node-red]] · [[lorawan]]

What links here, and how

Inbound connections from across the wiki, grouped by lens and by relationship. These appear automatically — every entity page declares what it links to, and that data populates here on the targets.

Practical

combines with

  • ESP32 native MQTT-client libraries (PubSubClient, AsyncMqttClient); the standard ESP32 telemetry pattern
  • ESPHome ESPHome supports both native API (preferred) and MQTT for HA integration
  • Home Assistant built-in MQTT integration; ESP32 nodes publish, HA subscribes
  • Node-RED MQTT in/out nodes are first-class; visual MQTT routing
  • Raspberry Pi Mosquitto MQTT broker runs trivially on Pi as a service

contains

combines

8 inbound links · 6 outbound