Skip to content

Wrong vehicle location reported after 1st trip of the day #87

@jstammi

Description

@jstammi

I noticed that sometimes the location stayed the same in the monitor.csv though the car was moved, the ODO changed and the log reported a forced update (as I have set the flag; running in infinite mode).

Today I noticed in the api sources (v3.49.0), that the forced update logic within check_and_force_update_vehicles only really forces a status update, if the vehicle's last update time is known, else it is read only the cached state from the server (see VehicleManager line 122 with the related else in line 133). And this is not true after having created a new VehicleManager instance. And such is done at the moment on start-up (obviously), but also each day at midnight and after each 4th consecutive iteration ending with an error (whenever login is set to True on calling handle_vehicles in monitor.py).

This leads to wrong location reporting whenever

  • the monitor is newly started and the vehicle location differs from the known one in the cache (e.g. moved since last usage)
  • the 1st moving of the car per day
    before the 2nd iteration

What is the reason for creating a new VehicleManager instance each night? Most problems related to this issue would be solved with just keeping the one once created.
Else one could use force_refresh_all_vehicles_states instead, which really always forces a state update - afais this is exactly what is wanted and expected ... ?

The only remaining potential problem would be then imho on a start with no lines existing in monitor.csv, yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions