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
398 stars 84 forks source link

Activation of the Integration #743

Closed AndyAdm closed 8 months ago

AndyAdm commented 8 months ago

HI i try to activate the extenstion for my Ioniq 5 in the home assistant. But the configuration cannot finish: grafik

After enabling the debug output, i can see: the connection to hundai is established and the right data of my car are loaded. But in the Last step is the result False.

Can somebody help me ? Greetings Andy

2023-11-11 21:46:42.103 DEBUG (SyncWorker_3) [hyundai_kia_connect_api.KiaUvoApiEU] hyundai_kia_connect_api - get_cached_vehicle_status response: {'retCode': 'S', 'resCode': '0000', 'resMsg': {'vehicleStatusInfo': {'vehicleLocation': {'coord': {'lat': 50.906678, 'lon': 6.179678, 'alt': 0, 'type': 0}, 'head': 39, 'speed': {'value': 0, 'unit': 0}, 'accuracy': {'hdop': 0, 'pdop': 0}, 'time': '20231111152712'}, 'vehicleStatus': {'airCtrlOn': False, 'engine': False, 'doorLock': True, 'doorOpen': {'frontLeft': 0, 'frontRight': 0, 'backLeft': 0, 'backRight': 0}, 'trunkOpen': False, 'airTemp': {'value': '02H', 'unit': 0, 'hvacTempType': 1}, 'defrost': False, 'acc': False, 'evStatus': {'batteryCharge': False, 'batteryStatus': 53, 'batteryPlugin': 0, 'remainTime2': {'etc1': {'value': 44, 'unit': 1}, 'etc2': {'value': 910, 'unit': 1}, 'etc3': {'value': 215, 'unit': 1}, 'atc': {'value': 215, 'unit': 1}}, 'drvDistance': [{'rangeByFuel': {'evModeRange': {'value': 208, 'unit': 1}, 'totalAvailableRange': {'value': 208, 'unit': 1}}, 'type': 2}], 'reservChargeInfos': {'reservChargeInfo': {'reservChargeInfoDetail': {'reservInfo': {'day': [0, 1, 2, 3, 4, 5, 6], 'time': {'time': '0670', 'timeSection': 0}}, 'reservChargeSet': False, 'reservFatcSet': {'defrost': True, 'airTemp': {'value': '0FH', 'unit': 0, 'hvacTempType': 1}, 'airCtrl': 0, 'heating1': 0}}}, 'offpeakPowerInfo': {'offPeakPowerTime1': {'starttime': {'time': '1200', 'timeSection': 0}, 'endtime': {'time': '1200', 'timeSection': 0}}, 'offPeakPowerFlag': 0}, 'reserveChargeInfo2': {'reservChargeInfoDetail': {'reservInfo': {'day': [1], 'time': {'time': '1100', 'timeSection': 0}}, 'reservChargeSet': True, 'reservFatcSet': {'defrost': True, 'airTemp': {'value': '0FH', 'unit': 0, 'hvacTempType': 1}, 'airCtrl': 0, 'heating1': 0}}}, 'reservFlag': 0, 'ect': {'start': {'day': 0, 'time': {'time': '0000', 'timeSection': 0}}, 'end': {'day': 0, 'time': {'time': '0000', 'timeSection': 0}}}, 'targetSOClist': [{'targetSOClevel': 100, 'dte': {'rangeByFuel': {'evModeRange': {'value': 414, 'unit': 1}, 'totalAvailableRange': {'value': 414, 'unit': 1}}, 'type': 2}, 'plugType': 0}, {'targetSOClevel': 100, 'dte': {'rangeByFuel': {'evModeRange': {'value': 414, 'unit': 1}, 'totalAvailableRange': {'value': 414, 'unit': 1}}, 'type': 2}, 'plugType': 1}]}, 'chargePortDoorOpenStatus': 2, 'batteryPreconditioning': False, 'batterySoh': 0}, 'ign3': False, 'hoodOpen': False, 'transCond': True, 'steerWheelHeat': 0, 'sideBackWindowHeat': 0, 'tirePressureLamp': {'tirePressureLampAll': 0, 'tirePressureLampFL': 0, 'tirePressureLampFR': 0, 'tirePressureLampRL': 0, 'tirePressureLampRR': 0}, 'battery': {'batSoc': 92, 'batState': 0, 'sjbDeliveryMode': 0, 'batSignalReferenceValue': {'batWarning': 65}, 'powerAutoCutMode': 2}, 'lampWireStatus': {'stopLamp': {'leftLamp': False, 'rightLamp': False}, 'headLamp': {'headLampStatus': False, 'leftLowLamp': False, 'rightLowLamp': False, 'leftHighLamp': False, 'rightHighLamp': False, 'leftBifuncLamp': False, 'rightBifuncLamp': False}, 'turnSignalLamp': {'leftFrontLamp': False, 'rightFrontLamp': False, 'leftRearLamp': False, 'rightRearLamp': False}}, 'smartKeyBatteryWarning': False, 'washerFluidStatus': False, 'breakOilStatus': False, 'sleepModeCheck': True, 'time': '20231111152713', 'remoteWaitingTimeAlert': {'remoteControlAvailable': 1, 'remoteControlWaitingTime': 168, 'elapsedTime': '18:45:00'}, 'systemCutOffAlert': 0, 'tailLampStatus': 0, 'hazardStatus': 0}, 'odometer': {'value': 13207.8, 'unit': 1}}}, 'msgId': '625b464a-5428-4e9f-976f-1fc5e87221dd'} 2023-11-11 21:46:42.103 DEBUG (SyncWorker_3) [hyundai_kia_connect_api.KiaUvoApiEU] hyundai_kia_connect_api - last_updated_at - before 20231111152713 2023-11-11 21:46:42.103 DEBUG (SyncWorker_3) [hyundai_kia_connect_api.KiaUvoApiEU] hyundai_kia_connect_api - last_updated_at - after 2023-11-11 15:27:13+01:00 2023-11-11 21:46:42.104 DEBUG (MainThread) [custom_components.kia_uvo.coordinator] Finished fetching kia_uvo data in 1.810 seconds (success: False)

Butithought commented 8 months ago

Hello, Exact the same Problem here. v2.14.3 First Installation to HA today. No Problems with Bluelink App . Hope anyone can help

stargoose77 commented 8 months ago

Hello, same here!

Cannot connect anymore since Friday, Nov 10. Region: Europe Hyundai Gen5/NE - IONIQ5 Reinstalled and tested all Versions from v2.14.0 to .3

Tried different bluelink accounts, restored Backup before Friday, nothing helped. I didn´t make any changes. Bluelink works fine, too.

Debug Log: 2023-11-12 14:32:50.094 DEBUG (MainThread) [custom_components.kia_uvo.coordinator] Finished fetching kia_uvo data in 5.257 seconds (success: False)

Would be very pleased if someone could help us :-)

Bildschirmfoto 2023-11-12 um 20 15 42

cdnninja commented 8 months ago

@stargoose77

Was that none type error also the integration? Other reports don't have that.

stargoose77 commented 8 months ago

@cdnninja

Thanks for the hint, sorry that doesn't belong to this integration, i deleted it in my comment.

Butithought commented 8 months ago

Are there any news ? Will the Problem be solved? Or do we something wrong in the installation Process of the Integration?

Regards

fuatakgun commented 8 months ago

@stargoose77 , please share the full debug logs from kia_uvo

stargoose77 commented 8 months ago

@fuatakgun Here we go :)

Logger: custom_components.kia_uvo.coordinator Source: helpers/update_coordinator.py:290 Integration: Hyundai / Kia Connect (documentation, issues) First occurred: 22:39:09 (2 occurrences) Last logged: 22:39:16

Unexpected error fetching kia_uvo data: strptime() argument 1 must be str, not int Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/kia_uvo/coordinator.py", line 142, in _async_update_data await self.hass.async_add_executor_job( File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 79, in update_all_vehicles_with_cached_state self.update_vehicle_with_cached_state(vehicle_id) File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 84, in update_vehicle_with_cached_state self.api.update_vehicle_with_cached_state(self.token, vehicle) File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 326, in update_vehicle_with_cached_state self._update_vehicle_properties(vehicle, state) File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 642, in _update_vehicle_properties vehicle.ev_first_departure_time = self._get_time_from_string( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 318, in _get_time_from_string d = dt.datetime.strptime(value, "%I%M") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: strptime() argument 1 must be str, not int

fuatakgun commented 8 months ago

This is an error log not debug logs.

Error log tells us what happened, debug logs tell us how it happened

stargoose77 commented 8 months ago

@fuatakgun I see, i will check how to get it tomorrow and post it here.

