Hyundai-Kia-Connect / kia_uvo

A Home Assistant HACS integration that supports Kia Connect(Uvo) and Hyundai Bluelink. The integration supports the EU, Canada and the USA.
MIT License
422 stars 85 forks source link

fix: force seats to be integers #793

Closed cdnninja closed 8 months ago

cdnninja commented 9 months ago

Can someone confirm this tests out? I no longer have a car to test this with.

chasebolt commented 9 months ago

@cdnninja I will try and test this out today. what is the best way to test it?

cdnninja commented 9 months ago

Easiest way would be to edit the file in your custom_components directory with the changes here. Restart HA after that and it will take effect.

tonygauderman commented 8 months ago

I tested, and get this:

File "/config/custom_components/kia_uvo/services.py", line 70, in async_handle_start_climate if front_left_seat is not none: ^^^^ NameError: name 'none' is not defined

I changed that to:

    if front_left_seat is not None:
        front_left_seat = int(front_left_seat)
    if front_right_seat is not None:
        front_right_seat = int(front_right_seat)
    if rear_left_seat is not None:
        rear_left_seat = int(rear_left_seat)
    if rear_right_seat is not None:
        rear_right_seat = int(rear_right_seat)

and it appears to work. I get the following in debug:

[hyundai_kia_connect_api.HyundaiBlueLinkAPIUSA] hyundai_kia_connect_api - Start engine data: {'Ims': 0, 'airCtrl': 1, 'airTemp': {'unit': 1, 'value': 80}, 'defrost': True, 'heating1': 4, 'igniOnDuration': 10, 'seatHeaterVentInfo': {'drvSeatHeatState': 8, 'astSeatHeatState': 8, 'rlSeatHeatState': 0, 'rrSeatHeatState': 0}, 'username': 'user@email.com', 'vin': 'car_vin'}

BUT - seat heaters were still not running. This was on a 2020 Hyundai Santa Fe. Also have a 2020 Hyundai Palisade I can test with. I wonder if the value of 8 isn't supported?

cdnninja commented 8 months ago

I have edited the code. Let me know if that now looks correct.

The values supported are car dependant.

tonygauderman commented 8 months ago

Yea, that looks correct. I have copied the lastest file contents out and replaced my entire file and will restart and test. For the values, I may just need to play with the numbers with a manual call. I was testing from an automation, could test from developer tools or node red to send different values and see what happens. Do you know how the integration determines what each vehicles valid values are?

cdnninja commented 8 months ago

Today we have no way to know what cars support what. We pass the value as provided.

tonygauderman commented 8 months ago

Values are provided when the integration and vehicles are added?

cdnninja commented 8 months ago

No values are static. We sniffed and understood them best we could. They could differ from car or region though.

They are shown here. The number is passed straight to the api and consumed by Kia Hyundai.

https://github.com/Hyundai-Kia-Connect/kia_uvo/blob/master/custom_components/kia_uvo/services.yaml

tonygauderman commented 8 months ago

I suspect in my case, neither of my vehicles support setting the seat settings. They don't from the official app, and I was trying to use the integration to get around that thinking it was a limitation on the app, not my vehicles.

cdnninja commented 8 months ago

If your native app doesn't have it the integration won't work for it either.