Unable to Connect to MQTT broker on LAN
See original GitHub issueProblem/Motivation
I’d like to be able to connect to Mosquitto MQTT broker running on my LAN.
Expected behavior
I have another Raspberry Pi 2 running Raspbian with the latest Node-RED installed, and it connects to my MQTT broker without issue, here’s my Node-RED log showing a working MQTT connection:
# RASPBIAN LOG #
3 Nov 01:07:20 - [info] Node-RED version: v0.19.5
3 Nov 01:07:20 - [info] Node.js version: v8.12.0
3 Nov 01:07:20 - [info] Linux 4.9.35-v7+ arm LE
3 Nov 01:07:22 - [info] Loading palette nodes
global Settings { uib_globalSettings: { debug: false },
userDir: '/home/pi/.node-red',
httpNodeRoot: '/' }
3 Nov 01:07:32 - [info] Settings file : /home/pi/.node-red/settings.js
3 Nov 01:07:32 - [info] Context store : 'default' [module=memory]
3 Nov 01:07:32 - [info] User directory : /home/pi/.node-red
3 Nov 01:07:32 - [info] Server now running at http://127.0.0.1:1880/
3 Nov 01:07:32 - [info] Active project : ras_pi_node_red_flows
3 Nov 01:07:32 - [info] Flows file : /home/pi/.node-red/projects/ras_pi_node_red_flows/flows_ras_pi.json
3 Nov 01:07:33 - [info] Starting flows
3 Nov 01:07:34 - [info] Started flows
3 Nov 01:07:35 - [info] [mqtt-broker:DS413 root] Connected to broker: mqtts://ds413.local:8883
[mqtt-broker:DS413 root] Connected to broker: mqtts://ds413.local:8883
I can send and recieve test messages over MQTT in Node-RED also.
Actual behavior
The Hass.IO Node-RED addon does not connect to the exact same MQTT server with the exact same settings the MQTT options in Node-RED, I copy/pasted the working flow and used the same credentials. Log:
# HASSIO LOG #
3 Nov 01:02:10 - [info] Node-RED version: v0.19.5
3 Nov 01:02:10 - [info] Node.js version: v8.12.0
3 Nov 01:02:10 - [info] Linux 4.14.78-v7 arm LE
3 Nov 01:02:11 - [info] Loading palette nodes
3 Nov 01:02:17 - [info] Settings file : /etc/node-red/config.js
3 Nov 01:02:17 - [info] Context store : 'default' [module=memory]
3 Nov 01:02:17 - [info] User directory : /config/node-red/
3 Nov 01:02:17 - [warn] Projects disabled : editorTheme.projects.enabled=false
3 Nov 01:02:17 - [info] Flows file : /config/node-red/flows.json
3 Nov 01:02:17 - [info] Server now running at http://127.0.0.1:1880/
3 Nov 01:02:17 - [info] Starting flows
3 Nov 01:02:17 - [info] Started flows
3 Nov 01:02:17 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
3 Nov 01:02:43 - HA Auth - DevTesta authenticated
3 Nov 01:02:47 - [info] [mqtt-broker:DS413 root] Connection failed to broker: mqtts://ds413.local:8883
[mqtt-broker:DS413 root] Connection failed to broker: mqtts://ds413.local:8883
It looks like it doesn’t even try and connect to my broker, I checked the mosquitto logfile on ds413.local and it doesn’t even log a connection attempt from my hassio.local IP address.
Steps to reproduce
Try and connect to a MQTT host over Lan, maybe it’s because I’m using TLS? I’ll try another MQTT server without encryption or a public test server.
EDIT: I tried using MQTT server test.mosquitto.org:1883 wired up to a debug node, topic = “+” and it works great, it produces a lot of test messages, so it seems to be a issues with MQTT over LAN only.
Proposed changes
I’m not sure yet, I don’t have a solution yet. I’m guessing it’s a network issue, or maybe mDNS? What steps can I do to debug? Thanks
EDIT: My HASS.IO info:
| Hostname | hassio |
|---|---|
| System | HassOS 1.12 |
| Deployment | production |
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)

Top Related StackOverflow Question
Ok, thanks this does seem to be more of a Hass.IO issue, after more testing even the
homeassistantcontainer has the same nDNS issue. Thanks for pointing me in the right direction, hopefully with a little tinkering of Hass.IO I should be able to fix or workaround this issue.that is (unfortunately) outside the scope of the add-on. The network is provided by Hass.io.