SAIC-iSmart-API / saic-python-mqtt-gateway

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when starting latest / 0.5.12 (no vin.model)

Troon opened this issue · comments

I get this when firing up a container from the docker-compose file when specifying :latest or :0.5.12 tag. :0.5.10 works for me.

2024-02-02 09:38:41,768 [  INFO  ] [CONNECTION MADE] - gmqtt.mqtt.protocol
2024-02-02 09:38:41,769 [  INFO  ] Connected to MQTT broker - mqtt_publisher
2024-02-02 09:38:41,769 [  INFO  ] [SEND SUB] 1 [b'saic/MY_EMAIL/vehicles/+/+/+/set'] - gmqtt.mqtt.package
2024-02-02 09:38:41,769 [  INFO  ] [SEND SUB] 2 [b'saic/MY_EMAIL/vehicles/+/+/+/+/set'] - gmqtt.mqtt.package
2024-02-02 09:38:41,770 [  INFO  ] [SEND SUB] 3 [b'saic/MY_EMAIL/vehicles/+/refresh/mode/set'] - gmqtt.mqtt.package
2024-02-02 09:38:41,770 [  INFO  ] [SEND SUB] 4 [b'saic/MY_EMAIL/vehicles/+/refresh/period/+/set'] - gmqtt.mqtt.package
2024-02-02 09:38:41,783 [  INFO  ] Scheduler started - apscheduler.scheduler
2024-02-02 09:38:41,783 [  INFO  ] Logging in to SAIC API - __main__
2024-02-02 09:38:41,794 [  INFO  ] [SUBACK] 1 (0,) - gmqtt
2024-02-02 09:38:41,794 [  INFO  ] [SUBACK] 2 (0,) - gmqtt
2024-02-02 09:38:41,795 [  INFO  ] [SUBACK] 3 (0,) - gmqtt
2024-02-02 09:38:41,795 [  INFO  ] [SUBACK] 4 (0,) - gmqtt
2024-02-02 09:38:42,214 [  INFO  ] Logged in as MY_EMAIL - __main__
2024-02-02 09:38:42,214 [  INFO  ] Fetching vehicle list - __main__
2024-02-02 09:38:42,515 [  INFO  ] Registering for ['ALARM_TYPE_VEHICLE_FAULT', 'ALARM_TYPE_GEOFENCE', 'ALARM_TYPE_VEHICLE_START'] messages. vin=MY_VIN - __main__
Traceback (most recent call last):
  File "/usr/src/app/./mqtt_gateway.py", line 855, in <module>
    asyncio.run(mqtt_gateway.run(), debug=debug_log_enabled())
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 684, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/src/app/./mqtt_gateway.py", line 426, in run
    vehicle_state = VehicleState(
                    ^^^^^^^^^^^^^
  File "/usr/src/app/vehicle.py", line 56, in __init__
    self.model = str(vin.model).strip().upper()
                     ^^^^^^^^^
AttributeError: 'VinInfo' object has no attribute 'model'
2024-02-02 09:38:42,580 [ ERROR  ] Task was destroyed but it is pending!
task: <Task pending name='Task-1' coro=<Client._resend_qos_messages() running at /usr/local/lib/python3.12/site-packages/gmqtt/client.py:176>> - asyncio
sys:1: RuntimeWarning: coroutine 'Client._resend_qos_messages' was never awaited

Car is a 2022 MG4 Trophy.

Fixed in 0.5.13, building right now

Confirmed 0.5.13 starts up, but:

Traceback (most recent call last):
  File "/usr/src/app/./mqtt_gateway.py", line 92, in handle_vehicle
    charge_status = await self.update_charge_status()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/./mqtt_gateway.py", line 133, in update_charge_status
    self.vehicle_state.handle_charge_status(charge_mgmt_data)
  File "/usr/src/app/vehicle.py", line 562, in handle_charge_status
    real_total_battery_capacity = self.get_actual_battery_capacity()
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/vehicle.py", line 746, in get_actual_battery_capacity
    if self.model.startsWith('EH32 X3'):
       ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'startsWith'. Did you mean: 'startswith'?

..... Fixing.... did I mention already that I hate python?

Let's try 0.5.14

Both errors fixed. Thanks 👍