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
433 stars 85 forks source link

force update stopped working after upgrade to 2.0.27 #439

Closed zadigre closed 1 year ago

zadigre commented 1 year ago

Hyundai Kona Electric 2021 in Canada

force update stopped working with latest 2.0.27 update. downgraded to 2.0.26... and it's working fine (nearly instant).

Got some error in the log after doing a force update in one of my script: 2022-11-14 21:43:20.710 DEBUG (SyncWorker_6) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Received forced vehicle data {'responseHeader': {'responseCode': 0, 'responseDesc': 'Success'}, 'result': {'status': {'lastStatusDate': '20221115024318', 'airCtrlOn': False, 'engine': False, 'doorLock': True, 'doorOpen': {'frontLeft': 0, 'frontRight': 0, 'backLeft': 0, 'backRight': 0}, 'trunkOpen': False, 'airTempUnit': 'C', 'airTemp': {'value': '00H', 'unit': 0}, 'defrost': False, 'acc': False, 'evStatus': {'batteryCharge': False, 'batteryStatus': 68, 'batteryPlugin': 2, 'remainTime2': {'etc1': {'value': 0, 'unit': 1}, 'etc2': {'value': 0, 'unit': 1}, 'etc3': {'value': 0, 'unit': 1}, 'atc': {'value': 0, 'unit': 1}}, 'drvDistance': [{'rangeByFuel': {'gasModeRange': {'value': 0.0, 'unit': 1}, 'evModeRange': {'value': 348.0, 'unit': 1}, 'totalAvailableRange': {'value': 348.0, 'unit': 1}}, 'type': 2}]}, 'hoodOpen': False, 'transCond': True, 'steerWheelHeat': 0, 'sideBackWindowHeat': 0, 'dte': {}, 'tirePressureLamp': {'tirePressureLampAll': 0}, 'battery': {'batSoc': 79, 'batState': 0, 'batSignalReferenceValue': {}}, 'remoteIgnition': True, 'seatHeaterVentInfo': {}, 'sleepModeCheck': False, 'lampWireStatus': {'headLamp': {}, 'stopLamp': {}, 'turnSignalLamp': {}}, 'windowOpen': {}, 'engineRuntime': {}}}} 2022-11-14 21:43:20.711 DEBUG (SyncWorker_6) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Old Vehicle Last Updated: 2022-11-15 02:13:50+00:00 2022-11-14 21:43:20.711 DEBUG (SyncWorker_6) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - last_updated_at - before 20221115024318 2022-11-14 21:43:20.711 DEBUG (SyncWorker_6) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - last_updated_at - after 2022-11-15 02:43:18+00:00 2022-11-14 21:43:20.711 DEBUG (SyncWorker_6) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Current Vehicle Last Updated: 2022-11-15 02:43:18+00:00 2022-11-14 21:43:21.277 DEBUG (SyncWorker_6) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Get Service status data {'responseHeader': {'responseCode': 0, 'responseDesc': 'Success'}, 'result': {'maintenanceInfo': {'msopServiceOdometer': 48081.0, 'msopServiceOdometerUnit': 1, 'mtspServiceDate': '20220819', 'imatServiceOdometer': 60081.0, 'imatServiceOdometerUnit': 1, 'mtitServiceDate': '20230219', 'currentOdometer': 54223.1, 'currentOdometerUnit': 1, 'serviceOdometerDuration': 12000.0, 'serviceDaysDuration': 184, 'serviceMonthsThreshold': 6}}} 2022-11-14 21:43:21.279 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall kia_uvo.force_update (c:01GHWJNZWXP8KYNVH2VG9MZBJ5): device_id=c5ecad382e823ad854e7ba7dc8c2cbcd> Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/core.py", line 1762, in catch_exceptions await coro_or_task File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/kia_uvo/services.py", line 45, in async_handle_force_update await coordinator.async_force_update_all() File "/config/custom_components/kia_uvo/coordinator.py", line 123, in async_force_update_all await self.async_write_ha_state() AttributeError: 'HyundaiKiaConnectDataUpdateCoordinator' object has no attribute 'async_write_ha_state'

and also force update from the developer tools in the iOS app (got similar errors in Safari on my Mac): 2022-11-14 21:57:46.447 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'HyundaiKiaConnectDataUpdateCoordinator' object has no attribute 'async_write_ha_state' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1744, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/kia_uvo/services.py", line 45, in async_handle_force_update await coordinator.async_force_update_all() File "/config/custom_components/kia_uvo/coordinator.py", line 123, in async_force_update_all await self.async_write_ha_state() AttributeError: 'HyundaiKiaConnectDataUpdateCoordinator' object has no attribute 'async_write_ha_state' 2022-11-14 21:57:46.451 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140703402396208] Error handling message: Unknown error (unknown_error) from 192.168.25.130 (Mozilla/5.0 (iPhone; CPU iPhone OS 16_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Home Assistant/2022.10.1 (io.robbie.HomeAssistant; build:2022.424; iOS 16.2.0) Mobile/HomeAssistant, like Safari) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 646, in handle_execute_script await script_obj.async_run(msg.get("variables"), context=context) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1744, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/kia_uvo/services.py", line 45, in async_handle_force_update await coordinator.async_force_update_all() File "/config/custom_components/kia_uvo/coordinator.py", line 123, in async_force_update_all await self.async_write_ha_state() AttributeError: 'HyundaiKiaConnectDataUpdateCoordinator' object has no attribute 'async_write_ha_state'

cdnninja commented 1 year ago

Which version of home assistant are you running on? I retested .27 force update and have no issue on my side.

cdnninja commented 1 year ago

I take that bag. My logs weren't updating.

cdnninja commented 1 year ago

v2.0.28 has been released with this reverted as well as a few other changes.

zadigre commented 1 year ago

Yet was .27 Working fine now with .29