Releases: ZuinigeRijder/hyundai_kia_connect_monitor
first version of dailystats.py
dailystats.py
Read the monitor.dailystats.csv file and represent the totals and statistics per day in a nice formatted text to standard output.
Usage:
python dailystats.py
or
python dailystats.py vin=VIN
- INPUTFILE: monitor.dailystats.csv or monitor.dailystats.VIN.csv (latter if vin=VIN is given as parameter)
- standard output: totals and per day in a nice formatted text to standard output
Following information from hyundai_kia_connect_api from the monitor.dailystats.csv file (gathered by the car, so not computed by summary.py), with per day the following information:
- date
- distance
- distance_unit
- total_consumed Wh
- regenerated_energy Wh
- engine_consumption Wh
- climate_consumption Wh
- onboard_electronics_consumption Wh
- battery_care_consumption Wh
The dailystats.py standard output of the monitor.dailystats.csv file
output:
C:\Users\Rick\git\monitor>python dailystats.py
Totals Regen Consumption Engine Climate Electronics BatteryCare
313.6kWh 47.4kWh 5.6km/kWh 268.5kWh 12.8kWh 32.3kWh 0.0kWh
1756km 15.1% 17.9kWh/100km 86% 4.1% 10.3% 0.0%
20221225 Regen Consumption Engine Climate Electronics BatteryCare
26.8kWh 4.1kWh 5.9km/kWh 24.3kWh 0.5kWh 1.9kWh 0.0kWh
159km 15.4% 16.8kWh/100km 91% 2.0% 7.1% 0.0%
20221224 Regen Consumption Engine Climate Electronics BatteryCare
69.2kWh 3.6kWh 5.9km/kWh 64.6kWh 1.4kWh 3.2kWh 0.0kWh
407km 5.3% 17.0kWh/100km 93% 2.0% 4.7% 0.0%
20221223 Regen Consumption Engine Climate Electronics BatteryCare
23.8kWh 4.3kWh 6.5km/kWh 21.7kWh 0.3kWh 1.9kWh 0.0kWh
154km 18.1% 15.5kWh/100km 91% 1.2% 7.9% 0.0%
20221222 Regen Consumption Engine Climate Electronics BatteryCare
3.2kWh 0.7kWh 5.0km/kWh 2.4kWh 0.1kWh 0.7kWh 0.0kWh
16km 22.2% 20.1kWh/100km 75% 4.3% 20.9% 0.0%
20221221 Regen Consumption Engine Climate Electronics BatteryCare
3.6kWh 1.1kWh 4.4km/kWh 2.3kWh 0.3kWh 1.0kWh 0.0kWh
16km 29.9% 22.6kWh/100km 63% 8.7% 28.7% 0.0%
20221220 Regen Consumption Engine Climate Electronics BatteryCare
1.2kWh 0.3kWh 4.3km/kWh 0.7kWh 0.1kWh 0.4kWh 0.0kWh
5km 29.1% 23.3kWh/100km 59% 10.0% 30.9% 0.0%
20221216 Regen Consumption Engine Climate Electronics BatteryCare
4.1kWh 0.8kWh 2.9km/kWh 1.8kWh 1.1kWh 1.2kWh 0.0kWh
12km 19.9% 34.1kWh/100km 44% 25.8% 30.3% 0.0%
20221214 Regen Consumption Engine Climate Electronics BatteryCare
2.4kWh 1.0kWh 3.7km/kWh 1.3kWh 0.4kWh 0.7kWh 0.0kWh
9km 40.5% 26.9kWh/100km 56% 17.5% 26.8% 0.0%
20221213 Regen Consumption Engine Climate Electronics BatteryCare
4.9kWh 1.4kWh 4.3km/kWh 2.9kWh 0.9kWh 1.1kWh 0.0kWh
21km 28.5% 23.3kWh/100km 59% 19.3% 21.8% 0.0%
20221212 Regen Consumption Engine Climate Electronics BatteryCare
9.1kWh 1.8kWh 5.0km/kWh 6.9kWh 1.1kWh 1.0kWh 0.0kWh
45km 19.5% 20.2kWh/100km 76% 12.2% 11.3% 0.0%
20221211 Regen Consumption Engine Climate Electronics BatteryCare
1.2kWh 0.4kWh 4.0km/kWh 0.8kWh 0.1kWh 0.3kWh 0.0kWh
5km 35.7% 25.0kWh/100km 63% 9.2% 28.0% 0.0%
20221210 Regen Consumption Engine Climate Electronics BatteryCare
1.9kWh 0.7kWh 3.7km/kWh 1.2kWh 0.2kWh 0.5kWh 0.0kWh
7km 34.7% 27.3kWh/100km 63% 8.5% 28.3% 0.0%
20221209 Regen Consumption Engine Climate Electronics BatteryCare
6.9kWh 1.7kWh 4.9km/kWh 5.1kWh 0.5kWh 1.3kWh 0.0kWh
34km 25.2% 20.3kWh/100km 74% 7.6% 18.8% 0.0%
20221208 Regen Consumption Engine Climate Electronics BatteryCare
1.9kWh 0.6kWh 4.2km/kWh 1.0kWh 0.0kWh 0.9kWh 0.0kWh
8km 33.1% 24.0kWh/100km 54% 0.6% 45.8% 0.0%
20221207 Regen Consumption Engine Climate Electronics BatteryCare
1.8kWh 0.4kWh 4.4km/kWh 1.1kWh 0.1kWh 0.6kWh 0.0kWh
8km 22.0% 23.0kWh/100km 61% 8.0% 31.0% 0.0%
20221206 Regen Consumption Engine Climate Electronics BatteryCare
2.7kWh 0.9kWh 4.8km/kWh 1.7kWh 0.2kWh 0.8kWh 0.0kWh
13km 33.2% 20.7kWh/100km 62% 7.0% 30.8% 0.0%
20221205 Regen Consumption Engine Climate Electronics BatteryCare
3.2kWh 1.1kWh 4.4km/kWh 2.0kWh 0.3kWh 0.9kWh 0.0kWh
14km 34.5% 22.9kWh/100km 62% 10.3% 27.8% 0.0%
20221204 Regen Consumption Engine Climate Electronics BatteryCare
25.7kWh 2.5kWh 6.0km/kWh 23.2kWh 0.9kWh 1.5kWh 0.0kWh
154km 9.9% 16.7kWh/100km 91% 3.6% 5.8% 0.0%
20221203 Regen Consumption Engine Climate Electronics BatteryCare
7.0kWh 2.4kWh 5.5km/kWh 5.5kWh 0.6kWh 0.9kWh 0.0kWh
38km 34.1% 18.3kWh/100km 79% 8.0% 13.1% 0.0%
20221202 Regen Consumption Engine Climate Electronics BatteryCare
10.3kWh 3.4kWh 5.3km/kWh 7.8kWh 0.7kWh 1.8kWh 0.0kWh
54km 33.4% 19.0kWh/100km 76% 6.5% 17.6% 0.0%
20221201 Regen Consumption Engine Climate Electronics BatteryCare
9.5kWh 3.1kWh 6.0km/kWh 7.8kWh 0.4kWh 1.4kWh 0.0kWh
57km 32.4% 16.7kWh/100km 82% 3.7% 14.5% 0.0%
20221130 Regen Consumption Engine Climate Electronics BatteryCare
1.0kWh 0.5kWh 4.0km/kWh 0.6kWh 0.1kWh 0.3kWh 0.0kWh
4km 46.2% 25.2kWh/100km 61% 9.2% 29.8% 0.0%
20221129 Regen Consumption Engine Climate Electronics BatteryCare
3.2kWh 1.3kWh 5.6km/kWh 2.3kWh 0.2kWh 0.7kWh 0.0kWh
18km 39.5% 18.0kWh/100km 70% 7.7% 22.3% 0.0%
20221128 Regen Consumption Engine Climate Electronics BatteryCare
3.0kWh 1.1kWh 4.7km/kWh 1.9kWh 0.2kWh 0.9kWh 0.0kWh
14km 37.6% 21.4kWh/100km 63% 5.3% 31.4% 0.0%
20221127 Regen Consumption Engine Climate Electronics BatteryCare
74.0kWh 4.0kWh 5.6km/kWh 68.6kWh 1.4kWh 3.9kWh 0.0kWh
418km 5.4% 17.7kWh/100km 93% 1.9% 5.3% 0.0%
20221126 Regen Consumption Engine Climate Electronics BatteryCare
1.9kWh 0.6kWh 3.7km/kWh 1.1kWh 0.2kWh 0.6kWh 0.0kWh
7km 33.7% 26.9kWh/100km 60% 9.0% 31.4% 0.0%
20221124 Regen Consumption Engine Climate Electronics BatteryCare
2.8kWh 1.3kWh 6.5km/kWh 2.2kWh 0.1kWh 0.4kWh 0.0kWh
18km 47.9% 15.5kWh/100km 80% 4.1% 15.8% 0.0%
20221123 Regen Consumption Engine Climate Electronics BatteryCare
7.2kWh 2.1kWh 5.7km/kWh 5.6kWh 0.3kWh 1.3kWh 0.0kWh
41km 28.5% 17.6kWh/100km 77% 4.5% 18.4% 0.0%
added monitor.dailystats.csv and improvements
The hyundai_kia_connect_api also sends daily statistics of the car for Europe. Following information from hyundai_kia_connect_api is added to the monitor.dailystats.csv file (gathered by the car, so not computed by summary.py), with per day the following information:
- date
- distance
- distance_unit
- total_consumed Wh
- regenerated_energy Wh
- engine_consumption Wh
- climate_consumption Wh
- onboard_electronics_consumption Wh
- battery_care_consumption Wh
I am going to use this in a new tool, dailystats.py, which will be released in the near future. But you can already gather this information, because only the daily statistics for a period are send.
Other improvements:
- only append a line to monitor.csv if the line is different
- last update date/time is now written to file monitor.lastrun
- fix "last entry" in summary.py sheetupdate, it does now contain the whole last line in monitor.csv file.
Add language configuration to avoid language reset in Bluelink or Connect App
The Bluelink App is reset to English in Europe for users who have set another language in the Bluelink App when using hyundai_kia_connect_api. I do not know if this is also for the Kia UVO Connect App, but I assume those users will have the same problem.
To avoid the side-effect of the reset of the Hyundai Bluelink or Kia Uvo Connect App, you can change the configuration language in monitor.cfg (default is "en"). I you have a previous monitor.cfg, you have to add the language configuration manually.
Note that you should also update the hyundai_kia_connect_api to v1.50.3, because I did provide the changes for this issue: Android Bluelink App language is reset to English when using hyundai_kia_connect_api #145 in this Pull Request.
Configuration example for Dutch:
language = nl
e.g. for German:
language = de
Note: this is only implemented for Europe currently. For a list of language codes, see here.. Currently in Europe the Bluelink App shows the following languages:
- "en" English
- "de" German
- "fr" French
- "it" Italian
- "es" Spanish
- "sv" Swedish
- "nl" Dutch
- "no" Norwegian
- "cs" Czech
- "sk" Slovak
- "hu" Hungarian
- "da" Danish
- "pl" Polish
- "fi" Finnish
- "pt" Portuguese
small improvements and workaround for bug in infotainment update 221129
- Updated summary.py to avoid divide by zero, warning when timestamp is wrong and keep track and use of highest odometer value (latter is poor man's workaround for bug in infotainment update 221129 in Europe)
- Updated monitor.py to check for empty geocode names
- Updated debug.py to be compatible with later hyundai_kia_connect_api versions (API is changed for driving distance changed into driving range and charge limits AC and DC)
- Tested in combination with latest hyundai_kia_connect_api v1.47.1
Bugfix for R2.7.0
Program error fix for R2.7.0.
support multiple vehicles and some small improvements
The hyundai_kia_connect_api supports multiple vehicles under the same bluelink account.
Whenever more vehicles are coupled to the same bluelink account, the monitor.py script will not write the output to monitor.csv, but to the file monitor.VIN.csv, where VIN is the VIN number of the coupled vehicle.
You also need to provide the VIN to the appropriate scripts when multiple vehicles are coupled to your bluelink account, e.g.
- python summary.py vin=VIN
- python summary.py sheetupdate vin=VIN
- python kml.py vin=VIN
- python shrink.py vin=VIN
Note that for "python summary.py sheetupdate vin=VIN" the spreadsheet name should be "monitor.VIN" instead of "hyundai-kia-connect-monitor"", so make sure to configure the Google spreadsheet with that name.
Some other small improvements:
- clear cells in SHEETUPDATE, also W columns
- also show last TRIP of last day
Small improvements
- Small improvements to summary.py sheetupdate, clearing row 21 and removing spaces around latest info
- Default is only forceupdate after 7 days in monitor.cfg, so in practice no forceupdate will occur
- Updated README with video of BM2 Battery Monitor:
This video shows why it is important to avoid awakening the car for actual values. 30 nov 6:10 a forceupdate has been done and you see a dip from 12.92 Volt to 12.42 Volt for a moment and then back to 12.83 Volt. Note by default the tool asks only for server cache updates and the car decides when to send push notifications with actual values to the server.
Robustness and cleanup
Robustness and cleanup
- Skip entries in monitor.py with None as odometer, because I have had this twice using the hyundai_kia_connect_api v1.40.12
- Removed MOVE from summary.py, because with the cacheupdate intermediate locations are no longer reported
- Removed ADDRESS parameter from summary.py, because monitor.py has now this option and take over address when provided by monitor.py
- Removed geopy dependency (possible because of removal of ADDRESS possibility)
- Made scripts robust against None values
- Added retry to summary.py SHEETUPDATE, so when the Google service is unavailable it is retried one minute later
added address possibilities to monitor.py and fixed bug in sheetupdate
- fixed bug in sheetupdate
- added address possibilities to monitor.py
- use possible address from monitor.csv in summary.py
Note: you need to add the use_geocode and use_geocode_email configuration to monitor.cfg, if you have an existing monitor.cfg configuration.
Major new release, no more 12 volt battery drain!
- Added force_update_seconds configuration, cacheupdate and forceupdate
- Added check if parameters are not mistyped (wrong keyword as parameter)
- Added help parameter for monitor.py and summary.py
- Improved sheetupdate
- Improved README
Best of all is the fact that it does no longer drain your 12 volt battery of the car, because it default uses the cached server information!
This is tested in combination with hyundai_kia_connect_api v1.40.11, so consider to upgrade also the api package if you are using an older version.
The monitor tool will by default only do a forced update when the last car to server update is more than 8 hours ago. So only a maximum of 3 times a day the car could be asked for the latest information with the default configuration. This time difference is configurable, so you can decide to do it even less, e.g. max once a day, or more often, e.g. max 12 times a day. But you have also the option to only use cacheupdate as parameter to monitor.py. And you can also run a forceupdate as parameter to monitor.py, or e.g. once a day. Choose the options you like the most. See here some crontab examples
If you only ask for cached values, the car will not be woken up, the 12 volt battery of the car will not be drained by the tool and you will only get the cached values from the server.
The car sends the updates (push messages) to the server when something happens on the car side. This is the case when the car is started or switched off, when charging is complete and possibly in other situations. So no extra drain of the 12 volt battery because of the hyundai_kia_connect_monitor tool!
And of course when you run an update or command through the Bluelink app, but that is on purpose.
Note that if you do a lot of forceupdate calls, than definitely the car 12 volt battery can be drained. See here some results of someone with an IONIQ 5 using forceupdate, so use this forceupdate option carefully:
With 15-minute forced updates:
95% to 80% in 8 hours, approx. 1.8%/hour
With 60-minute forced updates:
93% to 82% in 14 hours, approx. 0.78%/hour
Note: do not forget to configure monitor.cfg for the configuration item force_update_seconds