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

last updated at not updating when force update through a script #592

Open zadigre opened 1 year ago

zadigre commented 1 year ago

Hyundai Kona Electric 2021 in Canada

version of the integration, 2.5.9 version of HA: Home Assistant 2023.2.3 Supervisor 2023.01.1 Operating System 9.5 Frontend 20230202.0 - latest

last updated at (and most probably other sensors) is not updated when force update call service is started through a script. if I call the service manually or directly through an automation, it works fine.

data is received in the log (see below). so I'm not sure why it's not updated on the UI. it may have stopped working with HA 2023.2.3... but I'm not sure. This script was for sure working before. this script only has force update in it. Very simple script : alias: KONA - Force update sequence:

log here: 2023-02-09 06:12:19.259 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Received forced vehicle data {'responseHeader': {'responseCode': 0, 'responseDesc': 'Success'}, 'result': {'status': {'lastStatusDate': '20230209111217', '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': 79, 'batteryPlugin': 0, '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': 314.0, 'unit': 1}, 'totalAvailableRange': {'value': 314.0, 'unit': 1}}, 'type': 2}]}, 'hoodOpen': False, 'transCond': True, 'steerWheelHeat': 0, 'sideBackWindowHeat': 0, 'dte': {}, 'tirePressureLamp': {'tirePressureLampAll': 0}, 'battery': {'batSoc': 83, 'batState': 0, 'batSignalReferenceValue': {}}, 'remoteIgnition': True, 'seatHeaterVentInfo': {}, 'sleepModeCheck': False, 'lampWireStatus': {'headLamp': {}, 'stopLamp': {}, 'turnSignalLamp': {}}, 'windowOpen': {}, 'engineRuntime': {}}}} 2023-02-09 06:12:19.260 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - last_updated_at - before 20230209111217 2023-02-09 06:12:19.260 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - last_updated_at - after 2023-02-09 11:12:17+00:00 2023-02-09 06:12:19.260 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Offset between vehicle and UTC: 0 hours 2023-02-09 06:12:19.260 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Old Vehicle Last Updated: 2023-02-09 10:57:48+00:00 2023-02-09 06:12:19.261 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - last_updated_at - before 20230209111217 2023-02-09 06:12:19.261 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - last_updated_at - after 2023-02-09 11:12:17+00:00 2023-02-09 06:12:19.261 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Current Vehicle Last Updated: 2023-02-09 11:12:17+00:00 2023-02-09 06:12:19.952 DEBUG (SyncWorker_2) [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': 58505.7, 'currentOdometerUnit': 1, 'serviceOdometerDuration': 12000.0, 'serviceDaysDuration': 184, 'serviceMonthsThreshold': 6}}} 2023-02-09 06:12:20.795 DEBUG (SyncWorker_2) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Received get_charge_limits: {'responseHeader': {'responseCode': 0, 'responseDesc': 'Success'}, 'result': [{'plugType': 0, 'level': 80, 'dte': {'rangeByFuel': {'gasModeRange': {'value': 0.0, 'unit': 1}, 'evModeRange': {'value': 314.0, 'unit': 1}, 'totalAvailableRange': {'value': 314.0, 'unit': 1}}, 'type': 2}}, {'plugType': 1, 'level': 90, 'dte': {'rangeByFuel': {'gasModeRange': {'value': 0.0, 'unit': 1}, 'evModeRange': {'value': 314.0, 'unit': 1}, 'totalAvailableRange': {'value': 314.0, 'unit': 1}}, 'type': 2}}]} 2023-02-09 06:12:21.380 DEBUG (SyncWorker_7) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - get_cached_vehicle_status response {'responseHeader': {'responseCode': 0, 'responseDesc': 'Success'}, 'result': {'status': {'lastStatusDate': '20230209105748', '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': 79, 'batteryPlugin': 0, 'remainTime2': {'etc1': {'value': 2, 'unit': 1}, 'etc2': {'value': 390, 'unit': 1}, 'etc3': {'value': 0, 'unit': 1}, 'atc': {'value': 0, 'unit': 1}}, 'drvDistance': [{'rangeByFuel': {'gasModeRange': {'value': 0.0, 'unit': 1}, 'evModeRange': {'value': 314.0, 'unit': 1}, 'totalAvailableRange': {'value': 314.0, 'unit': 1}}, 'type': 2}]}, 'hoodOpen': False, 'transCond': True, 'steerWheelHeat': 0, 'sideBackWindowHeat': 0, 'dte': {}, 'tirePressureLamp': {'tirePressureLampAll': 0}, 'battery': {'batSoc': 83, 'batState': 0, 'batSignalReferenceValue': {}}, 'remoteIgnition': True, 'seatHeaterVentInfo': {}, 'sleepModeCheck': False, 'lampWireStatus': {'headLamp': {}, 'stopLamp': {}, 'turnSignalLamp': {}}, 'windowOpen': {}, 'engineRuntime': {}}}} 2023-02-09 06:12:21.380 DEBUG (SyncWorker_7) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Old Vehicle Last Updated: 2023-02-09 11:12:17+00:00 2023-02-09 06:12:21.381 DEBUG (SyncWorker_7) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - last_updated_at - before 20230209105748 2023-02-09 06:12:21.381 DEBUG (SyncWorker_7) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - last_updated_at - after 2023-02-09 10:57:48+00:00 2023-02-09 06:12:21.381 DEBUG (SyncWorker_7) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Current Vehicle Last Updated: 2023-02-09 10:57:48+00:00 2023-02-09 06:12:22.012 DEBUG (SyncWorker_7) [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': 58505.7, 'currentOdometerUnit': 1, 'serviceOdometerDuration': 12000.0, 'serviceDaysDuration': 184, 'serviceMonthsThreshold': 6}}} 2023-02-09 06:12:22.559 DEBUG (SyncWorker_7) [hyundai_kia_connect_api.KiaUvoApiCA] hyundai_kia_connect_api - Received get_charge_limits: {'responseHeader': {'responseCode': 0, 'responseDesc': 'Success'}, 'result': [{'plugType': 0, 'level': 80, 'dte': {'rangeByFuel': {'gasModeRange': {'value': 0.0, 'unit': 1}, 'evModeRange': {'value': 314.0, 'unit': 1}, 'totalAvailableRange': {'value': 314.0, 'unit': 1}}, 'type': 2}}, {'plugType': 1, 'level': 90, 'dte': {'rangeByFuel': {'gasModeRange': {'value': 0.0, 'unit': 1}, 'evModeRange': {'value': 314.0, 'unit': 1}, 'totalAvailableRange': {'value': 314.0, 'unit': 1}}, 'type': 2}}]} 2023-02-09 06:12:22.560 DEBUG (MainThread) [custom_components.kia_uvo.coordinator] Finished fetching kia_uvo data in 1.764 seconds (success: True)

cdnninja commented 1 year ago

Does the force update log entry last updated time stamp match what's in the interface?

zadigre commented 1 year ago

this morning, force update through a script, no. force update through call service directly (either in an automation or developer tools, services) yes.

but now, only the automation is working... calling the same service. correct data is always shown in the log.

thus I believe it might be intermittent.

cdnninja commented 1 year ago

Okay so sometimes the log file doesn't match the interface. This implies home assistant isn't picking up on the change. If you run a second automation back to back does it solve it? Even a cached update.

zadigre commented 1 year ago

Yes when it doesn’t work on the first try, it works on the second 1 minute later