Closed albert0815 closed 11 months ago
Hello, I think your issue is related to the car not having finished a trip (or the app not having noticed).
I had a similar error when (re)starting my server while my car was charging. In that case I had the same error in dto_to_battery_curve.
...
File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/battery_charge_curve.py", line 55, in dto_to_battery_curve
speed = car.get_charge_speed(charge.end_level - charge.start_level, (stop_at - start_date).total_seconds())
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
As an example, here's the db entry I took while charging:
2023-02-18 10:14:24+00:00||VIN|30|||||No
Here's the one took after charge stopped:
2023-02-18 10:14:24+00:00|2023-02-18 13:59:07+00:00|VIN|30|51||9.66|1.62|No
In this case, neither stop_at nor end_level were set. After I stopped charging and restarted the server, everything went fine.
... WHERE stop_at IS NULL OR end_level IS NULL
)I think the first is more straightforward to implement, but the second is more correct on a theoretical level. There could be also other approaches, but in the end one has to be chosen. I could submit a PR, but before starting to code I'd like to know @flobz's opinion, since I have not a deep knowledge of the project architecture.
I think this issue is fixed please open a new one if not.
Describe the bug I started to use the psa controller recently and until now I was not able to see the location of my car. I now updated to 3.0.8 because I was hoping that with one of the recent fixes position of the car should be available (which it was not until now). With that release I am able to receive the position with the get_vehicle request, it includes the correct possition. But still neither trips are recorded nor does the map contain the current position. I am assuming it relates to an error in the log which I post below.
To Reproduce Steps to reproduce the behavior:
Config file
Environment (please complete the following information):
Additional context It seems that for some reason start or end is not available for the calculation of the consumption. Not sure, maybe this is because no trip has been recorded before?