Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To keep MQTT devices communicating when the internet connection fails, run the broker on a host reachable over your local network and configure your devices and local automation system to use it. This works during a WAN outage only if the LAN, broker host, and power remain available. Devices that depend exclusively on a vendor cloud, or clients pointed only at a cloud broker, will not gain local connectivity from this setup.

What still works when the WAN goes down?

MQTT clients publish messages to a broker, which routes them to subscribers. If the broker and clients are on a functioning LAN, that traffic does not need to cross the internet. A cloud-only broker, by contrast, is unreachable when the WAN connection is down.

Home Assistant distinguishes locally communicating devices from cloud-dependent ones: local devices may continue working without internet, while cloud-only devices and cloud services lose their internet-dependent functions. Home Assistant Cloud remote access and cloud assistant integrations also depend on internet access. See Home Assistant’s internet outage FAQ.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This is a WAN-resilience setup, not protection against every outage. If the router or LAN fails, the broker host loses power, or the broker stops running, local clients may lose their route or destination too.

#1 Best Overall
Waveshare RS485 to WiFi/Ethernet Serial Server, Modbus MQTT Gateway, Rail-Mount, Compact Size, Industrial Gateway, Motherboard, Mini ITX
  • RS485 to WIFI/Ethernet serial server supports RS485 to WIFI, RS485 to Ethernet, Ethernet to WIFI, etc. supports TCP Server / TCP Client / UDP Server / UDP Client
  • Serial command mode, the user sends data to the server according to the protocol, send data to different servers without restarting
  • Support HTTPD Client Mode, after the user has set the HTTP header through AT commands or web page, the module can send data to the HTTP server, or obtain data from the HTTP server
  • Support MQTT function, support Modbus TCP and Modbus RTU interconversion mode
  • Industrial rail-mount support, easy to install, compact size, cost-effective. Power supply is not included, it is recommended to use a 12V Industrial DIN-Rail Power Supply

Set up a broker that stays reachable on the LAN

1. Check each device’s dependencies

Find out whether each MQTT device connects to a broker on your LAN or to an internet-hosted endpoint. Also check whether the device’s own controls and state reporting use a local protocol or require the vendor’s cloud. A local broker cannot make a cloud-dependent device operate locally.

2. Choose an always-on local host

If you already run Home Assistant, its documentation recommends the Mosquitto broker app as a setup method. Install the app from the Home Assistant add-on store, start it, then configure Home Assistant’s MQTT integration to connect to the broker. Follow the current instructions in the Home Assistant add-on guide and MQTT integration documentation.

The host can be an existing suitable computer or another device capable of running the broker reliably. What matters for this design is that it stays powered and reachable from the LAN; the documentation does not require a particular hardware model.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
waveshare RS232/485 to WiFi and Ethernet Converter Serial Server, Modbus Gateway, MQTT Gateway,Serial Port to HTTPD Client, Allow Serial Port to WiFi, Serial Port to Ethernet, Ethernet to WiFi
  • This is an RS232/485 device data acquisitor / IoT gateway designed for industrial environment. It combines multi functions in one, including serial server, Modbus gateway, MQTT gateway, serial port to HTTPD Client, etc
  • With RS232, RS485, WIFI and Ethernet interfaces, the module can realize functions such as serial port to WIFI, serial port to Ethernet, Ethernet to WIFI and so on. Support Screw Terminal and DC 5.5 Power Port for Power Supply, DC 6~36V Wide Voltage Range Input
  • Support transparent transmission mode: Support TCP Server, TCP Client, UDP Server, UDP Client
  • Support multi wireless networking methods: Support AP mode, STA mode, and AP+STA mode. Support multi wired networking methods: Support APLAN, APWAN, Router, and Bridge mode
  • Multi Configuration Methods: Supports muliti configuration methods such as hosts, Web Browser and serial port Configuration. AT Command Mode: The user can query the current status of the module or set related parameters by sending AT commands

3. Point every MQTT client at the local broker

In each device’s MQTT settings, enter the local broker’s hostname or IP address, port, and credentials as required. Configure Home Assistant’s MQTT integration with the same broker details. A hostname is convenient, but ensure local name resolution works during an internet outage; a LAN IP address avoids dependence on external DNS, though an address reservation or other stable-address plan helps prevent it from changing.

Use credentials and configure certificate validation where applicable. Home Assistant’s MQTT integration documentation covers broker connection settings and security options.

4. Keep offline automations local

For an automation to keep running without the WAN, its trigger, logic, and action must not require an internet service. An automation that receives a local MQTT message and controls a locally connected device can remain independent of the WAN; one that calls a cloud API cannot. Home Assistant’s internet FAQ explains the distinction between local and cloud-dependent operation.

Rank #3
WiFi Gateway MQTT Gateway Built for Meshtastic
  • WiFi Gateway |The MQTT Gateway Built for Meshtastic

5. Verify local publish and subscribe

With the broker running, Home Assistant documents testing locally with Mosquitto client tools. In a terminal on the broker host, subscribe to a test topic:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mosquitto_sub -h 127.0.0.1 -t 'test/topic' -v

In another terminal, publish a message:

mosquitto_pub -h 127.0.0.1 -t 'test/topic' -m 'hello'

The subscriber should display the topic and message. These commands test the broker locally on its host; also verify that an actual device and Home Assistant can connect using the LAN address and credentials configured for them. To check the WAN-outage case, disconnect the WAN while keeping the router, LAN, broker host, and power running, then verify the devices and local automations you expect to work.

See Home Assistant’s MQTT documentation for its testing guidance.

Rank #4
PUSR Edge Computing IoT Gateway 2*RS485 1*Ethernet with SD Card for Data Storage Modbus to MQTT/Json DL645 to MQTT+Json RS485 to Ethernet USR-N720-ETH
  • Powerful Edge Computing Capabilities: 1000 points+data acquisition+analysis
  • Multiple Interface: Ethernet+2*RS485
  • Protocol Conversion: Modbus to MQTT+Json, DL645 to MQTT+Json
  • Rich Communication Protocol: MQTT/TCP
  • Data Encryption: TCP+SSL, MQTT+SSL SD Card for Data Storage:To ensure data integrity

What QoS, retained messages, and sessions do—and do not do

QoS acknowledges delivery; it does not create a route

MQTT quality of service describes delivery semantics between a client and broker, subject to the QoS requested by the subscriber and the QoS used by the publisher. QoS 0 is at-most-once, QoS 1 is at-least-once and may result in duplicate delivery, and QoS 2 uses a protocol exchange for exactly-once delivery. Higher QoS levels involve more latency and bandwidth. None makes a cloud broker reachable when the WAN is unavailable. See the Eclipse Mosquitto MQTT manual.

Retained messages provide the latest value, not a history

A retained publish lets the broker deliver the most recently retained value for a topic to a later matching subscriber. That is useful for current state, but it does not preserve every state change as an event log. Retained messages can survive broker or system restarts, so an old value may appear current unless your application updates or clears it. Home Assistant’s MQTT integration documentation discusses retained discovery messages and MQTT 5 message expiry; expiry can limit how long a supported message remains available. See Home Assistant’s MQTT documentation and its publish-action documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Persistent sessions can queue some messages for a disconnected subscriber

With a non-clean session, a broker can preserve a client’s subscriptions and queue later QoS 1 or QoS 2 messages while that subscriber is disconnected, delivering them when it reconnects. This helps a subscriber that temporarily loses its connection to an available broker. It does not help a publishing client that cannot reach the broker in the first place, and it is not a substitute for an event archive. Queue capacity depends on broker configuration and practical storage limits. See the Eclipse Mosquitto MQTT manual and MQTT.org’s protocol overview.

Best Value
RS232/485/422 to RJ45 ETH Module Serial Server Modbus Gateway MQTT Gateway TCP/IP to Serial, with PoE Function, Bi-Directional Transparent Data Transmission Between RS232/485/422 and Ethernet
  • RS232/485/422 TO POE ETH module combines multi functions in one, including serial server, Modbus gateway, MQTT gateway, RS485 to JSON, etc., bi-directional transparent data transmission between RS232/485/422 and Ethernet
  • Onboard RS232 / 485 / 422 Interfaces, suitable for more application scenarios. The Ethernet port can send data to three serial ports at the same time, only one of the RS232, RS485, and RS422 can send data to the Ethernet port at the same time
  • Multi methods for power supply: support PoE Ethernet port power supply, suitable for IEEE 802.3af PoE standard. Support Screw Terminal and DC Power Port for power supply, DC 6~36V wide voltage range input
  • Support Modbus Gateway, suitable for Modbus networking upgrade, can be used with specific configuration software . Support TCP server / TCP client / UDP mode / UDP multicast multi communication modes. MQTT/JSON to Modbus, more flexible conversion between different protocols
  • Multi hosts roll-polling support. User-defined heartbeat/registration packet. NTP protocol support. Multi configuration methods. Built-in protection circuits, safe and stable
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Make device outages visible

Use availability topics so your automation or dashboard can distinguish a device’s last reported state from whether it is currently connected. MQTT Birth messages can announce that a service has started, while Last Will and Testament messages let the broker publish a configured status when a client disconnects, including after an unclean network loss. Home Assistant documents Birth and Will configuration in its MQTT integration guide.

Availability reporting does not restore communication; it helps prevent stale state from being mistaken for proof that a device is online.

Choose the right resilience for the failure

Failure or need What a local broker provides What to check
WAN unavailable; LAN, broker, and power are working Local MQTT clients can communicate with a broker on the LAN. Clients use the local broker, and the devices and automations do not depend on cloud services.
Router or LAN unavailable The broker does not restore a network path between clients. Keep the local network operating; broker placement alone does not solve a LAN failure.
Broker host or power unavailable Clients lose access to the local broker. Keep the host running and reachable. A local broker is not a backup for its own host or power.
Need the latest state after a subscriber reconnects A retained message can provide the most recently retained value. Use it for current state, not as a record of every transition.
Need queued messages for a temporarily disconnected subscriber A persistent session can queue subsequent QoS 1 or 2 messages while the broker remains available. Confirm client session behavior and broker storage/configuration limits.
Need a complete history of events Retained messages and persistent sessions alone do not provide an event archive. Use a separate history or logging design appropriate to the application.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.