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

Date formatting for ev_off_peak_end_time and ev_off_peak_start_time #539

Closed ericvb closed 1 year ago

ericvb commented 1 year ago

Please check Services, Known Bug / Issues and Troubleshooting over here first: https://github.com/fuatakgun/kia_uvo/blob/master/README.md Region and Brand of car EU, Hyundai Santa Fe plugin hybride Version of the integration 2.3.1

Describe the bug I've configured my schedule as starting from 22.00 in the evening till 07.00 the next morning. I see the values of the sensors as 10.00 and 07.00 In the returning json array I see: 'reservChargeInfos': {'reservChargeInfo': {'reservChargeInfoDetail': {'reservInfo': {'day': [0, 1, 2, 3, 4, 5, 6], 'time': {'time': '0700', 'timeSection': 0}}, 'reservChargeSet': True}}, 'offpeakPowerInfo': {'offPeakPowerTime1': {'starttime': {'time': '1000', 'timeSection': 1}, 'endtime': {'time': '0700', 'timeSection': 0}}, 'offPeakPowerFlag': 1},

The variable timeSection is '0' for the 07.00 in the morning and '1' for the time in the evening.

Debug logs if an error occurred

2022-12-27 12:19:24.483 DEBUG (SyncWorker_1) [hyundai_kia_connect_api.KiaUvoApiEU] hyundai_kia_connect_api - get_cached_vehicle_status response: {'retCode': 'S', 'resCode': '0000', 'resMsg': {'vehicleStatusInfo': {'vehicleLocation': {'coord': {'lat': xx.xxxxxx, 'lon': y.yyyyyy, 'alt': 0, 'type': 0}, 'head': 0, 'speed': {'value': 0, 'unit': 0}, 'accuracy': {'hdop': 0, 'pdop': 0}, 'time': '20221227121923'}, 'vehicleStatus': {'airCtrlOn': False, 'engine': False, 'doorLock': True, 'doorOpen': {'frontLeft': 0, 'frontRight': 0, 'backLeft': 0, 'backRight': 0}, 'trunkOpen': False, 'airTemp': {'value': '00H', 'unit': 0, 'hvacTempType': 1}, 'defrost': False, 'lowFuelLight': False, 'acc': False, 'evStatus': {'batteryCharge': False, 'batteryStatus': 100, 'batteryPlugin': 0, 'remainTime2': {'etc2': {'value': 1, 'unit': 1}, 'etc3': {'value': 1, 'unit': 1}, 'atc': {'value': 1, 'unit': 1}}, 'drvDistance': [{'rangeByFuel': {'gasModeRange': {'value': 455, 'unit': 1}, 'evModeRange': {'value': 0, 'unit': 1}, 'totalAvailableRange': {'value': 455, 'unit': 1}}, 'type': 2}], 'reservChargeInfos': {'reservChargeInfo': {'reservChargeInfoDetail': {'reservInfo': {'day': [0, 1, 2, 3, 4, 5, 6], 'time': {'time': '0700', 'timeSection': 0}}, 'reservChargeSet': True}}, 'offpeakPowerInfo': {'offPeakPowerTime1': {'starttime': {'time': '1000', 'timeSection': 1}, 'endtime': {'time': '0700', 'timeSection': 0}}, 'offPeakPowerFlag': 1}, 'reserveChargeInfo2': {'reservChargeInfoDetail': {'reservInfo': {'day': [9], 'time': {'time': '1200', 'timeSection': 0}}, 'reservChargeSet': False}}, 'reservFlag': 1, 'ect': {'start': {'day': 9, 'time': {'time': '1200', 'timeSection': 0}}, 'end': {'day': 9, 'time': {'time': '1200', 'timeSection': 0}}}}}, 'ign3': False, 'hoodOpen': False, 'transCond': True, 'steerWheelHeat': 0, 'sideBackWindowHeat': 0, 'tirePressureLamp': {'tirePressureLampAll': 0, 'tirePressureLampFL': 0, 'tirePressureLampFR': 0, 'tirePressureLampRL': 0, 'tirePressureLampRR': 0}, 'battery': {'batSoc': 83, 'batState': 0}, 'lampWireStatus': {'stopLamp': {'stopLampStatus': False, 'leftLamp': False, 'rightLamp': False}, 'headLamp': {'headLampStatus': False, 'leftLowLamp': False, 'rightLowLamp': False, 'leftHighLamp': False, 'rightHighLamp': False, 'leftBifuncLamp': False, 'rightBifuncLamp': False}, 'turnSignalLamp': {'turnSignalLampStatus': False, 'leftFrontLamp': False, 'rightFrontLamp': False, 'leftRearLamp': False, 'rightRearLamp': False}}, 'windowOpen': {'frontLeft': 0, 'frontRight': 0, 'backLeft': 0, 'backRight': 0}, 'smartKeyBatteryWarning': False, 'fuelLevel': 87, 'washerFluidStatus': False, 'breakOilStatus': False, 'sleepModeCheck': False, 'time': '20221227121922', 'remoteWaitingTimeAlert': {'remoteControlAvailable': 1, 'remoteControlWaitingTime': 168, 'elapsedTime': '14:40:49'}, 'systemCutOffAlert': 0, 'tailLampStatus': 0, 'hazardStatus': 0}, 'odometer': {'value': 15977.4, 'unit': 1}}}, 'msgId': 'f66c844b-8c64-4916-b4f9-ef4ebd857856'}

To Reproduce Configure a start time in the evening and a end time in the morning : 22.00 till 07.00

Expected behavior I want to see not 10.00 like now but 22.00 Of course, if we go further this path, we can think about a datetime parameter : do you want to see AM/PM or a 24.00 hours based formatting?

Screenshots image image image image

Additional context

fuatakgun commented 1 year ago

apparently, there is a field called timeSection If it is 0, it means AM, if it is 1, it means PM

cdnninja commented 1 year ago

I am thinking we go 24 hour time. Unfortunately it won't be configurable to start.

ericvb commented 1 year ago

@cdnninja, thanks for the fix