gbeine / airrohr2mqtt

MIRROR - An Airrohr-to-MQTT Bridge
https://c0d3.sh/smarthome/airrohr2mqtt
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Can't get it to work. Configuration(file) not read? #1

Open WBeulink opened 1 month ago

WBeulink commented 1 month ago

Hello, I'am trying to get your project working. Followed the instructions for setup via Docker. It looks like the connection to MQTT fails. Getting same set of errors all the time. But also same result if I give an incorrect link to the configuration file. So: Is it found or used. These lines are what I get:

_Traceback (most recent call last): File "/airrohr2mqtt/./airrohr2mqtt", line 203, in main() File "/airrohr2mqtt/./airrohr2mqtt", line 196, in main mqtt_client = init_mqtt() ^^^^^^^^^^^ File "/airrohr2mqtt/./airrohr2mqtt", line 81, in init_mqtt mqtt_client.connect(daemon_args.mqtt_host, daemon_args.mqtt_port, daemon_args.mqtt_keepalive) File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1435, in connect return self.reconnect() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1598, in reconnect self._sock = self._create_socket() ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 4609, in _create_socket sock = self._create_socket_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 4640, in _create_socket_connection return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/socket.py", line 865, in create_connection raise exceptions[0] File "/usr/local/lib/python3.12/socket.py", line 850, in createconnection sock.connect(sa) OSError: [Errno 99] Address not available

gbeine commented 1 month ago

It seems you have either no proper IP address assignment to your docker container or you are using hostnames without proper /etc/hosts mapping.

WBeulink commented 1 month ago

Thank you for your prompt answer/reaction:

On my Docker machine running multiple containers I have this command run from within a submap (airrohr2mqtt): docker run -it --rm --name airrohr2mqtt -v airrohr2mqtt.conf:/etc/airrohr2mqtt.conf docker.io/gbeine/airrohr2mqtt In the submap resides the config file: airrohr2mqtt.conf With content: { "mqtt_host": "192.168.2.207", "mqtt_port": "1883" "mqtt_port": "keepalive" "mqtt_clientid": "airrohr2mqtt" "mqtt_user": "mqtt-user" "mqtt_password": "xxxxxxxxx", <------- real pw in place in live situation "mqtt_topic": "airrohr", "mqtt_tls": "", <------- to start simple I don't use ssl "mqtt_tls_version": "", "mqtt_verify_mode": "", "mqtt_ssl_ca_path": "", "mqtt_tls_no_verify": "", "http_host": "192.168.2.207", "http_port": "8080", "verbose": "true" }** MQTT is running OK on 192.168.2.207. I double checked that (with MQTT-explorer). Docker is also running on 192.168.2.207 So no hostname but direct IP address.

Is this information of any use for you to debug the problem? Ik hope so ...

Willem

gbeine commented 1 month ago

I think you mixed up the IP addresses of your docker configurations. This is something I cannot help you with.

In addition: setting configuration values to "" is not the same as not setting these values. The configuration won't work in that way.