Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force_refresh_all_vehicles_states() - doesn't return odometer values #290

Open
eili77 opened this issue Mar 6, 2023 · 8 comments
Open

Comments

@eili77
Copy link

eili77 commented Mar 6, 2023

  • Hyundai / Kia Connect version: latest
  • Python version: 3.11
  • Operating System: Windows & Unix

Description

Using force_refresh_all_vehicles_states(self) method doesn't return odometer values (all "none").

Vehicle(id='xxx', name='KONA', model='KONA', registration_date='2021-10-20 17:59:26.158', year=None, VIN='xxx', key=None, enabled=True, _total_driving_range=369.0, _total_driving_range_value=369.0, _total_driving_range_unit='km', _odometer=None, _odometer_value=None, _odometer_unit=None, _geocode_address=None, _geocode_name=None, car_battery_percentage=80, engine_is_running=False, last_updated_at=datetime.datetime(2023, 3, 6, 9, 2, 12, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), timezone=None, dtc_count=None, dtc_descriptions=None, smart_key_battery_warning_is_on=False,...

Using update_all_vehicles_with_cached_state(self) works fine and returns odometer values.

Vehicle(id='xxx', name='KONA', model='KONA', registration_date='2021-10-20 17:59:26.158', year=None, VIN='xxx', key=None, enabled=True, _total_driving_range=394.0, _total_driving_range_value=394.0, _total_driving_range_unit='km', _odometer=22471.5, _odometer_value=22471.5, _odometer_unit='km', _geocode_address=None, _geocode_name=None, car_battery_percentage=85, engine_is_running=False, last_updated_at=datetime.datetime(2023, 3, 4, 16, 14, 21, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), timezone=None, dtc_count=None, dtc_descriptions=None, smart_key_battery_warning_is_on=False,...

It's a repeatable issue.
Is this a wanted/known behaviour?

@cdnninja
Copy link
Collaborator

cdnninja commented Mar 6, 2023

Which region and brand?

@eili77
Copy link
Author

eili77 commented Mar 6, 2023

Europe, Hyundai

@ZuinigeRijder
Copy link
Collaborator

ZuinigeRijder commented Mar 7, 2023

I can confirm that force_refresh_all_vehicles_states() will NOT fill odometer. I digged into the differences of the responses:

DEBUG:hyundai_kia_connect_api.KiaUvoApiEU:hyundai_kia_connect_api - get_cached_vehicle_status response: {
    "retCode": "S",
    "resCode": "0000",
    "resMsg": {
        "vehicleStatusInfo": {
            "vehicleLocation": {
                "coord": {"lat": 12.3456, "lon": 5.123456, "alt": 0, "type": 0},
                "head": 330,
                "speed": {"value": 0, "unit": 0},
                "accuracy": {"hdop": 0, "pdop": 0},
                "time": "20230306201120",
            },
            "vehicleStatus": {
                "airCtrlOn": False,
                "engine": False,
                "doorLock": True,
....
                "systemCutOffAlert": 0,
                "tailLampStatus": 0,
                "hazardStatus": 0,
            },
            "odometer": {"value": 23864.9, "unit": 1},
        }
    },

and

DEBUG:hyundai_kia_connect_api.KiaUvoApiEU:hyundai_kia_connect_api - Received forced vehicle data: {
    "retCode": "S",
    "resCode": "0000",
    "resMsg": {
        "airCtrlOn": False,
        "engine": False,
        "doorLock": True,
....
        "systemCutOffAlert": 0,
        "tailLampStatus": 0,
        "hazardStatus": 0,
    },

It appears that in Received forced vehicle data the following information is NOT returned:

  • vehicleLocation
  • odometer
  • rest of the information appears to be in both responses

In the source code of KiaUvoApiEU.py the location is separately called, when force_refresh_all_vehicles_states() is called, to circumvent the absense of location (but nothing done for odometer).

DEBUG:hyundai_kia_connect_api.KiaUvoApiEU:hyundai_kia_connect_api - _get_location response: {'...

I do not know if this odometer was never returned in Received forced vehicle data. The workaround for the library user would be to call force_refresh_all_vehicles_states() first en then update_all_vehicles_with_cached_state(). Or KiaUvoApiEU.py should do this internally?

@ZuinigeRijder
Copy link
Collaborator

Because I tested with force_refresh_all_vehicles_states(), you can see well in the below Battery Monitor screenshot how much impact a force refresh has on your 12 volt battery. At 8:07 I did the refresh. Your battery will be definitely drain if you use the refresh often. Especially when the SOC of your car is below 20%, because then the battery saver function will not kick in to top up your 12 volt battery, at least with the IONIQ 5. That is why my tool, hyundai_kia_connect_monitor does no longer do a force refresh anymore.

Screenshot_20230307-102514

@eili77
Copy link
Author

eili77 commented Mar 7, 2023

Because I tested with force_refresh_all_vehicles_states(), you can see well in the below Battery Monitor screenshot how much impact a force refresh has on your 12 volt battery. At 8:07 I did the refresh. Your battery will be definitely drain if you use the refresh often. Especially when the SOC of your car is below 20%, because then the battery saver function will not kick in to top up your 12 volt battery, at least with the IONIQ 5. That is why my tool, hyundai_kia_connect_monitor does no longer do a force refresh anymore.

Screenshot_20230307-102514

Thanks for sharing these insights - understood :-)

Nevertheless, I think there's no obvious reason to omit the odometer information in this (force-) function, since all the other datapoints as far as I checked do exist... - or am I wrong ?

@ZuinigeRijder
Copy link
Collaborator

ZuinigeRijder commented Mar 7, 2023

@eili77 Yep, unfortunately the bluelink API does not return the odometer (and locations) values in the vehicles/[id]/status call, while it does in vehicles/[id]/status/latest
So then the library or the user has to work around it, e.g. by calling both after each other. Or do you see another solution?

@eili77
Copy link
Author

eili77 commented Mar 9, 2023

Or do you see another solution?

Nope, unfortunately I don't. Thanks!

@cdnninja
Copy link
Collaborator

cdnninja commented Mar 9, 2023

I thought I had this one fixed awhile back by not putting the value into vehicle unless provided. This only works if you call cache regularly and occasionally call force.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants