-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Started using this integration again as the other MG integration is not longer being developed. I have updated my config (although nothing has changed) and im having issues with the connection from the container to MQTT.
Docker Compose
services:
saic-mqtt-gateway:
image: "saicismartapi/saic-python-mqtt-gateway:latest"
container_name: saic-mqtt-gateway
hostname: saic-mqtt-gateway
env_file: .env
restart: always
#volumes:
# - ./charging-stations.json:/usr/src/app/charging-stations.json
networks:
default:
name: $MY_DEFAULT_NETWORK
external: true
reverse_proxy:
name: $MY_REVERSEPROXY_NETWORK
external: true
.env
# GENERAL
MY_DEFAULT_NETWORK=home_automation
MY_REVERSEPROXY_NETWORK=reverse_proxy
MY_DOMAIN=mydoman.fqdn
TZ=Europe/London
PGID=996
PUID=1100
# SAIC-MQTT-GATEWAY
MQTT_URI=tcp://mqtt-mosquitto:1833
#MQTT_URI=ws://mqtt-mosquitto:9001
MQTT_USER=myuser
MQTT_PASSWORD=mymqttpwd
SAIC_USER=myuser
SAIC_PASSWORD=mypassword
MQTT is anonymous but ive also created a user/password combo for this connection which i can connect fine with from my phone.
mqtt-mosquitto is the docker DNS address for the container and is on 172.18.0.2 (same docker network) so i dont see how its a routing problem.
If i switch to websockets i get an error saying its trying to write to a closed socket - unsure why.
I had this before and had to set a username and password which i have done so im a bit stuck
Error log upon docker compose up
saic-mqtt-gateway | 2025-06-17 09:04:45,837 [INFO]: Connecting to MQTT Broker - mqtt_gateway
saic-mqtt-gateway | Traceback (most recent call last):
saic-mqtt-gateway | File "/usr/src/app/./main.py", line 24, in <module>
saic-mqtt-gateway | asyncio.run(mqtt_gateway.run(), debug=debug_log_enabled())
saic-mqtt-gateway | File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
saic-mqtt-gateway | return runner.run(main)
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
saic-mqtt-gateway | return self._loop.run_until_complete(task)
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
saic-mqtt-gateway | return future.result()
saic-mqtt-gateway | ^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/src/app/mqtt_gateway.py", line 100, in run
saic-mqtt-gateway | await self.publisher.connect()
saic-mqtt-gateway | File "/usr/src/app/publisher/mqtt_publisher.py", line 63, in connect
saic-mqtt-gateway | await self.client.connect(
saic-mqtt-gateway | File "/usr/src/app/.venv/lib/python3.12/site-packages/gmqtt/client.py", line 224, in connect
saic-mqtt-gateway | self._connection = await self._create_connection(
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/src/app/.venv/lib/python3.12/site-packages/gmqtt/client.py", line 240, in _create_connection
saic-mqtt-gateway | connection = await MQTTConnection.create_connection(host, port, ssl, clean_session, keepalive, logger=self._logger)
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/src/app/.venv/lib/python3.12/site-packages/gmqtt/mqtt/connection.py", line 27, in create_connection
saic-mqtt-gateway | transport, protocol = await loop.create_connection(MQTTProtocol, host, port, ssl=ssl)
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1132, in create_connection
saic-mqtt-gateway | raise exceptions[0]
saic-mqtt-gateway | File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1107, in create_connection
saic-mqtt-gateway | sock = await self._connect_sock(
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1010, in _connect_sock
saic-mqtt-gateway | await self.sock_connect(sock, address)
saic-mqtt-gateway | File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 651, in sock_connect
saic-mqtt-gateway | return await fut
saic-mqtt-gateway | ^^^^^^^^^
saic-mqtt-gateway | File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 691, in _sock_connect_cb
saic-mqtt-gateway | raise OSError(err, f'Connect call failed {address}')
saic-mqtt-gateway | ConnectionRefusedError: [Errno 111] Connect call failed ('172.18.0.2', 1833)
saic-mqtt-gateway exited with code 1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working