tdenolle / bayrol-poolaccess-mqtt

MIT License
3 stars 0 forks source link

Unable to start the addon after configuration #1

Closed thibaud-sanchez closed 2 weeks ago

thibaud-sanchez commented 2 months ago

Hi, Thank you very much for creating this addon ! I've installed the addon and set the configuration (token, serial number, mqtt url, etc.) but I've got this error when I try to start it by using the launch button :

[FATAL tini (7)] exec /usr/bin/entrypoint.sh failed: Exec format error

Is there any log anywhere else ?

tdenolle commented 2 months ago

Hi, could you please indicate the platform your hass host is installed on ? arm, amd, i386 ? 32/64bits ?

thibaud-sanchez commented 2 months ago

Intel core i7 (64bits) via proxmox vm

thibaud-sanchez commented 2 months ago

The update to 1.2 worked. I still have configuration issue and don't know which mqtt server refused me 😀

2024-07-07 10:51:04,507 :: INFO :: Starting Bridge
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/app/PoolAccessMqttBridge.py", line 183, in <module>
    main()
  File "/app/PoolAccessMqttBridge.py", line 168, in main
    bridge.start()
  File "/app/PoolAccessMqttBridge.py", line 149, in start
    self._brocker_client.establish_connection()
  File "/app/mqtt/MqttClient.py", line 31, in establish_connection
    super().connect(self._host, self._port)
  File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1435, in connect
    return self.reconnect()
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 1598, in reconnect
    self._sock = self._create_socket()
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/paho/mqtt/client.py", line 4609, in _create_socket
    sock = self._create_socket_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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.11/socket.py", line 851, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.11/socket.py", line 836, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

If I change localhost to the homeassistant IP I have a not authorized despite Username and password are good

2024-07-07 10:52:32,270 :: INFO :: Starting Bridge
2024-07-07 10:52:33,201 :: INFO :: [mqtt] on_connect: Connection failed [Not authorized]
tdenolle commented 1 month ago

I just add more log details on connection failed issue in 1.2.1 realease but looks like add-on can not connect to your mqtt brocker. I'm not familiar with proxmox vm but my personal config (raspberry pi) is pointing to local IP address (eg 192.168.1.123) I suggest you to try connecting to your VM via ssh and check network access via telnet.

thibaud-sanchez commented 1 month ago

Thank you, I'll check the network but does your mqtt client run in a docker ? It seems not able to access to the local network.

The error I have with localhost is:

Starting Bridge 2024-07-07 21:02:50,486 :: DEBUG :: Sending CONNECT (u1, p1, wr0, wq0, wf0, c0, k60) client_id=b'user_66f7e66e' 2024-07-07 21:02:50,486 :: ERROR :: Failed to connect to localhost:1883. [Errno 111] Connection refused 2024-07-07 21:02:50,487 :: ERROR :: MQTT Brocker connection failure !

And with local network ip:

Starting Bridge 2024-07-07 21:03:57,488 :: DEBUG :: Sending CONNECT (u1, p1, wr0, wq0, wf0, c0, k60) client_id=b'user_abd5d470' 2024-07-07 21:03:57,489 :: DEBUG :: Sending CONNECT (u1, p1, wr0, wq0, wf0, c0, k60) client_id=b'user_e500e9a9' 2024-07-07 21:03:57,489 :: INFO :: Starting Multithreading 2024-07-07 21:03:57,781 :: DEBUG :: Received CONNACK (0, 5) 2024-07-07 21:03:57,782 :: INFO :: [mqtt] on_connect: Connection failed [Not authorized]

I've tested the connection to my mqtt broker via mqtt explorer and it's fine. I've some physical devices which can connect to the broker and are using it (opendtu, pvrouter)

tdenolle commented 1 month ago

"does your mqtt client run in a dicker ?" => yes my mqtt broker is running in a docker container (https://github.com/home-assistant/addons/tree/master/mosquitto)

thibaud-sanchez commented 1 month ago

Thanks for your help. I think that the addon need to have the option host~network set to true (https://developers.home-assistant.io/docs/add-ons/configuration/)

How can I test it locally without forking the project ? Is the addon pulled somewhere in ha folder and can be edited ? (Never done an ha addon)

Example: https://github.com/hassio-addons/addon-adguard-home/blob/main/adguard/config.yaml#L28

tdenolle commented 1 month ago

1/ you can connect to your HA host using the following doc: https://developers.home-assistant.io/docs/operating-system/debugging/ 2/ once connected through ssh, addon config is located in /mnt/data/supervisor/addons/git/55b45d85/bayrol-poolaccess-mqtt/config.json (maybe 55b45d85 id is different on your side) 3/ set the option "host_network" to true and restart the addon from the ui or using the command : ha addons restart 55b45d85_bayrol-poolaccess-mqtt

I've tested it and no weird effects on my side, let me know on yours and I'll update it in the next release.

thibaud-sanchez commented 1 month ago

It does not work :( still have same errors

thibaud-sanchez commented 2 weeks ago

Finally it works, you can close this ticket, it was a credential issue.. 😢