fix: not vehicles

This commit is contained in:
Florian Bezannier
2026-06-12 14:33:07 +02:00
parent 5945ccedb9
commit 852d5030ab
3 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -1,10 +1,10 @@
ARG PYTHON_DEP='python3 python3-wheel python3-typing-extensions python3-pandas python3-six python3-dateutil python3-brotli python3-pycryptodome libatlas3-base python3-cryptography python3-scipy androguard python3-flask python3-paho-mqtt python3-ruamel.yaml ca-certificates python3-numpy'
ARG DEBIAN_FRONTEND=noninteractive
FROM debian:bookworm-slim AS builder
ARG PSACC_VERSION="0.0.0"
ARG PYTHON_DEP
RUN BUILD_DEP='python3-pip python3-setuptools python3-dev libblas-dev liblapack-dev gfortran libffi-dev libxml2-dev libxslt1-dev make automake gcc g++ subversion ninja-build' ; \
apt-get update && apt-get install -y --no-install-recommends $BUILD_DEP $PYTHON_DEP;
ARG PSACC_VERSION="0.0.0"
RUN pip3 install --break-system-packages --upgrade pip wheel setuptools
COPY ./dist/psa_car_controller-${PSACC_VERSION}-py3-none-any.whl .
RUN pip3 install --break-system-packages --no-cache-dir psa_car_controller-${PSACC_VERSION}-py3-none-any.whl
+2
View File
@@ -190,6 +190,8 @@ def settings_section(section: str):
@app.route('/vehicles/trips')
def get_trips():
try:
if not APP.myp.vehicles_list:
return jsonify({})
car = APP.myp.vehicles_list[0]
trips_by_vin = Trips.get_trips(Cars([car]))
trips = trips_by_vin[car.vin]
+5 -3
View File
@@ -110,7 +110,8 @@ def create_callback(): # noqa: MC0001
conn = Database.get_db()
charge = Charge(datetime.utcfromtimestamp(changed_line['start_at'] / 1000))
charge.price = changed_line['current_value']
charge.vin = get_default_car().vin
if APP.myp.vehicles_list:
charge.vin = get_default_car().vin
if not Database.set_chargings_price(conn, charge):
logger.error("Can't find line to update in the database")
else:
@@ -128,7 +129,8 @@ def create_callback(): # noqa: MC0001
is_open = False
if active_cell is not None and active_cell["column_id"] in ["start_level", "end_level"] and not is_open:
row = data[active_cell["row"]]
return figures.get_battery_curve_fig(row, APP.myp.vehicles_list[0]), True
if APP.myp.vehicles_list:
return figures.get_battery_curve_fig(row, APP.myp.vehicles_list[0]), True
return "", False
@dash_app.callback([Output("tab_trips_popup_graph", "children"), Output("tab_trips_popup", "is_open"), ],
@@ -193,7 +195,7 @@ def update_trips():
Database.add_altitude_to_db(conn)
min_date = None
max_date = None
if APP.is_good:
if APP.is_good and APP.myp.vehicles_list:
car = get_default_car() # todo handle multiple car
try:
trips_by_vin = Trips.get_trips(Cars([car]))