The error "not connected to mqtt server!" pops up whenever I set the server address to localhost or 127.0.0.1.
It works if I set it to the real intranet IP like 192.168.1.123.
Running on RPi3+ with mosquitto.
Any idea to make localhost works so it would still work after IP address change?
Are you using the official mosquitto add-on to run mosquitto? The community add-on? Or running it on another device altogether?
Mosquitto was installed from Hass.io official addon, on the same machine. I only changed a few lines in the config, every other things were default settings.
My zigbee2mqtt config:
{
"data_path": "/share/zigbee2mqtt",
"homeassistant": true,
"permit_join": false,
"mqtt_base_topic": "zigbee2mqtt",
"mqtt_server": "mqtt://192.168.1.235:1883",
"serial_port": "/dev/ttyACM0",
"mqtt_user": "aaaaa",
"mqtt_pass": "bbbbb"
}
If I change the line to
"mqtt_server": "mqtt://127.0.0.1:1883",
Or
"mqtt_server": "mqtt://localhost:1883",
It does not work, tried removing the :1883 part, still no dice.
Mosquitto config:
{
"logins": [
{
"username": "aaaaa",
"password": "bbbbb"
}
],
"anonymous": false,
"customize": {
"active": false,
"folder": "mosquitto"
},
"certfile": "fullchain.pem",
"keyfile": "privkey.pem"
}
I wonder if there is any setting I could try? Thanks!
I use "mqtt_server": "mqtt://homeassistant:1883", although no idea how that works/resolves properly.. maybe the Os does have an entry that resolves that properly to the local machine.
Things should work with mqtt://homeassistant, assuming your port mapping is standard.
Hassio resolves this to the correct address behind the scenes.
Maybe you can try your broker name (if you use a custom broker). I had a custom broker name in my configuration.yaml file and tried using my local ip, my localhost and it wasn't working either.
Try it like: "mqtt://brokername:1883", (brokername = your broker name from your configuration file)
Things should work with mqtt://homeassistant, assuming your port mapping is standard.
Hassio resolves this to the correct address behind the scenes.
running hassio version 84.6 with Mosquitto plugin
confirmed
Although i should mention that resolving of this plugin is buggy; on any other plugin (or anywhere in the system/setup) I can either use 'hassio.local' or 'localhost'. (besides the 'homeassistant build-in name)*. This one does not support that; just fails on connection to MQTT server as mentioned in this issue.
* I do not have any (other) internal/local name resolving system in-place.
I am having the same issue. I've tried everything. I've tried everything. It appears to connect.
Log:
zigbee2mqtt:info 3/14/2019, 5:08:28 PM zigbee-shepherd started
zigbee2mqtt:info 3/14/2019, 5:08:28 PM Coordinator firmware version: '20190223'
zigbee2mqtt:info 3/14/2019, 5:08:28 PM Currently 0 devices are joined:
zigbee2mqtt:info 3/14/2019, 5:08:28 PM Zigbee: disabling joining new devices.
zigbee2mqtt:info 3/14/2019, 5:08:28 PM Connecting to MQTT server at mqtt://localhost
zigbee2mqtt:debug 3/14/2019, 5:08:28 PM MQTT reject_unauthorized set false, ignoring certificate warnings.
2019-03-15T00:08:29.046Z zigbee-shepherd:request REQ --> ZDO:mgmtPermitJoinReq
zigbee2mqtt:info 3/14/2019, 5:08:29 PM zigbee-shepherd ready
2019-03-15T00:08:29.062Z zigbee-shepherd:request REQ --> AF:register
2019-03-15T00:08:29.086Z zigbee-shepherd:msgHdlr IND <-- ZDO:mgmtPermitJoinRsp
2019-03-15T00:08:29.101Z zigbee-shepherd:request RSP <-- AF:register, status: 0
2019-03-15T00:08:29.102Z zigbee-shepherd Register zApp, epId: 11, profId: 260
2019-03-15T00:08:29.103Z zigbee-shepherd:request REQ --> ZDO:nodeDescReq
2019-03-15T00:08:29.129Z zigbee-shepherd:msgHdlr IND <-- ZDO:nodeDescRsp
2019-03-15T00:08:29.130Z zigbee-shepherd:request REQ --> ZDO:activeEpReq
2019-03-15T00:08:29.158Z zigbee-shepherd:msgHdlr IND <-- ZDO:activeEpRsp
zigbee2mqtt:debug 3/14/2019, 5:08:29 PM Mounted the cieApp (epId 11)
zigbee2mqtt:error 3/14/2019, 5:08:39 PM Not connected to MQTT server!
zigbee2mqtt:error 3/14/2019, 5:08:49 PM Not connected to MQTT server!
zigbee2mqtt:error 3/14/2019, 5:08:59 PM Not connected to MQTT server!
zigbee2mqtt:error 3/14/2019, 5:09:09 PM Not connected to MQTT server!
zigbee2mqtt:error 3/14/2019, 5:09:19 PM Not connected to MQTT server!
zigbee2mqtt:error 3/14/2019, 5:09:29 PM Not connected to MQTT server!
So the problem is if you change anything in the UI docker config it doesn't write properly to
/share/zigbee2mqtt/configuration.yaml properly. I had to edit it by hand via ssh.
I have also a problem with zigbe2mqtt. I installed the add-on and it worked. I could pair a device.
But after some upgrades of hassio (now 0.91.3), it is not working more. The log shows:
zigbee2mqtt:info 4/13/2019, 11:05:57 AM Logging to directory: '/share/zigbee2mqtt/log/2019-04-13.11-05-57'
zigbee2mqtt:info 4/13/2019, 11:06:00 AM Starting zigbee2mqtt version 1.3.0 (commit #unknown)
zigbee2mqtt:info 4/13/2019, 11:06:00 AM Starting zigbee-shepherd
zigbee2mqtt:info 4/13/2019, 11:06:02 AM zigbee-shepherd started
zigbee2mqtt:info 4/13/2019, 11:06:02 AM Coordinator firmware version: '20190109'
zigbee2mqtt:info 4/13/2019, 11:06:02 AM Currently 1 devices are joined:
zigbee2mqtt:info 4/13/2019, 11:06:02 AM 0x00158d0002ec0869 (0x00158d0002ec0869):
zigbee2mqtt:info 4/13/2019, 11:06:02 AM Zigbee: disabling joining new devices.
zigbee2mqtt:info 4/13/2019, 11:06:02 AM Connecting to MQTT server at mqtt://homeassistant:1883
zigbee2mqtt:info 4/13/2019, 11:06:02 AM zigbee-shepherd ready
zigbee2mqtt:error 4/13/2019, 11:06:12 AM Not connected to MQTT server!
zigbee2mqtt:error 4/13/2019, 11:06:22 AM Not connected to MQTT server!
zigbee2mqtt:error 4/13/2019, 11:06:32 AM Not connected to MQTT server!
I tried a lot (with and without user and pass, different mqtt server adress), but all without success.
My config is:
{
"data_path": "/share/zigbee2mqtt",
"homeassistant": true,
"permit_join": false,
"mqtt_base_topic": "zigbee2mqtt",
"mqtt_server": "mqtt://homeassistant:1883",
"serial_port": "/dev/ttyACM0",
"devices": [],
"network_key": [],
"disable_led": true
}
and the configuration.yaml
mqtt:
broker: homeassistant
discovery: true
Can someone help me?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Mosquitto in hassio Docker network has alias core-mosquitto, so z2m's config has to look like this:
…
"mqtt": {
"base_topic": "zigbee2mqtt",
"server": "mqtt://core-mosquitto",
…
Mosquitto in hassio Docker network has alias
core-mosquitto, so z2m's config has to look like this:… "mqtt": { "base_topic": "zigbee2mqtt", "server": "mqtt://core-mosquitto", …
You're a lifesaver!
Most helpful comment
Mosquitto in hassio Docker network has alias
core-mosquitto, so z2m's config has to look like this: