I cannot connect to the mqtt broker. I have this issue regularly, sometimes it magically works.
Everything runs in docker container. I can connect via mqtt explorer and see mosquitto receiving messages. I can also publish messages, but openhab does not receive it.
I installed mosquitto-clients within the openhab container and subscribed to various topics, but cannot see any message/topic from within the openhab container. io.netty.channel.ConnectTimeoutException: connection timed out: /192.168.103.44:1883
Please don’t setup a mosquitto client within the openHAB container.
Docker containers should not be changed like this (at least if you don’t like to maintain your container)
Instead, use the standard docker container and another docker container for mosquitto server.
The openHAB container should be run in host mode to get stuff like avahi running.
What are the ip addresses of both openHAB and mosquitto?
Thank you very much for the hints. I think I was not specific enough here:
mosquitto and openHAB run in different container.
I just installed mosquitto in the openHAB container for testing reasons. I did not know what else to test as
a) Internet connection is working properly from within the openHAB container
b) mqtt broker mosquitto is also working properly in the network (confirmed by mqtt explorer).
When I just delete the OpenHAB container (not the volumes) and start it again, I have a fresh system without mosquitto installed into OpenHAB.
openHAB and mosquitto run on the same server with ip 192.168.103.44.
The adresses within docker are:
Its really annoying. I just found out that when you put openhab and mosquitto in the same network, openhab can access the mqtt server with the adress from the docker network (here: 172.18.0.7). But it cannot access from the “official” server port 192.168.103.44:1883.