flobz / psa_car_controller

Control psa car with connected_car v4 API.
GNU General Public License v3.0
383 stars 194 forks source link

Grouping of Charging Sessions in the List #864

Open MichaelRitzert opened 2 months ago

MichaelRitzert commented 2 months ago

I'm using "solar optimized charging", where the PV system pauses charging when the generation of solar energy is too low to provide the minimum current to my car. This leads to one charging session being shown as many in the overview: image (showing start/stop time pairs)

Would it be possible to add an option to group these charging sessions for the purpose of displaying? I could imagine:

MichaelRitzert commented 2 months ago

I played a bit with the database. This could be a starting point:

SELECT MIN(start_at) AS start_at, MAX(stop_at) AS stop_at, VIN, MIN(start_level) AS start_level, MAX(end_level) AS end_level, SUM(co2) AS co2, SUM(kw) AS kw, SUM(price) AS price, charging_mode, mileage FROM battery GROUP BY VIN, mileage;