serkri / SmartEVSE-3

Smart Electric Vehicle Charging Station (EVSE)
MIT License
68 stars 28 forks source link

Settings page increase precision from 1 to 3 decimals #161

Closed evanes68 closed 1 year ago

evanes68 commented 1 year ago

I have a home automation platform that reads data from the smartevse settings page. For example the charged_kwh field provides data to see how the charge is progressing.

Currently the data has one decimal precision meaning that it takes a while before you see any data. I would prefer to see three decimal precision having a much more responsive indication of the charging process.

For example I would change line: doc["ev_meter"]["charged_kwh"] = round(EnergyCharged / 100)/10; //in kWh, precision 1 decimal To: doc["ev_meter"]["charged_kwh"] = round(EnergyCharged)/1000; //in kWh, precision 3 decimal

This can best be done for all fields that have this calculation for mains_meter and ev_meter.

dingo35 commented 1 year ago

If you want precise progress information you should watch the currents, because that gives you the actual charge at that moment. A more precise indication will only clobber up your database; feel free to adapt the code to your needs, I dont think mainstream users are interested in this.