Replies: 26 comments 48 replies
-
|
The idle time in Europe looks for me correct, the unit in minutes seems plausible. You really have to check if the units returned in HyundaiBlueLinkAPIUSA.py are minutes or seconds. Note that the idle time is (probably) measured till the car is totally shut off. I will have a double check too, if the idle time unit in Europe are possibly in seconds. The trip time and idle time in column P and U are just helper columns for the diagrams, and the minutes are easier to show in a diagram. |
Beta Was this translation helpful? Give feedback.
-
|
For Europe it is definitely in minutes, I checked today. That means it has to be solved in HyundaiBlueLinkAPIUSA.py. Already stored trips in monitor.tripinfo.csv you have to convert manually from seconds to minutes. See attached a patch. |
Beta Was this translation helpful? Give feedback.
-
|
@gyveri My bad programming, subtracting without converting to minutes of all parts is not a good idea ;-) That is why it is so important someone (as you) can test it. Thanks for testing again. New attempt..... |
Beta Was this translation helpful? Give feedback.
-
|
@gyveri I created a pull request for the conversion of seconds to minutes. Your remarks about the difference between hyundai-kia-connect-monitor spreadsheets and monitor.dailystats spreadsheet is by design. hyundai-kia-connect-monitor spreadsheet is based on the build up of history of snapshots over time. See FAQ.
monitor.dailystats spreadsheet is based on history from the server, so less chance that trips are missing (for Europe practically not possible, for Hyundai USA when more than 4 trips have been done before asking for them). Note that in the monitor.dailystats spreadsheet some matching is tried with summary.py output between round brackets "()", not the other way around. |
Beta Was this translation helpful? Give feedback.
-
|
First there was no daily stats and trip info in the hyundai_kia_connect_api. I started with gathering snapshots with monitor.py and do computation with the snapshots in summary.py. One part of the summary was to also find detected trips. Later on I sniffed the Bluelink App and implemented/contributed the daily stats and trip info in hyundai_kia_connect_api, so I could use it in hyundai_kia_connect_monitor in dailystats.py. So these are different tools and both have value. There is another tool to generate kml from the monitor.csv file, to show addresses in Google Maps. If you want to know your daily stats/trip stats, you should look at dailystats spreadsheet. If you want summaries of the snapshots you look at the hyundai_kia_monitor spreadsheet. Also daily stats and trip info was first only available in Europe and still is not available in all regions. The information in summary.py is just based on monitor.csv data and process it. Intermixing this with dailystats/trip info is also difficult, because the odometer and other information is not available there, so what would you display in the spreadsheet? There is a difference in the access-limit between regions, e.g. I run monitor.py 3 times an hour between 6.00 and 22:00 in Europe without a problem. I think the access limit is not the number of logins, maybe it is the number of refresh of the token? But of course you could try to determine this yourself by adapting monitor.py to keep asking for values in a loop with a sleep. Previously I exited the while loop when I did get a snapshot. Now I only ask once for the VehicleManager (and the associated login) and do the rest in a loop. You can change the sleep period yourself in the above fragment: Note that I did not test the above, but I am sure you will do? |
Beta Was this translation helpful? Give feedback.
-
|
Yes, this is correct. But make sure that summary.py and dailystats.py is run between the 15 minutes sleep. Or just do not run them for the test, to see how many times you can ask for the snapshots. |
Beta Was this translation helpful? Give feedback.
-
|
monitor.csv will not be written if the snapshot entry is the same as last entry. So only if you have driven, it will update monitor.csv. |
Beta Was this translation helpful? Give feedback.
-
|
The 3 minutes apart, I see this also, when a trip is ended only a few minutes later the SOC% change is send. You can see this also by the fact that SOC% is changed or the EV range is changed. I think that the session has been invalidated and that causes the Unexpected line errors (SOC%, charging, plugged is None). Or there is the limit already reached, because there are 21 entries before it goes wrong? Probably it is the last problem, limit reached. So than there is nothing I can do about that. |
Beta Was this translation helpful? Give feedback.
-
|
Hmm, interesting. So it looks the number of logins is limited not the rest of the calls. But it also was going wrong earlier, so I think there is a problem in hyundai_kia_connect_api that not always the Token is refreshed when it is expired? |
Beta Was this translation helpful? Give feedback.
-
|
Yes, it retries 9 times, if it still does give None in the output it stops. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, this was a quick hack by adapting method handle_vehicles() in monitor.py, default there are only 3 retries. Problem with continuously running monitor.py is also that you do not know when to run summary.py and dailystats.py and they might interfere each other. And the situation that you encountered, that there seems to be a state that None values keep returning..... |
Beta Was this translation helpful? Give feedback.
-
|
Attached is the output of Thonny from earlier today after an overnight run. It looks like the modified script ends its sleep period at 0, 15, 30 and 45 minutes past each hour and continued to do so even after an exception occurred. |
Beta Was this translation helpful? Give feedback.
-
|
summary.py and dailystats.py only use the .csv generated by monitor.py, so in principle they can run via crontab when you know the times when monitor.py should be ended, or even look at monitor.lastrun, so you are sure it has ended. Actually, summary.py and dailystats.py should not need to run when no new entries are written by monitor.py. So another solution would be to spawn a shell script to run summary.py and dailystats.py. So you do not need crontab for that then. I will have a look at your changes and do some experimentation. However, I am a little bit scared that the problem with the None values is something more difficult to solve, because this is probably somethin in hyundai_kia_connect_api not taking care of correct refresh? Also a crash of monitor.py should be resulting in a restart of monitor.py. So a lot of tailoring probably, but worth to investigate further. |
Beta Was this translation helpful? Give feedback.
-
|
I am thinking about the following changes to monitor.py:
But that is going to take some time and of course I am going to test this myself. |
Beta Was this translation helpful? Give feedback.
-
|
I have now a version running from yesterday 22:00, still running today at 12:30.
Unfortunately, I reach the limit of API calls, so at least for Europe the limit is NOT the number of logins: So for me about 168 API sequences can be made, before I reach the limit. So I could run it every 10 minutes 24 hours, but safer is to use every 15 minutes, so you can still use the Bluelink App now and then. |
Beta Was this translation helpful? Give feedback.
-
|
There is no logout possible in HyundaiBlueLink api. You can do a new login or exit the monitor.py and start again. |
Beta Was this translation helpful? Give feedback.
-
|
@gyveri I made a new release R4.0.0: Major update: introduction of running monitor.py infinitely. Hope this works as expected for you, it is running for some time for me in region Europe. |
Beta Was this translation helpful? Give feedback.
-
|
@gyveri Thanks for testing. I made a fix for the problem that summary.py and dailystats.py were not called: R4.0.1.
For monitor.cfg, I have prefixed python with /usr/bin, so my configuration: |
Beta Was this translation helpful? Give feedback.
-
|
@gyveri I have a bonus for you, calculating distance with use of odometer, if available. The delta is on top of version 3.23.8. I could only do limited testing, sure you will test better ;-) |
Beta Was this translation helpful? Give feedback.
-
|
The first error is a strange one, because this is a compile error. It could not find ~/hyundai_kia_connect_monitor/hyundai_kia_connect_api/utils.py You see also that this was a crash: But you have started the script again exactly at 9:00, so then it compiles OK and does not have a problem????? Was this the first time you did run the scripts on this machine? I looked at the source code if HyundaiBlueLinkAPIUSA.py and at line 499 the float is converted to int. So that is the cause why the digits do not show up. Note that I changed in Vehicle.py distance from int to float, so still I could have missed some places, although I think monitor.py is already prepared for distance: float. See below the next fix. |
Beta Was this translation helpful? Give feedback.
-
|
Yes, fingers crossed. |
Beta Was this translation helpful? Give feedback.
-
For me it is working. There was a problem in R4.0.0 that indeed the commands were not run. This has been fixed already in R4.0.1. Also the run-once was no longer working. That has been fixed R4.0.2. For both only monitor.py has been updated. Did you not use R4.0.1 or R4.0.2????
When the odometer and/or distance is 0, in most cases it will not show those .0 in the output. monitor.csv shows only odometer. But it is NOT the odometer from the dailystats, it is the odometer from other calls to the Bluelink server. If I check the debug.py output of the log-files you did send me, I see that there the odometer is NOT in one-tenth, e.g.: Trip in formation of summary.py is computed from the odometer values in monitor.csv. For example 5778.0 - 5768.0 is exactly 9.0. Only dailystats.py is using the new overruling mechanism for distance and also only for HyundaiBlueLinkAPIUSA.py. You are lucky there, because the odometer value IS in one-tenth miles, so I could make this workaround of distance. So in monitor.dailystats.csv you should see the delta's in one-tenth miles. Thinking about this, there could be also a workaround for the regular odometer to have this in one-tenths. When getting the dailystats information, overwrite the odometer value if this is greater than the Vehicle._odometer value. I am not sure if the odometer is rounded off or truncated, otherwise the odometer needs always to be overruled with the last trip instead of only of greater than. I am sure you will test this extra feature workaround. |
Beta Was this translation helpful? Give feedback.
-
|
Took a couple of longish trips. The hyundai-kia-connect-monitor spreadsheet, monitor.csv and summary.log are all updated with the new info. The dailystats spreadsheet and monitor.dailystats.csv are not (the latest info they have is for 1018, the day on which I previously drove the car. crontab_run_monitor_infinite.log looks normal, but there's a lot going on in run_monitor_infinite.log (copy attached) |
Beta Was this translation helpful? Give feedback.
-
|
I do not think rebooting the script made to cause things to work normally, because debug.py did also NOT show the data. Probably the checking the data/refresh of the Bluelink App caused that the car values were retrieved by the server? I have an example spreadsheet with those graphs. Of course you can add/change graphs with Google Spreadsheet yourself too. Here is the example spreadsheet with the graphs, as described in the README. Remove your old monitor.dailystats spreadsheet. Make a copy (File-> Copy) of that example spreadsheet with the name monitor.dailystats AND share it with the client_email. Then those graphs should appear after new data has been added. You can also run dailystats.py manually once to populate your data. |
Beta Was this translation helpful? Give feedback.
-
|
Probably you want to do these steps when there is good reception, so not in the garage, till one of them works.
The following is how it works in Europe in the Bluelink App, maybe this is somewhat different in USA: And as last resort, you can detach the minus pool of the 12 volt battery for a minute: |
Beta Was this translation helpful? Give feedback.
-
|
Good to hear that it is working again. Probably this was just a problem with the Bluelink server software from Hyundai, which they fixed. The question is now: are the changes of me to the hyundai_kia_connect_api for better accuracy of miles working well enough? If yes, I can make a Pull Request for that, so other USA Bluelink users can also benefit from that. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
It's great to see trip info now being shown on the monitor.dailystats spreadsheet. Thank you for adding this information to the spreadsheet.
However, units shown on the idle time column G are minutes. One of my trips today showed an idle time of 146 minutes, (over 2 hours), way longer than this 8-mile (13km) took overall. Do the numbers in this column actually represent seconds? Same question with regard to the trip times shown in col P and the idle time shown in col. U.
As well as correcting the units, it would be nice if the trip time and idle time could be shown in hours, minutes, and seconds so they would be easier to comprehend.
Beta Was this translation helpful? Give feedback.
All reactions