Hi,
I've followed all the instructions, but when i try to start, it fails to connect to mqtt server.
I've tested the mqtt server is up and running (homeassistant is using it, and I've used an external test tool on the same machine as the zigbee2mqtt to test the connection.)
Log output:
https://pastebin.com/gy4nQ72R
The configuration.yaml is the default one, I've just uncomented the user and password as my mqtt server (mosquitto) has authentication enabled.
what's your environment? Also, try to replace localhost with your mqtt ip.
I'm running linux mint
I've already tested with the IP, but got the same issue.
Are you including the port in the server specification? E.g.,
server: 'mqtt://localhost:1883'
Still the same.
Tried it using: 'mqtt://localhost:1883' , 'mqtt://127.0.0.1:1883' ( I know it's the same, but at this point it clouldn't harm to check), and using my IP.
Basic questions:
I would bet my money on it that you're using the built in broker from Home Assistant and can't publish messages therefore.
But only a guess.
Basic questions:
- Which mqtt broker?
- got auth at your broker?
- does [mosquitto_pub -h localhost -t test -m "hello world"] work? (You maybe have to add user and auth)
I would bet my money on it that you're using the built in broker from Home Assistant and can't publish messages therefore.
But only a guess.
Which mqtt broker?
-> Eclipse Mosquitto
got auth at your broker?
-> Yes, As I said in the #1 post, the only config I changed in configuration.yaml was to set the user & password.
does [mosquitto_pub -h localhost -t test -m "hello world"] work? (You maybe have to add user and auth)
-> That command outputs an error due to auth.
However this one with authentication works like a charm [mosquitto_pub -h localhost -u username -P password -t test -m "hello world"]
Thanks
OK, so I made some tests, and seems like the issue is related to authentication.
I created a new environment and installed Mosquitto on it.
Tried to connect the zigbee2mqtt to it and voila, it connected without any issues.
After this, I enabled authentication and again tried to connect.
This time i got the same error, "Not connected to MQTT server!"
Any new ideas on how to approach this (without having to disable authentication)?
Thanks
Well this was kind of a dumb thing, but at least I fond the issue.
In case anyone has the same problem, username and password must be quoted, example:
mqtt:
base_topic: zigbee2mqtt
server: 'mqtt://localhost:1883'
user: 'user'
password: 'password'
reject_unauthorized: false
serial:
port: /dev/ttyACM0
advanced:
log_level: debug
I fixed it by specifying a user/password. Weird because my MQTT server doesn't require one from other applications.
Well this was kind of a dumb thing, but at least I fond the issue.
In case anyone has the same problem, username and password must be quoted, example:
mqtt:
base_topic: zigbee2mqtt
server: 'mqtt://localhost:1883'
user: 'user'
password: 'password'
reject_unauthorized: false
serial:
port: /dev/ttyACM0advanced:
log_level: debug
You've just saved my day!
By default docker image container works as "bridge" network type, him need to change as "host" type, then can connect with parameters (configuration.yaml):
...
mqtt:
base_topic: zigbee2mqtt
server: 'mqtt://127.0.0.1:1883'
.....
or if used as "bridge" type need use correct mqtt server ip address in your network.
Have a good day!
Most helpful comment
Well this was kind of a dumb thing, but at least I fond the issue.
In case anyone has the same problem, username and password must be quoted, example:
mqtt:
base_topic: zigbee2mqtt
server: 'mqtt://localhost:1883'
user: 'user'
password: 'password'
reject_unauthorized: false
serial:
port: /dev/ttyACM0
advanced:
log_level: debug