Closed tim0git closed 5 months ago
Exact same issue encountered.
Please try updating src/ocpp-gateway-container/requirements.txt
to fix the version of the mqtt package to one that pre-dates the version increase of path-mqtt to v2.0.0; e.g.:
asyncio-mqtt==0.16.1
If that solves the problem we’ll update the same in the repo. Thx!
I've updated the src/ocpp-gateway-container/requirements.txt
file:
boto3
websockets
asyncio-mqtt==0.16.1
And now get the following error in the Gateway Container logs:
Successfully set IOT certificates
Starting the gateway server
ERROR:websockets.server:connection handler failed
Traceback (most recent call last):
File "/opt/ocpp-gateway/lib64/python3.10/site-packages/websockets/legacy/server.py", line 236, in handler
await self.ws_handler(self)
File "/opt/ocpp-gateway/lib64/python3.10/site-packages/websockets/legacy/server.py", line 1175, in _ws_handler
return await cast(
File "/opt/ocpp-gateway/server.py", line 33, in handler
async with gateway.Gateway(charge_point_id, websocket) as iot_connection:
File "/opt/ocpp-gateway/gateway.py", line 37, in __init__
super().__init__(
File "/opt/ocpp-gateway/lib64/python3.10/site-packages/asyncio_mqtt/client.py", line 343, in __init__
self._client.message_retry_set(message_retry_set)
AttributeError: 'Client' object has no attribute 'message_retry_set'
It looks like asyncio-mqtt use paho-mqtt for mqtt client. paho-mqtt client latest version is 2.1.0 but they removed message_retry_set at version 2.0.0. https://github.com/eclipse/paho.mqtt.python/releases/tag/v2.0.0
So specify paho-mqtt version in src/ocpp-gateway-container/requirements.txt
fixed this problem.
boto3
websockets
paho-mqtt==1.6.1
asyncio-mqtt
Simulator returns the following error whilst trying to connect.
ERROR:root:CP1: received 1011 (internal error); then sent 1011 (internal error)
Gateway Container is showing the following Log output.
| Successfully set IOT certificates | | Starting the gateway server | | We renamed asyncio-mqtt to aiomqtt and released a version 1.0.0 in the process. This is the last release under the asyncio-mqtt name. You can find the new repository at https://github.com/sbtinstruments/aiomqtt | | Exception ignored in: <function Client.del at 0xffff92890040> | | Traceback (most recent call last): | | File "/opt/ocpp-gateway/lib64/python3.10/site-packages/paho/mqtt/client.py", line 874, in del | | self._reset_sockets() | | File "/opt/ocpp-gateway/lib64/python3.10/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets | | self._sock_close() | | File "/opt/ocpp-gateway/lib64/python3.10/site-packages/paho/mqtt/client.py", line 1119, in _sock_close | | if not self._sock: | | AttributeError: 'Client' object has no attribute '_sock' | | ERROR:websockets.server:connection handler failed | | Traceback (most recent call last): | | File "/opt/ocpp-gateway/lib64/python3.10/site-packages/websockets/legacy/server.py", line 236, in handler | | await self.ws_handler(self) | | File "/opt/ocpp-gateway/lib64/python3.10/site-packages/websockets/legacy/server.py", line 1175, in _ws_handler | | return await cast( | | File "/opt/ocpp-gateway/server.py", line 33, in handler | | async with gateway.Gateway(charge_point_id, websocket) as iot_connection: | | File "/opt/ocpp-gateway/gateway.py", line 37, in init | | super().init( | | File "/opt/ocpp-gateway/lib64/python3.10/site-packages/asyncio_mqtt/client.py", line 298, in init | | self._client: mqtt.Client = mqtt.Client( | | TypeError: Client.init() missing 1 required positional argument: 'callback_api_version' |