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

Tucson PHEV scheduled charging #274

Open Utopia69 opened 2 years ago

Utopia69 commented 2 years ago

Hi, It would be nice to have the charging schedule for a (Tucson) PHEV . reservChargeInfos --> Next departure time (1) offpeakPowerInfo --> Off-peak setting reserveChargeInfo2 --> Next departure time (2)

Full response of Tucson PHEV (EU)

{ "retCode": "S", "resCode": "0000", "resMsg": { "vehicleStatusInfo": { "vehicleLocation": { "coord": { "lat": XX.XXXXX, "lon": X.XXXXX, "alt": 0, "type": 0 }, "head": 189, "speed": { "value": 0, "unit": 0 }, "accuracy": { "hdop": 0, "pdop": 0 }, "time": "20220203155212" }, "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": 2, "remainTime2": { "etc2": { "value": 50, "unit": 1 }, "etc3": { "value": 20, "unit": 1 }, "atc": { "value": 0, "unit": 1 } }, "drvDistance": [{ "rangeByFuel": { "gasModeRange": { "value": 0, "unit": 1 }, "evModeRange": { "value": 0, "unit": 1 }, "totalAvailableRange": { "value": 0, "unit": 1 } }, "type": 2 }], "reservChargeInfos": { "reservChargeInfo": { "reservChargeInfoDetail": { "reservInfo": { "day": [0, 1, 2, 3, 4, 5, 6], "time": { "time": "0900", "timeSection": 0 } }, "reservChargeSet": True } }, "offpeakPowerInfo": { "offPeakPowerTime1": { "starttime": { "time": "0100", "timeSection": 0 }, "endtime": { "time": "0700", "timeSection": 0 } }, "offPeakPowerFlag": 2 }, "reserveChargeInfo2": { "reservChargeInfoDetail": { "reservInfo": { "day": [0, 1, 2, 3, 4, 5, 6], "time": { "time": "1200", "timeSection": 0 } }, "reservChargeSet": False } }, "reservFlag": 1, "ect": { "start": { "day": 0, "time": { "time": "0000", "timeSection": 0 } }, "end": { "day": 0, "time": { "time": "0000", "timeSection": 0 } } } } }, "ign3": False, "hoodOpen": False, "transCond": True, "steerWheelHeat": 0, "sideBackWindowHeat": 0, "tirePressureLamp": { "tirePressureLampAll": 0, "tirePressureLampFL": 0, "tirePressureLampFR": 0, "tirePressureLampRL": 0, "tirePressureLampRR": 0 }, "seatHeaterVentState": { "frSeatHeatState": 2, "flSeatHeatState": 2, "rlSeatHeatState": 2, "rrSeatHeatState": 2 }, "battery": { "batSoc": 89, "batState": 0, "sjbDeliveryMode": 1, "batSignalReferenceValue": { "batWarning": 65 }, "powerAutoCutMode": 2 }, "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": 100, "washerFluidStatus": False, "breakOilStatus": False, "sleepModeCheck": False, "time": "20220203155214", "remoteWaitingTimeAlert": { "remoteControlAvailable": 1, "remoteControlWaitingTime": 168, "elapsedTime": "04:43:02" }, "systemCutOffAlert": 0, "tailLampStatus": 0, "hazardStatus": 0 }, "odometer": { "value": 1801.8, "unit": 1 } } }, "msgId": "XXXXXX-XXXXX-XXXXXX-XXXXXX-XXXXXXXX" }

cdnninja commented 2 years ago

Are you looking to set this or display?

Utopia69 commented 2 years ago

Are you looking to set this or display?

Both would be nice, since it's constantly changing (resetting itself) without any reason

rayures commented 1 year ago

wow, just found this and realllyyy would like this Scheduled Charging feature. Stupid car is always disabling this.

pm me if testing is needed.

cdnninja commented 1 year ago

I am interested to hear how people would want this displayed based on the raw data? If possible think about other data types you have seen in HACS as I don't think a string is helpful here. Also interested to see what you would do with the data in automations so that I make it useful.

cdnninja commented 1 year ago

Could I get screenshots of how you this is shown in the app? May give me clues on how to show it in HACS.

Utopia69 commented 1 year ago

please find below some screenshots from the app Screenshot_20221209_083531_Bluelink Screenshot_20221209_083541_Bluelink Screenshot_20221209_083547_Bluelink

cdnninja commented 1 year ago

I have done the initial work of mapping this data from the API. https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/pull/204

I don't know how we set though and would need someone to sniff the traffic to figure that out. I am still unsure how to display this in home assistant.

Some items will just be binary sensors (on off) for now and could turn to a switch if we learn to set the schedule. For times I am thinking just text, same with days of the week. Would that help you?

cdnninja commented 1 year ago

Could you update in hacs and select the version of "master"? It should show 6 new sensors. I haven't added day of the week yet. To start I want to confirm these 6 work and get any feedback you may have on this.

Utopia69 commented 1 year ago

With the master version I get 2 new sensors EV First Scheduled Departure & EV First Scheduled Departure Time (and they are correct)

cdnninja commented 1 year ago

Could I get the attribute contents of your data sensor? I'm interested to see why the second departure didn't show up.

Utopia69 commented 1 year ago

Could I get the attribute contents of your data sensor? I'm interested to see why the second departure didn't show up.

vehicleLocation: coord: lat: XX.XXXXX lon: XX.XXXXX alt: 0 type: 0 head: 0 speed: value: 0 unit: 0 accuracy: hdop: 0 pdop: 0 time: '20221224143639' 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: 99 batteryPlugin: 2 remainTime2: etc2: value: 1 unit: 1 etc3: value: 1 unit: 1 atc: value: 1 unit: 1 drvDistance:

cdnninja commented 1 year ago

Please update to the latest release and let me know results. I found one issue that may have impacted other sensors not showing.

Utopia69 commented 1 year ago

Please update to the latest release and let me know results. I found one issue that may have impacted other sensors not showing.

Updated to 2.3.0, but sensors are the same

vehicleLocation: coord: lat: XX.XXXXX lon: XX.XXXX alt: 0 type: 0 head: 0 speed: value: 0 unit: 0 accuracy: hdop: 0 pdop: 0 time: '20221224165052' 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: 99 batteryPlugin: 2 remainTime2: etc2: value: 1 unit: 1 etc3: value: 1 unit: 1 atc: value: 1 unit: 1 drvDistance:

cdnninja commented 1 year ago

Found some of the issues. They spell words different for the second charge and also I had a mistake on off peak. https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/pull/211 Please try again with the latest from "master"

Utopia69 commented 1 year ago

I can confirm, I have the new sensors now

cdnninja commented 1 year ago

Could you test out data from the afternoon and see what it does? I may need logs or you to roll back. Have another issue opened where the data is 1270 for time in the api but the app shows 1:10 so almost looks like they handle pm times strangely.

Utopia69 commented 1 year ago

My "EV Second Scheduled Depature Time" shows 01:00:00, this should be 13:00:00 Will test some more pm times later today

Utopia69 commented 1 year ago

Also the other sensors are incorrect, the show for example 03:00:00 instead of 15:00:00

cdnninja commented 1 year ago

https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/pull/214

cdnninja commented 1 year ago

If you update from "Master" in HACS the PM issue should be solved.

Utopia69 commented 1 year ago

Tested with master and can confirm the PM issue is solved.