wubbl0rz / FiatChamp

FIAT (uconnect) Home Assistant Addon 🚗
https://github.com/wubbl0rz/FiatChamp
MIT License
91 stars 17 forks source link

Problem Trying to Connect to Jeep #37

Closed maxvitek closed 1 year ago

maxvitek commented 1 year ago

I see this in the logs:

[04:06:34 WRN] Error connecting to the FIAT API. 
This can happen from time to time. Retrying in 15 minutes.
[04:06:34 INF] ERROR: Response could not be deserialized to JSON: GET https://channels.sdpr-02.fcagcv.com/v4/accounts/<some_blob>/vehicles?stage=ALL
[04:06:34 INF] STATUS: 200
[04:06:34 INF] RESPONSE: { // valid json from here

Those messages are from this code, clearly. What I notice is that the structure of the json printed here is:

{
    "userid": "<some_blob>",
    "version": 1673484085289,
    "vehicles": [
# the elements in this list seem to have the correct schema, based on a quick reading of the parsing code...

Is this line expecting the json to be an array at the top level? This is an object with a vehicles member. Is anyone else seeing this problem?

Also are there any instructions how to build & test this project locally?

wubbl0rz commented 1 year ago

you can "dotnet run" in the project folder if you have set all the environment variables that home assistant normally sets. its a bit cumbersome but thats how i test it locally without building containers every time.

yes it should be a vehicle array (https://github.com/wubbl0rz/FiatChamp/blob/master/FiatChampAddon/FiatClient/FiatClient.cs#L566) the errors comes from this request https://github.com/wubbl0rz/FiatChamp/blob/master/FiatChampAddon/FiatClient/FiatClient.cs#L578

we had some issues in the past where jeep uses characters or strings where fiat uses just numbers. maybe TcuType ?

public class Vehicle
{
  public string RegStatus { get; set; }
  public string Color { get; set; }
  public long Year { get; set; }
  public string TsoBodyCode { get; set; }
  public bool NavEnabledHu { get; set; }
  public string Language { get; set; }
  public string CustomerRegStatus { get; set; }
  public string Radio { get; set; }
  public string ActivationSource { get; set; }
  public string? Nickname { get; set; }
  public string Vin { get; set; }
  public string Company { get; set; }
  public string Model { get; set; }
  public string ModelDescription { get; set; }
  public long TcuType { get; set; }
  public string Make { get; set; }
  public string BrandCode { get; set; }
  public string SoldRegion { get; set; }
  [JsonIgnore] public JObject Details { get; set; }
  [JsonIgnore] public VehicleLocation Location { get; set; }
}
maxvitek commented 1 year ago

Yes, that must be at least part of the problem. Jeep gives "tcuType": "2"

maxvitek commented 1 year ago

You know what, I have a custom install of HASS and I used version 3.04. This problem does not present when I run with tag 3.08.

wubbl0rz commented 1 year ago

i see :smile:

looks like this has fixed it:

# 3.0.5 - 2022-12-03
- fix jeep when car model is not an int.