The sun component (which should be enabled by default) already computes the sun position for you.
Elevation and azimuth are available as standalone sensors sensor.sun_solar_azimuth (might be disabled by default) or as attributes on the sun.sun entity.
For context they seem to be specifically referencing the 12V "starter" battery not the HV battery used for the traction drive in EVs with that 44.1% figure.
Additionally this figure seems to include all vehicles in the statistic, so some part of that is contributed by ICE vehicles.