From bfa58580142f7b0cc9c793a17eb1e8d00c8ddb7d Mon Sep 17 00:00:00 2001 From: Florian Bezannier Date: Mon, 8 Jan 2024 07:58:16 +0100 Subject: [PATCH] feat: get battery SOH from API --- README.md | 2 +- docs/{psa_api.md => psacc_api.md} | 6 +++++- psa_car_controller/web/view/api.py | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) rename docs/{psa_api.md => psacc_api.md} (91%) diff --git a/README.md b/README.md index 85357454..cb8f3571 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The official API is documented [here](https://developer.groupe-psa.io/webapi/b2c - [Installation on Raspberry Pi with docker-compose (external Tutorial)](https://return2.net/opel-peugeot-electric-vehicle-set-charging-threshold-limit/) ## II. Use the API -Look at [API documentation](./docs/psa_api.md) +Look at [API documentation](./docs/psacc_api) ## III. Use the dashboard diff --git a/docs/psa_api.md b/docs/psacc_api.md similarity index 91% rename from docs/psa_api.md rename to docs/psacc_api.md index f1fa7502..ae0320f7 100644 --- a/docs/psa_api.md +++ b/docs/psacc_api.md @@ -55,4 +55,8 @@ http://localhost:5000/settings/electricity_config?night_price=0.2 - http://127.0.0.1:5000/settings/general?currency=%C2%A3 + http://localhost:5000/settings/general?currency=%C2%A3 + +15. Get battery SOH + + http://localhost:5000/battery/soh/ \ No newline at end of file diff --git a/psa_car_controller/web/view/api.py b/psa_car_controller/web/view/api.py index 6393b413..4bd123c0 100644 --- a/psa_car_controller/web/view/api.py +++ b/psa_car_controller/web/view/api.py @@ -182,3 +182,8 @@ def settings_section(section: str): def settings(): return json_response(APP.config.json()) + +@app.route('/battery/soh/') +def db(vin: str): + soh = Database.get_last_soh_by_vin(vin) + return jsonify({"soh": soh})