SAIC-iSmart-API/saic-home-assistant-addon

Python Gateway always crashes after short period of time

Closed this issue · 1 comments

Hi,
I have installed and set up the python gateway 0.3.0 for the SAIC API but it keeps crashing / stopping. When I restart the addon or home assistant, it seems to work for a short amount of time (MG logo is red, it shows CPU and memory usage), but eventually stops (MG logo turns black, no CPU and memory usage anymore, and addon overview shows "Starten (start)". It also does not provide any value(s) to the sensors. Attached is the log:

2023-08-09 14:41:19,165 Connected to MQTT broker Traceback (most recent call last): File "/usr/src/app/./mqtt_gateway.py", line 589, in <module> mqtt_gateway.run() File "/usr/src/app/./mqtt_gateway.py", line 269, in run login_response_message = self.saic_api.login() File "/usr/local/lib/python3.10/site-packages/saic_ismart_client/saic_api.py", line 120, in login self.message_v1_1_coder.decode_response(login_response_hex, login_response_message) File "/usr/local/lib/python3.10/site-packages/saic_ismart_client/ota_v1_1/Message.py", line 13, in decode_response super().decode_response(message, decoded_message) File "/usr/local/lib/python3.10/site-packages/saic_ismart_client/common_model.py", line 400, in decode_response message_body_dict = self.asn1_tool_uper.decode(message_body.asn_type, dispatcher_message_bytes) File "/usr/local/lib/python3.10/site-packages/asn1tools/compiler.py", line 167, in decode decoded = type_.decode(data) File "/usr/local/lib/python3.10/site-packages/asn1tools/codecs/uper.py", line 500, in decode raise e File "/usr/local/lib/python3.10/site-packages/asn1tools/codecs/uper.py", line 496, in decode return self._type.decode(decoder) File "/usr/local/lib/python3.10/site-packages/asn1tools/codecs/per.py", line 830, in decode decoded = self.decode_root(decoder) File "/usr/local/lib/python3.10/site-packages/asn1tools/codecs/per.py", line 848, in decode_root raise e File "/usr/local/lib/python3.10/site-packages/asn1tools/codecs/per.py", line 844, in decode_root value = member.decode(decoder) File "/usr/local/lib/python3.10/site-packages/asn1tools/codecs/uper.py", line 107, in decode value = decoder.read_non_negative_binary_integer(self.bits_per_character) File "/usr/local/lib/python3.10/site-packages/asn1tools/codecs/per.py", line 449, in read_non_negative_binary_integer raise OutOfDataError(self.number_of_read_bits()) asn1tools.codecs.OutOfDataError: MPDispatcherBody.uid: out of data (At bit offset: 58)

Any idea whats causing this? I have already tried anything that has been suggested here in other issues, like disabling auto discovery etc, but it does not solve the problem. I have a red 2022 MG 5 long range luxury.

After having done some more analysis (with the help of the mqtt explorer), I could elaborate that the SAIC api denied my password. This is interesting because the exact same password worked for the mobile app. I have set a new password with all chars being lower case and no special characters in it, and that worked for the gateway.

So conclusion is 3 things:

  1. it wasn't the gateways / addons fault
  2. Either upper case or special characters (or the combination of both) resulted in "Wrong password" response from SAIC api
  3. But the above works in the mobile app

I might investigate further to see what exactly caused the "wrong passwd" problem. For now I am closing this, as the gateway is working as expected and does not crash any longer.