kia_uvo icon indicating copy to clipboard operation
kia_uvo copied to clipboard

Setup service to fetch trip reports

Open fuatakgun opened this issue 3 years ago • 11 comments

fuatakgun avatar May 23 '21 19:05 fuatakgun

Resolving due to inactivity

fuatakgun avatar Nov 09 '21 22:11 fuatakgun

Can this be reopened? I would like to develop this if anybody is interested.

The API to develop this is following:

HTTP POST : https://owners.kia.com/apps/services/owners/mytrips/get/trip.html Raw Data : {"guest":"0","alertType":9,"dateRange":{"startDate":"20220617","endDate":"20220623"}}

Sample response:

{
    "status": {
        "statusCode": 0,
        "errorType": 0,
        "errorCode": 0,
        "errorMessage": "Success with response body"
    },
    "payload": {
        "tripInfo": [
            {
                "journeyId": 0,
                "milesDriven": 0.621371,
                "secondsDriven": 51,
                "minutesDriven": 0,
                "hoursDriven": 0,
                "aveSpeed": 0,
                "tripCategory": 0,
                "month": 6,
                "day": 22,
                "year": 2022,
                "startLocation": {
                    "lat": 40.90336388,
                    "lon": -74.1134777778,
                    "altdo": 0
                },
                "endLocation": {
                    "lat": 40.90327777,
                    "lon": -74.1134305556,
                    "altdo": 0
                },
                "tripId": "954429930",
                "startOdometer": 0,
                "endOdometer": 0,
                "idleTime": 45,
                "mph": 0,
                "effScore": 99,
                "inEffScore": 1,
                "startDtTime": "20220622152921",
                "startDateUtcOffset": -4,
                "endDateUtcOffset": -4,
                "avgMileage": -1000,
                "endDtTime": "20220622153012",
                "evPowerConsumption": {
                    "mileage": 0.023898884615384617,
                    "totalPower": 26,
                    "driveTrain": 2,
                    "climateSystem": 4,
                    "accessories": 20,
                    "batteryManagement": 0,
                    "regenerated": 0
                }
            }
        ]
    }
}

kunalkhosla avatar Jun 23 '22 14:06 kunalkhosla

I intend to persiste

  1. Last trip latitude
  2. Longiture
  3. avgSpeed
  4. milesDriven
  5. secondsDriven
  6. hoursDriven
  7. month
  8. Day
  9. year
  10. mph
  11. startDtTime
  12. endDtTime
  13. evPowerConsumption and its sub-fields

kunalkhosla avatar Jun 23 '22 15:06 kunalkhosla

Are you able to create a PR when you are ready? Appreciate the support on this!

cdnninja avatar Jun 23 '22 16:06 cdnninja

Yes, I can try to create the PR. I've never worked on a HACS integration, so this will be new. I can definitely look at what the code is doing. But need confirmation from the community if this is something which will be useful (or if its already being worked upon) before I start working on it

kunalkhosla avatar Jun 23 '22 17:06 kunalkhosla

@cdnninja @fuatakgun I am setting up my dev env today. Did the remote container thingy on VS Code, and the container is working.

However, I dont see any requirements.txt or setup file, and my IDE is complaining about missing dependencies. I am unsure how do I get these set up.

Screen Shot 2022-06-27 at 11 49 55 AM

Also, I dont see any tests which can help me guide/develop locally. What setup do you folks have locally that you use to develop? Is there a main/run method you use to debug through the code?

Apologies if these are all noob questions, I have never developed a HACS integration before

kunalkhosla avatar Jun 27 '22 15:06 kunalkhosla

ok. I looked up your parent repo and I think I moved forward. Now stuck at github.com being unreachable from my devcontainer.

container# git clone -q git://github.com/home-assistant/home-assistant.git
fatal: unable to look up github.com (port 9418) (Try again)

It seems github changes some security settings since the ludeeus/container:integration was created (which was 2 years ago)

Mind sharing your devcontainer.json file?

kunalkhosla avatar Jun 27 '22 19:06 kunalkhosla

it has been awhile! Lots has changed. I am getting back into this. Are you interested in working on this? I currently don't use devcontainers - I should though.

cdnninja avatar Dec 02 '22 22:12 cdnninja

We are now using this for API layer: https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api

cdnninja avatar Dec 02 '22 22:12 cdnninja

Are you interested in working on this?

I certainly can. I just got stuck at setting up my env. If you can share your dev setup, i can try to copy it and see if I can develop and debug

kunalkhosla avatar Dec 03 '22 21:12 kunalkhosla

Since it is just a python library now I would start with visual studio code and just write against the library directly to start.

cdnninja avatar Dec 13 '22 19:12 cdnninja