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
438 stars 88 forks source link

Integration in Canada #46

Closed dallaby23 closed 3 years ago

dallaby23 commented 3 years ago

This integration looks awesome... Would love to help test in Canada..

fuatakgun commented 3 years ago

You know, as i don't have an access to actual car in Canada, i would blindly code and you should manually update your custom component for each iteration. It will be painfully long process to test and share feedback with me. if you commit on this, i can commit too.

fuatakgun commented 3 years ago
YeloMelo95 commented 3 years ago

I'm willing to help out with the Canada testing if you are still looking. I'm not really savvy with the backend coding (especially Python), but I can provide any log information and make specific changes to code on my end and test as required.

REGION: 2 (Canada) BRAND: 1 (Kia) Model is a 2019 Optima, if that makes any difference. Our UVO allows remote starting but no scheduled starts (available in US version, not sure about EU).

Currently I can't login due to the following:

Logger: custom_components.kia_uvo.config_flow Source: custom_components/kia_uvo/config_flow.py:164 Integration: Kia Uvo / Hyundai Bluelink (documentation) First occurred: 8:25:04 AM (2 occurrences) Last logged: 8:27:11 AM

kia_uvo Exception in kia_uvo login : 'nickname' - traceback: Traceback (most recent call last): File "/config/custom_components/kia_uvo/config_flow.py", line 150, in async_step_user self.token = await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kia_uvo/KiaUvoApiCA.py", line 77, in login vehicle_name = response["vehicles"][0]["nickname"] KeyError: 'nickname'

I assume it is having difficulty with my car's nickname, but it is just a string with no spaces or numbers/special characters (Optimus). I have tried logging out and logging in, no change there. Also reinstalled the repository and integration with reboots between each step, no change. From the myuvo.ca site it looks like the nickname is forced, so removing it is a no-go. On the latest app on my phone as well (no longer red, now blueish-grey).

Let me know if this should be a separate issue, I'm not sure if it is directly linked with the KiaUvoApiCA.py file or if it is something that might impact the EU.py file as well.

fuatakgun commented 3 years ago

nope, this is good enough, apparently there is no data returned as nickname, i will take a look and update the codebase today

fuatakgun commented 3 years ago

fixed in latest version, please trigger an update from HACS, install latest version and retest. Warning ahead, this is going to be a long journey.

YeloMelo95 commented 3 years ago

Thanks! Getting the below when attempting to login now:

Logger: custom_components.kia_uvo.config_flow Source: custom_components/kia_uvo/config_flow.py:164 Integration: Kia Uvo / Hyundai Bluelink (documentation) First occurred: 4:55:48 PM (1 occurrences) Last logged: 4:55:48 PM

kia_uvo Exception in kia_uvo login : 'enrollmentDate' - traceback: Traceback (most recent call last): File "/config/custom_components/kia_uvo/config_flow.py", line 150, in async_step_user self.token = await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kia_uvo/KiaUvoApiCA.py", line 80, in login vehicle_registration_date = response["vehicles"][0]["enrollmentDate"] KeyError: 'enrollmentDate'

fuatakgun commented 3 years ago

Please follow Troubleshooting section here (https://github.com/fuatakgun/kia_uvo) and enable excessive logging for integration and share these logs, I can see incoming data from servers.

On the other hand, I have updated the integration to unblock further testing and skip enrollmentDate at all. When you are ready to share your traffic information please check if there is any sensitive data like username/password and remove them. You can also directly email me over fuatakgun@gmail.com

Follow previous steps to update local version and retry

YeloMelo95 commented 3 years ago

Thanks!

I've updated via HACS and was finally able to get it to show in my integrations tab, but there is an error on the tab advising to check the logs. Per the logs, it looks like it does see the information provided by UVO so I am not quite sure what the error is, but no entities are generated.

For the logs, I've removed any tokens, the vehicle ID and my email, and this can be identified wherever you see ###ACCESS TOKEN### or similar edits:

2021-07-29 07:37:45 DEBUG (SyncWorker_4) [custom_components.kia_uvo.KiaUvoApiCA] kia_uvo - Sign In Response {"responseHeader":{"responseCode":0,"responseDesc":"Success"},"result":{"accessToken":"###ACCESS TOKEN###","scope":["profile"],"tokenType":"bearer","expireIn":86400,"refreshToken":"###ACCESS TOKEN###","signature":""}} 2021-07-29 07:37:45 DEBUG (SyncWorker_4) [custom_components.kia_uvo.KiaUvoApiCA] kia_uvo - Access Token Value ###ACCESS TOKEN### 2021-07-29 07:37:45 DEBUG (SyncWorker_4) [custom_components.kia_uvo.KiaUvoApiCA] kia_uvo - Refresh Token Value ###ACCESS TOKEN### 2021-07-29 07:37:47 DEBUG (SyncWorker_4) [custom_components.kia_uvo.KiaUvoApiCA] kia_uvo - Get Vehicles Response {"responseHeader":{"responseCode":0,"responseDesc":"Success"},"result":{"vehicles":[{"vehicleId":"###VEHICLE ID###","nickName":"Optimus","modelCode":"D5S6D2A1FG","modelName":"Optima","modelYear":"2019","fuelKindCode":"G","trim":"","engine":"","exteriorColor":"M5U","dtcCount":0,"subscriptionStatus":"A","subscriptionEndDate":"20240422","mileageForNextService":-43557.8,"daysForNextService":"20200427","overviewMessage":"","defaultVehicle":true,"enrollmentStatus":"4","genType":"G1","vin":"7986"}]}} 2021-07-29 07:37:47 DEBUG (MainThread) [custom_components.kia_uvo] kia_uvo - async_setup_entry started - <homeassistant.config_entries.ConfigEntry object at 0x7fa1311a90> 2021-07-29 07:37:47 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Received token into Vehicle Object {'valid_until': '2021-07-30 06:37:47.659483', 'access_token': '###ACCESS TOKEN###', 'refresh_token': '###ACCESS TOKEN###', 'device_id': None, 'vehicle_name': 'Optimus', 'vehicle_id': '###VEHICLE ID###', 'vehicle_model': 'Optimus', 'vehicle_registration_date': datetime.datetime(2021, 7, 29, 7, 37, 47, 659466), 'stamp': 'NoStamp'} 2021-07-29 07:37:47 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Refresh token started 2021-07-30 06:37:47.659483 2021-07-29 07:37:47.678245 False 2021-07-29 07:37:47 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Refresh token started 2021-07-30 06:37:47.659483 2021-07-29 07:37:47.678721 False 2021-07-29 07:37:51 DEBUG (SyncWorker_6) [custom_components.kia_uvo.KiaUvoApiCA] kia_uvo - get_cached_vehicle_status response {'responseHeader': {'responseCode': 0, 'responseDesc': 'Success'}, 'result': {'status': {'lastStatusDate': '20210729091239', 'airCtrlOn': False, 'engine': False, 'doorLock': True, 'doorOpen': {'frontLeft': 0, 'frontRight': 0, 'backLeft': 0, 'backRight': 0}, 'trunkOpen': False, 'airTempUnit': 'C', 'airTemp': {'value': '01H', 'unit': 0}, 'defrost': False, 'lowFuelLight': False, 'acc': False, 'hoodOpen': False, 'transCond': True, 'steerWheelHeat': 0, 'sideBackWindowHeat': 0, 'dte': {'unit': 1}, 'tirePressureLamp': {}, 'battery': {'batSoc': 81, 'batSignalReferenceValue': {}}, 'remoteIgnition': True, 'seatHeaterVentInfo': {}, 'sleepModeCheck': True, 'lampWireStatus': {'headLamp': {}, 'stopLamp': {}, 'turnSignalLamp': {}}, 'windowOpen': {}, 'engineRuntime': {}}}} 2021-07-29 07:37:51 ERROR (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Exception in update : 'resMsg' 2021-07-29 07:37:51 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry ### MY EMAIL ADDRESS ### for kia_uvo Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/config/custom_components/kia_uvo/init.py", line 185, in async_setup_entry await update(dt_util.utcnow()) File "/config/custom_components/kia_uvo/init.py", line 177, in update datetime.now(local_timezone) - vehicle.last_updated TypeError: can't subtract offset-naive and offset-aware datetimes 2021-07-29 07:37:52 ERROR (SyncWorker_4) [homeassistant.util.json] Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[35].data.stored_credentials.vehicle_registration_date=2021-07-29 07:37:47.659466(<class 'datetime.datetime'> 2021-07-29 07:37:52 ERROR (MainThread) [homeassistant.helpers.storage] Error writing config for core.config_entries: Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[35].data.stored_credentials.vehicle_registration_date=2021-07-29 07:37:47.659466(<class 'datetime.datetime'>

fuatakgun commented 3 years ago

this is good, enough for me to move forward, thanks

cdnninja commented 3 years ago

Is that canadian branch limited to who can see it? I am interested to help test and work on this.

cdnninja commented 3 years ago

I used the branch above. Errors look to be different with three errors:

Error writing config for core.config_entries: Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[25].data.stored_credentials.vehicle_registration_date=2021-08-01 20:39:59.900697(<class 'datetime.datetime'>

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/config/custom_components/kia_uvo/init.py", line 185, in async_setup_entry await update(dt_util.utcnow()) File "/config/custom_components/kia_uvo/init.py", line 177, in update datetime.now(local_timezone) - vehicle.last_updated TypeError: can't subtract offset-naive and offset-aware datetimes

and:

Error writing config for core.config_entries: Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[25].data.stored_credentials.vehicle_registration_date=2021-08-01 20:39:59.900697(<class 'datetime.datetime'>

cdnninja commented 3 years ago

52 resolves the middle of these three errors.

fuatakgun commented 3 years ago

thanks again for quick action, I have updated codebase with latest changes, please update your installation and let me know the progress. Your solution would work but if it was timezone issue, the actual issue is that, I was not able to read correct field from response to get the date.

cdnninja commented 3 years ago

It now connects and loads all entities without error. It is showing some items as "okay" when I know this system can't monitor it. A quick example is TPMS, canada cars from Kia don't have TPMS. I will watch the data after I drive etc to see what else may be like that. Numerous items show that aren't in app but that doesn't mean they don't work!

YeloMelo95 commented 3 years ago

Thanks! I was able to login and get all entities to appear.

There are some "unknown" states but so far the main ones appear to be reporting correctly. One thing I am noticing is that the Lock/Unlock service does not work and does not generate any messages in the log. I am able to call an update / force update with no issue though, and the door lock sensor updates correctly if I've updated via the UVO app or with my car fob.

image image

cdnninja commented 3 years ago

If it helps I pulled what came back for json on mine. Some items aren't here which means I assume the entity shouldn't show up:

2021-08-02 10:16:55 DEBUG (SyncWorker_2) [custom_components.kia_uvo.KiaUvoApiCA] kia_uvo - get_cached_vehicle_status response {'responseHeader': {'responseCode': 0, 'responseDesc': 'Success'}, 'result': {'status': {'lastStatusDate': '20210801171424', 'airCtrlOn': False, 'engine': False, 'doorLock': False, 'doorOpen': {'frontLeft': 0, 'frontRight': 0, 'backLeft': 0, 'backRight': 0}, 'trunkOpen': False, 'airTempUnit': 'C', 'airTemp': {'value': '01H', 'unit': 0}, 'defrost': False, 'lowFuelLight': False, 'acc': False, 'hoodOpen': False, 'transCond': True, 'dte': {'unit': 1}, 'tirePressureLamp': {}, 'battery': {'batSoc': 77, 'batSignalReferenceValue': {}}, 'remoteIgnition': True, 'seatHeaterVentInfo': {}, 'sleepModeCheck': True, 'lampWireStatus': {'headLamp': {}, 'stopLamp': {}, 'turnSignalLamp': {}}, 'windowOpen': {}, 'engineRuntime': {}}}}

cdnninja commented 3 years ago

Also a heads up looks like canada only allows 90 seconds between requests: 2021-08-02 10:22:24 DEBUG (SyncWorker_2) [custom_components.kia_uvo.KiaUvoApiCA] kia_uvo - Received forced vehicle data {'error': {'errorCode': '6533', 'errorDesc': 'We are currently processing an earlier inquiry for your vehicle. Please wait 90 seconds before issuing next request.'}, 'responseHeader': {'responseCode': 1, 'responseDesc': 'Failure'}}

fuatakgun commented 3 years ago

happy to see progress here. I will try to exclude UNKNOWN sensors from initialization, they were mostly inherited from EU. @YeloMelo95 , I was focused on initial setup, not interaction. Now it is time to work on them. image

fuatakgun commented 3 years ago

please share your interest here. which one to prioritize?

YeloMelo95 commented 3 years ago

Personally I'd prefer lock/unlock, I'd love remote start functionality but not sure if that is possible, atleast it wasn't with the older UVO integration by wcomartin.

Sent from my Galaxy

-------- Original message -------- From: fuatakgun @.> Date: 2021-08-02 5:43 p.m. (GMT-05:00) To: fuatakgun/kia_uvo @.> Cc: YeloMelo95 @.>, Mention @.> Subject: Re: [fuatakgun/kia_uvo] Integration in Canada (#46)

please share your interest here. which one to prioritize?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/fuatakgun/kia_uvo/issues/46#issuecomment-891354528, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATT47RJOIO4GTI2ZCABJ7WLT24GRXANCNFSM46Q7XEZA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.

cdnninja commented 3 years ago

I see you started lock unlock. Currently I get the following:

[548129562192] Expecting value: line 9 column 1 (char 8) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 811, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call await result File "/config/custom_components/kia_uvo/lock.py", line 45, in async_lock await self.vehicle.lock_action(VEHICLE_LOCK_ACTION.LOCK) File "/config/custom_components/kia_uvo/Vehicle.py", line 106, in lock_action await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/kia_uvo/KiaUvoApiCA.py", line 134, in lock_action response = response.json() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, kwargs) File "/usr/local/lib/python3.9/site-packages/simplejson/init.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 9 column 1 (char 8)

fuatakgun commented 3 years ago

What about action? Was it locked or unlocked successfully?

YeloMelo95 commented 3 years ago

I get the same error as above, car does not lock/unlock

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 856, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call await result File "/config/custom_components/kia_uvo/lock.py", line 48, in async_unlock await self.vehicle.lock_action(VEHICLE_LOCK_ACTION.UNLOCK) File "/config/custom_components/kia_uvo/Vehicle.py", line 106, in lock_action await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/kia_uvo/KiaUvoApiCA.py", line 134, in lock_action response = response.json() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, kwargs) File "/usr/local/lib/python3.9/site-packages/simplejson/init.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 9 column 1 (char 8)

fuatakgun commented 3 years ago

Ok, please share the logs with all communication, errors are good to find out problem but not enough to solve them.

cdnninja commented 3 years ago

No action. As a note the Canadian app typically takes about a minute of spinning to complete.

On Aug 3, 2021, at 12:27 AM, fuatakgun @.***> wrote:

 What about action? Was it locked or unlocked successfully?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

cdnninja commented 3 years ago

Strangely I don't see other log info as it relates to this command. I have included a larger to show that it seems to be doing debug log but nothing about start.

2021-08-03 19:52:05 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - LastUpdated 2021-08-03 19:36:30-06:00 - Timezone America/Edmonton 2021-08-03 19:52:05 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Engine type set VEHICLE_ENGINE_TYPE.IC 2021-08-03 20:21:59 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Refresh token started 2021-08-04 08:21:56.513040 2021-08-03 20:21:59.065386 False 2021-08-03 20:21:59 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Refresh token started 2021-08-04 08:21:56.513040 2021-08-03 20:21:59.066293 False 2021-08-03 20:22:01 DEBUG (SyncWorker_3) [custom_components.kia_uvo.KiaUvoApiCA] kia_uvo - get_cached_vehicle_status response {'responseHeader': {'responseCode': 0, 'responseDesc': 'Success'}, 'result': {'status': {'lastStatusDate': '20210804021947', 'airCtrlOn': False, 'engine': False, 'doorLock': False, 'doorOpen': {'frontLeft': 0, 'frontRight': 0, 'backLeft': 0, 'backRight': 0}, 'trunkOpen': False, 'airTempUnit': 'C', 'airTemp': {'value': '01H', 'unit': 0}, 'defrost': False, 'lowFuelLight': False, 'acc': False, 'hoodOpen': False, 'transCond': True, 'dte': {'unit': 1}, 'tirePressureLamp': {}, 'battery': {'batSoc': 77, 'batSignalReferenceValue': {}}, 'remoteIgnition': True, 'seatHeaterVentInfo': {}, 'sleepModeCheck': True, 'lampWireStatus': {'headLamp': {}, 'stopLamp': {}, 'turnSignalLamp': {}}, 'windowOpen': {}, 'engineRuntime': {}}}} 2021-08-03 20:22:01 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - LastUpdated 2021-08-04 02:19:47-06:00 - Timezone America/Edmonton 2021-08-03 20:22:01 DEBUG (MainThread) [custom_components.kia_uvo.Vehicle] kia_uvo - Engine type set VEHICLE_ENGINE_TYPE.IC 2021-08-03 20:49:55 WARNING (MainThread) [homeassistant.components.media_player] Error retrieving proxied image from http://192.168.10.46:1400/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a0TD0ydYJuFPEaqshquDEpw%3fsid%3d12%26flags%3d8224%26sn%3d4 2021-08-03 20:49:55 WARNING (MainThread) [homeassistant.components.media_player] Error retrieving proxied image from http://192.168.10.46:1400/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a0TD0ydYJuFPEaqshquDEpw%3fsid%3d12%26flags%3d8224%26sn%3d4 2021-08-03 20:50:54 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [548130616032] Expecting value: line 9 column 1 (char 8) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 811, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call await result File "/config/custom_components/kia_uvo/lock.py", line 45, in async_lock await self.vehicle.lock_action(VEHICLE_LOCK_ACTION.LOCK) File "/config/custom_components/kia_uvo/Vehicle.py", line 106, in lock_action await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kia_uvo/KiaUvoApiCA.py", line 134, in lock_action response = response.json() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, **kwargs) File "/usr/local/lib/python3.9/site-packages/simplejson/__init__.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 9 column 1 (char 8)

fuatakgun commented 3 years ago

Apparently response is not json, i will place additional logs to capture more information on response.

cdnninja commented 3 years ago

@fuatakgun looks like the command is just missing the PIN. This repo shows the header passing a pin as well. https://github.com/wcomartin/kiauvo/blob/4f153c3ffac41b575942eaaadcbc316743b2247f/KiaUvo/__init__.py#L173

cdnninja commented 3 years ago

I can also create a pull request for this but I suspect it may not be perfect. I am no pro!

fuatakgun commented 3 years ago

You are right, I was able to avoid getting PIN so far for EU implementation, apparently it was up to a point :-)

You can create a PR, it is more than welcome, we can improve it together

cdnninja commented 3 years ago

57 ready for review. Works but requires a re-add of the integration. If it doesn't break anything in EU I should be able to quickly do a few other pin required methods for canada.

cdnninja commented 3 years ago

Partially for documentation looks like we need to call "nxtsvc" to get some items like odometer reading. This is the json response:

{"responseHeader":{"responseCode":0,"responseDesc":"Success"},"result":{"maintenanceInfo":{"msopServiceOdometer":36057.0,"msopServiceOdometerUnit":1,"mtspServiceDate":"20210721","imatServiceOdometer":48057.0,"imatServiceOdometerUnit":1,"mtitServiceDate":"20220121","currentOdometer":37236.8,"currentOdometerUnit":1,"serviceOdometerDuration":12000.0,"serviceDaysDuration":184,"serviceMonthsThreshold":6}}}

deroymaxime commented 3 years ago

Hi, I'm living in canada and i have the same problem when i want to unlock the door How i can correct this problem?

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/kia_uvo/KiaUvoApiCA.py:134 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 19:34:58 (5 occurrences) Last logged: 20:12:09

[2915365264] Expecting value: line 9 column 1 (char 8) [2785555816] Expecting value: line 9 column 1 (char 8) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 856, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call await result File "/config/custom_components/kia_uvo/lock.py", line 48, in async_unlock await self.vehicle.lock_action(VEHICLE_LOCK_ACTION.UNLOCK) File "/config/custom_components/kia_uvo/Vehicle.py", line 106, in lock_action await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/kia_uvo/KiaUvoApiCA.py", line 134, in lock_action response = response.json() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, kwargs) File "/usr/local/lib/python3.9/site-packages/simplejson/init.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 9 column 1 (char 8)

cdnninja commented 3 years ago

This should be working in a few weeks.

On Sun, Aug 29, 2021 at 6:13 PM deroymaxime @.***> wrote:

Hi, I'm living in canada and i have the same problem when i want to unlock the door How i can correct this problem?

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/kia_uvo/KiaUvoApiCA.py:134 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 19:34:58 (5 occurrences) Last logged: 20:12:09

[2915365264] Expecting value: line 9 column 1 (char 8) [2785555816] Expecting value: line 9 column 1 (char 8) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 856, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call await result File "/config/custom_components/kia_uvo/lock.py", line 48, in async_unlock await self.vehicle.lock_action(VEHICLE_LOCK_ACTION.UNLOCK) File "/config/custom_components/kia_uvo/Vehicle.py", line 106, in lock_action await self.hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(self.args, self.kwargs) File "/config/custom_components/kia_uvo/KiaUvoApiCA.py", line 134, in lock_action response = response.json() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, kwargs) File "/usr/local/lib/python3.9/site-packages/simplejson/init*.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 9 column 1 (char 8)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fuatakgun/kia_uvo/issues/46#issuecomment-907907365, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQUAXAQTXYJ2DSTPXCH3FLT7LEMHANCNFSM46Q7XEZA .

deroymaxime commented 3 years ago

do you know how i can start the car?

yonigold1 commented 3 years ago

do you know how i can start the car?

I don't think that's a feature yet but i wonder if they will implement it.

cdnninja commented 3 years ago

It is. I just waiting on the other commit before I do that.

On Sep 5, 2021, at 7:21 AM, Jailbreaker @.***> wrote:

 do you know how i can start the car?

I don't think that's a feature yet but i wonder if they will implement it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

fuatakgun commented 3 years ago

@cdnninja , if you have time, you can go ahead and implement car start functionality while I am working on your previous improvement. Thanks for your super useful contributions.

cdnninja commented 3 years ago

@fuatakgun Yes I will get it going in the next few days, should be pretty easy. Once you have a branch with some of your changes let me know so I can point my instance at it for testing.

fuatakgun commented 3 years ago

Please get latest version which includes pin support, location and odometer readings.

Thanks again for your super work @cdnninja

Waiting on your next iteration

cdnninja commented 3 years ago
cdnninja commented 3 years ago

@fuatakgun in the EU does start_climate also start the car?

fuatakgun commented 3 years ago

I don't have an EV but i confirmed this earlier, yes, it is also starting the car.

cdnninja commented 3 years ago

Okay. I’ll use that method. Was going to create a new one but noticed a comment mentioning car start for the climate command.

On Sep 18, 2021, at 9:27 AM, fuatakgun @.***> wrote:

 I don't have an EV but i confirmed this earlier, yes, it is also starting the car.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

cdnninja commented 3 years ago

Okay team! Just tested. At this point remote start works, remote stop works, lock unlock work. Items are filtered down to just what elements your car supports in cad.

Few clean up items I think can be future:

  1. You can't start the car unless it is locked. Should have the system check this first.
  2. More data can be exposed in canada, like KM to next oil change etc.
  3. Should implement EV charging but until someone can test this in CAD not worth me trying.
  4. General error handling.
  5. Allow remote start profiles and configuration, right now this is hardcoded.
  6. Other climate related features.

I am thinking we may want to close this mega thread unless someone has a specific feature request remaining. I have found an easy way to get details out of the API, since they have a website with the same function debug mode on the browser logs all the calls required. This helped me solve the remote start as this didn't exist in the wcomartin version.

fuatakgun commented 3 years ago

You rock here, super useful contributions @cdnninja , agree on closing this issue. Adding you as a contributor to the library, you are an owner as much as me.