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

MIT License
67 stars 20 forks source link

SOC in ABRP always shows 80% #254

Closed kaischmitz closed 1 month ago

kaischmitz commented 2 months ago

While the SOC is correct in MQTT it always shows 80% in ABRP recently. The range shown in ABRP is correct though.

Vehicle: MG4 Versions tested: 0.6.2 and 0.6.3-rc2

image

image

tosate commented 2 months ago

Hi @kaischmitz

the range originates from the update_vehicle_status API call whereas the SoC originates from the update_charge_status API call. It seems like something goes wrong with the latter and hence only the range is submitted to ABRP. Do you have messages in your log that start with Error updating charge status?

Your logs could help to solve this issue.

kaischmitz commented 2 months ago

Hi @tosate ,

sehe da erstmal keine Fehlermeldungen. Kann ich sonst noch was checken?

Gruss,

Kai

2024-07-31 07:09:54,762 [  INFO  ] Updating vehicle status - __main__
2024-07-31 07:09:58,449 [  INFO  ] Updating charging status - __main__
2024-07-31 07:10:02,144 [  INFO  ] Updating scheduled battery heating status - __main__
2024-07-31 07:10:02,202 [  INFO  ] Refreshing vehicle status succeeded... - __main__
2024-07-31 07:10:02,432 [  INFO  ] Refreshing ABRP status succeeded... - __main__
2024-07-31 07:10:32,736 [  INFO  ] Updating vehicle status - __main__
2024-07-31 07:10:36,549 [  INFO  ] Updating charging status - __main__
2024-07-31 07:10:40,225 [  INFO  ] Updating scheduled battery heating status - __main__
2024-07-31 07:10:40,273 [  INFO  ] Refreshing vehicle status succeeded... - __main__
2024-07-31 07:10:40,578 [  INFO  ] Refreshing ABRP status succeeded... - __main__
2024-07-31 07:10:53,789 [  INFO  ] Running job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-07-31 07:11:53 UTC)" (scheduled at 2024-07-31 07:10:53.787436+00:00) - apscheduler.executors.default
2024-07-31 07:10:53,967 [  INFO  ] MessageResp(alarmNumber=0, commandNumber=0, messages=[], newsNumber=0, recordsNumber=None, totalNumber=0) unread messages - __main__
2024-07-31 07:10:53,967 [  INFO  ] Job "Check for new messages (trigger: interval[0:01:00], next run at: 2024-07-31 07:11:53 UTC)" executed successfully - apscheduler.executors.default
tosate commented 2 months ago

Hi @kaischmitz

on the MQTT broker you find the topic saic/_internal/abrp/tlm/send/request that contains the last request to ABRP. In there you find the field tlm that contains the JSON that is sent to the ABRP telemetry API.

{
    "utc": 1722445284,
    "soc": 46.9,
    "is_charging": 0,
    "is_parked": true,
    "speed": 0.0,
    "power": 0.0,
    "voltage": 394.25,
    "current": 0.0,
    "ext_temp": 29,
    "odometer": 17236.0,
    "est_battery_range": 148.0
}

If the issue originates from the MQTT gateway, then there should be the right range value and the wrong SoC value.

I don't have this issue with my MG ZS EV and it's not clear to me why the SoC is displayed correctly, but the wrong value is sent to ABRP. Especially if there are no errors during the update_charge_status request.

kaischmitz commented 1 month ago

Hi @tosate ,

looks like the request is alright, see below.

I have deleted the car from ABRP now and added it again with a new token and the problem is gone. So seems like a problem in ABRP.

Will close the issue. Thanks for your help.

{ "path": "/tlm/send", "query": { "token": [ "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ], "tlm": [ "{\"utc\": 1722583024, \"soc\": 10.7, \"is_charging\": true, \"is_parked\": true, \"speed\": 0.0, \"power\": -0.9456999999999846, \"voltage\": 337.75, \"current\": -2.7999999999999545, \"ext_temp\": 18, \"est_battery_range\": 33.0, \"heading\": 0, \"elevation\": 28, \"lat\": 51.438507, \"lon\": 6.483685}" ] }, "body": null, "headers": { "host": "api.iternio.com", "content-length": "0", "accept": "/", "accept-encoding": "gzip, deflate", "connection": "keep-alive", "user-agent": "python-httpx/0.26.0", "authorization": "APIKEY xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } }