#Zigbee2mqtt - mqtt broker connection issue
1 messages ยท Page 1 of 1 (latest)
Container setup, zigbee2mqtt was using 172.17.0.4, that address appears briefly and disappears soon after container startup, logs show as above although I have both a username and password and config set to allow anyone to connect, was working well until updating.
Depending on how the containers are set up you can use the ip of the system or the name of the container. Using docker internal ips is a bad idea.
Please share the network settings for the Z2M container.
from the config file you mean?
I don't know how you created the Mosquitto container. If you created in in portainer I need to see its settings there.
I much prefer a compose file.
I basically want to check if you "forwarded" the port. If yes you can use the ip of the system. It doesn't seem to be sharing a stack/network with HA so you cannot just refer to it by name.
z2m just says bridge in portainer, mosquitto has other fields as follows - bridge 172.17.0.2 172.17.0.1 02:42:ac:11:00:04
I need a picture here.
ok, bear with me..
error msg seems to be permission related, but I have made no changes
The important part is the Port configuration section.
port is 1883
I need to see it in full.
root@CM3588-Plus:/opt/mosquitto/config# cat mosquitto.conf
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
listener 1883
from mosquitto.conf
I meant the Port configuration section from the portainer GUI. Just scroll up in your picture.
I don't see mention of the port at all
Then click Duplicate/Edit and check Port mapping.
By the way the simple way would have been to use the portainer stack feature and just copy and paste this: https://www.zigbee2mqtt.io/guide/getting-started/#_2-setup-and-start-zigbee2mqtt
that shot from mosquitto container
So it was there ๐
Alright, you should be able to use 191.168.2.15 as ip for the broker since the 1883 port is published.
ok, and the mosquitto container too?
Not sure what you mean.
mqtt:
base_topic: zigbee2mqtt
server: mqtt://191.168.2.15
Try this for Z2M.
all this was working on the bridge network 'till now *172XXXXX"
You can check the container's ip via docker inspect too but it's not a good idea to use those ips as they can change.
I'm not sure why portainer shows no ip in the GUI for that container. Check the container's log to see if it's even running properly.
the bridge ip shows briefly and is removed when the connection is rejected by the mosquitto container
portainer and mosquitto containers both show 172 addresses
the z2m container logs show just the error I posted, otherwise it was running well with just mqtt messages and no errors
You need to check the mosquitto container logs as that's the one not showing an ip.
mosquitto container has never shown any log messages
Hmm. Well, see if you can connect with the ip I gave you above. Also see if you can connect via MQTT Explorer to that ip.
mosquitto container shows 172 ip address, it's z2m that doesn't
Ah, right.
I don't really know enough about it, just followed some guides, but prior to updating it was working well, z2m was showing 172.17.10.4 and does on restart, until the connection gets rejected by mosquitto, then the ip is removed from the portainer display
Does that work?
sorry, was afk, I'll see..
You can use this to get a list of your containers' internal ips
docker ps -q | xargs docker inspect --format '{{ .Name }} {{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' | tr -d '/' | column -t
Not really useful if you ask me.
now it's back..
docker ps -q | xargs docker inspect --format '{{ .Name }} {{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' | tr -d '/' | column -t
homeassistant
configurator
mosquitto 172.17.0.2
zigbee2mqtt
portainer 172.17.0.3
I'd need to see the network/port output of docker inspect zigbee2mqtt.
Please use a code share site to share code or logs, for example:
- https://dpaste.org/ (select YAML for the language, and consider picking a longer expiry)
- http://pastie.org/ (select YAML for the language)
- https://paste.debian.net/ (you guessed it, select YAML as the language)
Please don't use Pastebin, since it can randomly add spaces to the main view. Please also don't share text as images since it makes it harder for people to help you. Remember that others may have colour blindness, impaired vision, etc.
But before we do anything else, please test what I shared above. See if you can connect to the broker.
Some of my containers have no internal ip either but they work fine. Host networking can cause that, for example. Or in other words, don't focus on that ip for now. We are getting nowhere like that.
Ok, I entered the local ip address in the z2m config, restarted the z2m container, now I can see the z2m GUI and controll devices from there, home assistant is not connected and portainer still shows the 172 bridge address
I was previously unable to view the z2m gui
Alright so issue fixed. Can you share docker inspect zigbee2mqtt?
If you put both containers into the same network you can refer to them by the name. System ip works too, but unless you reserved it it can change too.
There's many ways to do things. You could use the hostname of your system for example but whether that works depends on your networking setup.
didn't see a yaml option, hopefully that's what you wanted, still seems to show that bridge ip
Yeah that's fine. Hmm. That looks fairly normal.
My guess is the ip went missing because the Z2M app inside basically dies if it cannot connect to the broker.
yeah, that sounds about right, I can now manually switch devices from port 8080 z2m, but HA is disconnected so automations don't work and no sensor data on dash
Reconfigure the MQTT integration and give it the same ip.
I picked a difficult road for a noob I guess, was stoked when I got it working and has been fine 'till now
In the case of HA you can actually use localhost since it uses host networking. At least if you followed the docs.
Well portainer might look easier but it's not. It's extremely annoying and difficult to help and get help with it.
If you have to use portainer use its stack feature. You can use compose formatting in there.
I still see the bridge 172 address in that output though too
Probably because the container now isn't dead ๐
I only care that it works. What portainer shows isn't really of interest to me.
mosquitto config just lists listener on 1883, where would I change to the local network?
I did not say mosquitto, I said MQTT integration.
Go here and select MQTT: https://my.home-assistant.io/redirect/integrations/
ok, logs in z2m are normal now, just mqtt chatter
thanks, restarting HA
I assume 191.168.2.15 is reserved in your router with a static DHCP lease?
it's not yet ๐ on my todo list, but that seems to have done the trick, HA sees my devices now, thank you
I did see recommendations for a static ip, had no issue with that as yet
I wonder why the update broke things?
Unless your server goes down for a while you will probably keep the ip but it can technically change at any time.
I don't know how docker chooses to assign the internal ips. Maybe recreation caused it to get a new one.
well, portainer was showing the same 172 addresses I had from the beginning and it still does, it's confusing
I'm learning things all the time but very early days atm ๐
No idea then.
anyway, thanks for the assistance ๐
I can just re-create the containers to pull a late image, but not the portainer container, I guess it would have to be created from a docker-compose file?
Many ways. I think it's best to update it via the OMV GUI.
OMV is up to date, not sure I can do it from there
Pretty sure you can in the specific section for it.
Portainer is containerized too though
Sure but the portainer container was created by the OMV GUI, no?
docker command?..not sure now, I'll check the guide article