fuatakgun commented 8 months ago

I think it is captured on readme file

stargoose77 commented 8 months ago

@fuatakgun Well, I started the debug protocol from the integration and stopped it after a few minutes, then it downloads the .log, do you mean this? Or where do I find the readme file?

 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

TypeError: strptime() argument 1 must be str, not int 2023-11-14 22:53:37.962 DEBUG (MainThread) [custom_components.kia_uvo.coordinator] Finished fetching kia_uvo data in 1.810 seconds (success: False) 2023-11-14 22:54:20.805 ERROR (MainThread) [custom_components.kia_uvo.coordinator] Unexpected error fetching kia_uvo data: strptime() argument 1 must be str, not int Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/kia_uvo/coordinator.py", line 142, in _async_update_data await self.hass.async_add_executor_job( File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 79, in update_all_vehicles_with_cached_state self.update_vehicle_with_cached_state(vehicle_id) File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 84, in update_vehicle_with_cached_state self.api.update_vehicle_with_cached_state(self.token, vehicle) File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 326, in update_vehicle_with_cached_state self._update_vehicle_properties(vehicle, state) File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 642, in _update_vehicle_properties vehicle.ev_first_departure_time = self._get_time_from_string( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/hyundai_kia_connect_api/KiaUvoApiEU.py", line 318, in _get_time_from_string d = dt.datetime.strptime(value, "%I%M") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: strptime() argument 1 must be str, not int 2023-11-14 22:54:20.811 DEBUG (MainThread) [custom_components.kia_uvo.coordinator] Finished fetching kia_uvo data in 2.460 seconds (success: False)

cdnninja commented 8 months ago

This seems to be related to departure time. In the debug for the API assuming that is enabled could you find the value in the json for "vehicleStatus.evStatus.reservChargeInfos.reservChargeInfo.reservChargeInfoDetail.reservInfo.time.time"?

stargoose77 commented 8 months ago

@cdnninja

Now I enabled debug for the API as described in the readme. Please find the whole logfile attached. I´m afraid there is no "vehicleStatus...". It fails at login i guess?

_2023-11-15 20:55:05.041 DEBUG (SyncWorker_5) [hyundai_kia_connect_api.KiaUvoApiEU] hyundai_kia_connectapi - Sign In Response: {'errId': 'ccb06e4a-11ff-4f54-9ce7-6461cce14c47', 'errCode': '4003', 'errMsg': 'Invalid values'}

home-assistant.log

cdnninja commented 8 months ago

You are maxing out your requests:

2023-11-15 20:55:50.650 ERROR (MainThread) [custom_components.kia_uvo.coordinator] Unexpected error fetching kia_uvo data: Exceeds number of requests - Exceeds Number of Requests.

What is your force refresh and refresh interval set to?

stargoose77 commented 8 months ago

@cdnninja

Force refresh: 240 min Scan intervall: 30 min

That was default settings and i didn´t changed it. But when loading the integration failed, home assistant repeatedly tries the login without stopping it.

Let me try it with my second blue link account, to see if it shows the same problem.

Question is, how long will be the cooldown for max request, bluelink app login works fine.

stargoose77 commented 8 months ago

@cdnninja

Here comes the logfile trying it with my second account, there is no exceeds of number requests.

home-assistant (2).log

cdnninja commented 8 months ago

No errors now but ha seems to think it didn't succeed. I'll have to look at the code to see what may trigger this. I do see a large time delta so could be that but doesn't seem right.

AndyAdm commented 8 months ago

Can i help with some information for resolving the problem? The situation is the same as observed by stargoose77. I updated the version to 2.16 without any changes during the initialization of the intergation Greetings Andy

cdnninja commented 8 months ago

Please go into HACS and redownload and selection version "master" let me know if that resolves it.

AndyAdm commented 8 months ago

Hi! it works !

stargoose77 commented 8 months ago

AWESOME! It's working again. Thank you so much @cdnninja !!!

stargoose77 commented 8 months ago

@AndyAdm Did you update to 2.16.1 after the working „master“ Version? I don‘t know if I should wait some next versions, because it works with master 😃

cdnninja commented 8 months ago

@AndyAdm Did you update to 2.16.1 after the working „master“ Version? I don‘t know if I should wait some next versions, because it works with master 😃

Master and 2.16.1 are virtually identical right now. So no harm in updating but no benefit either. It just contains the fix for everyone out in the wild without them having to update from master.