hvalev / dht22mqtt-homeassistant-docker

Docker container for the DHT11/DHT22/AM2302 sensors, able to relay sensor readings to a MQTT broker. Integrates with HomeAssistants' discovery protocol and incorporates a robust outlier detection scheme. All features are configurable, where the container can be used to simply log data too.
MIT License
7 stars 4 forks source link

Connectivity issues #54

Open JakobTewes opened 2 months ago

JakobTewes commented 2 months ago

Heyhey,

since a few, I´ve got problems with the containers MQTT connectivity although MQTT is running and reachable from the docker host. Seeing this error message:

Traceback (most recent call last): File "//dht22mqtt.py", line 216, in <module> client.connect(mqtt_brokeraddr, keepalive=dht22mqtt_refresh*60) File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 914, in connect return self.reconnect() File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1044, in reconnect sock = self._create_socket_connection() File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source) File "/usr/local/lib/python3.9/socket.py", line 843, in create_connection raise err File "/usr/local/lib/python3.9/socket.py", line 831, in create_connection sock.connect(sa) socket.timeout: timed out

Maybe someone can help?

Thanks and regards

Jakob

hvalev commented 2 months ago

Hey @JakobTewes, I haven't used this container myself in some time. I'll take a look soon, likely sometime next week. Meanwhile, can you try adding network_mode: "host" to the docker compose file and also check if your mqtt network is configured to accept new devices?