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

SAIC-iSmart-API repository for Home Assistant OS (HASS.IO)
MIT License
59 stars 7 forks source link

ValueError: non-hexadecimal number found in fromhex() arg at position 4 #51

Open GamEased opened 9 months ago

GamEased commented 9 months ago

Hey all,

I just installed this add-on (I used python). My Gateway is mosquitto. Add-On Version is 0.4.6 The Sensors (HA Discovery) get created but after a while this error comes up and no values are pulled:

2024-01-27 00:03:53,097 [ ERROR  ] 'handle_vehicle_XXXXXXXXXXXXX' task crashed with an exception - __main__
Traceback (most recent call last):
  File "/usr/src/app/./mqtt_gateway.py", line 90, in handle_vehicle
    vehicle_status = self.update_vehicle_status()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/./mqtt_gateway.py", line 110, in update_vehicle_status
    vehicle_status_rsp_msg = self.saic_api.get_vehicle_status_with_retry(self.vin_info)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/saic_api.py", line 193, in get_vehicle_status_with_retry
    return self.handle_retry(self.get_vehicle_status, vin_info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/saic_api.py", line 457, in handle_retry
    return self.__handle_retry_with_app_data(func, vin_info=vin_info, max_retries=max_retries)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/saic_api.py", line 488, in __handle_retry_with_app_data
    rsp = func(vin_info)
          ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/saic_api.py", line 188, in get_vehicle_status
    self.message_V2_1_coder.decode_response(vehicle_status_rsp_hex, vehicle_status_rsp_msg)
  File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/ota_v2_1/Message.py", line 12, in decode_response
    return super().decode_response(message, decoded_message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/saic_ismart_client/common_model.py", line 495, in decode_response
    buffered_message_bytes = io.BytesIO(bytes.fromhex(message[5:]))
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: non-hexadecimal number found in fromhex() arg at position 4

I am not a programmer but it seems like some variables have the wrong declaration of datatype - or the API sends information to the wrong places

I already tried reinstalling it as well as tested the Java Add-On - this gave me another error which I didnt really looked into as I planned to use python regardless.

My HA is on versions: Core 2024.1.5 Supervisor 2023.12.1 Operating System 11.4 Frontend 20240104.0

Thank yall

jaxoft commented 9 months ago

Hi, Same here, but my integration was working allready until yesterday 11:48. Looks like there are problems with the API at SAIC site and maybe there are some changes comming as well?

GamEased commented 9 months ago

Lucky me then timin wise :D

I read something about an API 2.0 or the new iSmart 2 App - tbh, my App got a big rework a few weeks ago so maybe they did some changes there and those brilliant people of this community need time to figure out :) I'm sure either way they will get it to work. THanks to everyone putting their time and effort in those things.

GamEased commented 9 months ago

It is solved - you just have to refresh your car in the I smart app once. After that it works. Don't ask me why please^^

Tonno87 commented 9 months ago

I think it is a server problem. I used the app yesterday evening, but also after that the gateway won't work.

GamEased commented 9 months ago

Did you try a complete scan of the car?

Tonno87 commented 9 months ago

Yes, to make sure the car was locked.

jaxoft commented 9 months ago

It is solved - you just have to refresh your car in the I smart app once. After that it works. Don't ask me why please^^

yes thanks, also it works here again. And thanks developers ! for the good work to create this functionality for contact with the EV !

jaxoft commented 9 months ago

I constantly see in my logging errors from my Tyre pressure. It looks like i have an issue with my sensor. Don't think this has nothing to do with the API. @GamEased, Do you have also messages in the logging, like this? 2024-01-27 19:30:58,208 [ INFO ] Job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-01-27 19:31:57 CET)" executed successfully - apscheduler.executors.default 2024-01-27 19:31:57,493 [ INFO ] Running job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-01-27 19:32:57 CET)" (scheduled at 2024-01-27 19:31:57.485003+01:00) - apscheduler.executors.default 2024-01-27 19:31:57,945 [ INFO ] 5 messages received - main 2024-01-27 19:31:57,947 [ INFO ] ID: 21845378, Time: 2024-01-17 15:53:03, Type: 801, Title: Abnormaal alarm, Content: De bandendruk van uw voertuig (498) is abnormaal. Laat het voertuig op tijd controleren in verband met de veiligheid., Status: unread, Sender: TBOX, VIN: xxxxx- main 2024-01-27 19:31:57,947 [ INFO ] ID: 21842441, Time: 2024-01-17 15:17:23, Type: 801, Title: Abnormaal alarm, Content: De status van uw linkerachterband (498) is abnormaal. Laat het voertuig op tijd controleren in verband met de veiligheid., Status: unread, Sender: TBOX, VIN: xxxxx- main 2024-01-27 19:31:57,948 [ INFO ] ID: 21839010, Time: 2024-01-17 14:36:43, Type: 801, Title: Abnormaal alarm, Content: De bandendruk van uw voertuig (498) is abnormaal. Laat het voertuig op tijd controleren in verband met de veiligheid., Status: unread, Sender: TBOX, VIN: xxxxx- main 2024-01-27 19:31:57,949 [ INFO ] ID: 21839009, Time: 2024-01-17 14:36:43, Type: 801, Title: Abnormaal alarm, Content: De status van uw linkerachterband (498) is abnormaal. Laat het voertuig op tijd controleren in verband met de veiligheid., Status: unread, Sender: TBOX, VIN: xxxxx- main 2024-01-27 19:31:57,949 [ INFO ] ID: 21008018, Time: 2024-01-09 15:03:46, Type: 801, Title: Abnormal Alarm, Content: The Tyre Pressure of your vehicle (***498) is abnormal, please check the vehicle in time to ensure the safety., Status: unread, Sender: TBOX, VIN: xxxxx- main 2024-01-27 19:31:57,950 [ INFO ] Job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-01-27 19:32:57 CET)" executed successfully - apscheduler.executors.default

GamEased commented 9 months ago

I constantly see in my logging errors from my Tyre pressure. It looks like i have an issue with my sensor. Don't think this has nothing to do with the API. @GamEased, Do you have also messages in the logging, like this? 2024-01-27 19:30:58,208 [ INFO ] Job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-01-27 19:31:57 CET)" executed successfully - apscheduler.executors.default 2024-01-27 19:31:57,493 [ INFO ] Running job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-01-27 19:32:57 CET)" (scheduled at 2024-01-27 19:31:57.485003+01:00) - apscheduler.executors.default 2024-01-27 19:31:57,945 [ INFO ] 5 messages received - main 2024-01-27 19:31:57,947 [ INFO ] ID: 21845378, Time: 2024-01-17 15:53:03, Type: 801, Title: Abnormaal alarm, Content: De bandendruk van uw voertuig (498) is abnormaal. Laat het voertuig op tijd controleren in verband met de veiligheid., Status: unread, Sender: TBOX, VIN: XXXXXXX - main 2024-01-27 19:31:57,947 [ INFO ] ID: 21842441, Time: 2024-01-17 15:17:23, Type: 801, Title: Abnormaal alarm, Content: De status van uw linkerachterband (498) is abnormaal. Laat het voertuig op tijd controleren in verband met de veiligheid., Status: unread, Sender: TBOX, VIN: XXXXXXXX - main 2024-01-27 19:31:57,948 [ INFO ] ID: 21839010, Time: 2024-01-17 14:36:43, Type: 801, Title: Abnormaal alarm, Content: De bandendruk van uw voertuig (498) is abnormaal. Laat het voertuig op tijd controleren in verband met de veiligheid., Status: unread, Sender: TBOX, VIN: XXXXXXXX - main 2024-01-27 19:31:57,949 [ INFO ] ID: 21839009, Time: 2024-01-17 14:36:43, Type: 801, Title: Abnormaal alarm, Content: De status van uw linkerachterband (498) is abnormaal. Laat het voertuig op tijd controleren in verband met de veiligheid., Status: unread, Sender: TBOX, VIN: XXXXXXXXX - main 2024-01-27 19:31:57,949 [ INFO ] ID: 21008018, Time: 2024-01-09 15:03:46, Type: 801, Title: Abnormal Alarm, Content: The Tyre Pressure of your vehicle (*498) is abnormal, please check the vehicle in time to ensure the safety., Status: unread, Sender: TBOX, VIN: XXXXXXXXX - main** 2024-01-27 19:31:57,950 [ INFO ] Job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-01-27 19:32:57 CET)" executed successfully - apscheduler.executors.default

The issue is I have this alarm active right now because of the cold my tire pressure on the tires are often a little too low until I get going - so I guess I am not able to tell false positives apart, sorry about that.

Just a tip - next time better cover your VIN as this is the identification Number for your car.

jaxoft commented 9 months ago

@GamEased ok, thanks!

GamEased commented 9 months ago

I just checked again because it is a little warmer right now. MG App on my phone says tire pressure is fine.

MQTT Log indeed says as well: 2024-01-27 20:18:00,368 [ INFO ] ID: 22058415, Time: 2024-01-19 17:56:19, Type: 801, Title: Abnormal Alarm, Content: The Tyre Pressure of your vehicle (***367) is abnormal, please check the vehicle in time to ensure the safety., Status: unread, Sender: TBOX, VIN: XXXXXXXXX - __main__

So I guess it's some form of bug.