tobiasehlert / teslamateapi

TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON
MIT License
89 stars 20 forks source link

Error "no info on this car ID" after updating eclipse-mosquitto:2 #275

Closed bscx closed 5 months ago

bscx commented 5 months ago

After having updated eclipse-mosquitto:2, a GET /api/v1/cars/1/status would return:

{
    "error": "no info on this car ID"
}

However, GET /api/v1/cars/1would just work fine (same for /drivesand /charges for example).

After attaching to the teslamate-teslamateapi-1 container, I was able to observe the following. Please note, that in the first output there's this line mqtt connected which is missing in the second.

/opt/app $ ./app
2024/03/16 21:55:42.456857 [info] TeslaMateApi running in release mode.
2024/03/16 21:55:42.470989 [info] initAuthToken - environment variable API_TOKEN is set and good.
2024/03/16 21:55:42.471252 [error] getAllowList error with COMMANDS_ALLOWLIST: allow_list.json not found and will be ignored
2024/03/16 21:55:42.471611 [info] mqtt connecting...
2024/03/16 21:55:42.475950 [info] mqtt connected...
2024/03/16 21:55:42.477078 [error] TeslaMateAPI server closed unexpectedly

/opt/app $ ./app
2024/03/16 21:55:44.756638 [info] TeslaMateApi running in release mode.
2024/03/16 21:55:44.776147 [info] initAuthToken - environment variable API_TOKEN is set and good.
2024/03/16 21:55:44.776318 [error] getAllowList error with COMMANDS_ALLOWLIST: allow_list.json not found and will be ignored
2024/03/16 21:55:44.776472 [info] mqtt connecting...
2024/03/16 21:55:44.780954 [error] TeslaMateAPI server closed unexpectedly

and

/opt/app $ ping mosquitto
PING mosquitto (172.19.0.2): 56 data bytes
ping: permission denied (are you root?)

My mosquitto configuration has not changed:

  mosquitto:
    image: eclipse-mosquitto:2
    restart: always
    command: mosquitto -c /mosquitto-no-auth.conf
    ports:
      - 1883:1883
    volumes:
      - mosquitto-conf:/mosquitto/config
      - mosquitto-data:/mosquitto/data

I'm quite sure it worked before the mosquitto update but I can't put the finger on if it's now mosquitto, teslamateapi or simply my setup. I'm happy to support with more information if needed.

bscx commented 5 months ago

After waking up my vehicle the error no info on this car ID wouldn't show up any more. However, the data in /statusis incomplete. For example:

    "car_geodata": {
        "geofence": "",
        "latitude": 0,
        "longitude": 0
    },

At the same time, I'm seeing this:

2024-03-16 21:14:20.050 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/xxx/vehicle_data -> 408 (9125.258 ms)
2024-03-16 21:14:20.051 [warning] TeslaApi.Error / %{"error" => "{\"error\": \"timeout\"}", "error_description" => "", "response" => nil}
2024-03-16 21:14:20.052 car_id=1 [error] Error / :unknown

So, the problem is neither with mosquitto, with teslamateapi nor with my setup but with the Tesla API at this point, right?

tobiasehlert commented 5 months ago

hi @bscx, it takes some time for the data to arrive in the MQTT broker. TeslaMate talks to Tesla API and they send information to TeslaMate who feeds information into the MQTT, from where TeslaMateApi collects the information from. So there is a delay which also happens when you upgrade your TeslaMate-setup. I usually upgrade/restart when it's parked, so I don't lose "logged data", but it should not take more than 30-60 seconds usually.