Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Canada #25

Closed
dahlb opened this issue Dec 7, 2021 · 5 comments
Closed

Support Canada #25

dahlb opened this issue Dec 7, 2021 · 5 comments
Assignees
Labels
Canada Hyundai Involves CA Hyundai Code Canada Kia Involves Canada Kia Code enhancement New feature or request help wanted Extra attention is needed

Comments

@dahlb
Copy link
Owner

dahlb commented Dec 7, 2021

No description provided.

@dahlb dahlb added enhancement New feature or request help wanted Extra attention is needed labels Dec 7, 2021
@dahlb
Copy link
Owner Author

dahlb commented Dec 7, 2021

please comment if you are in canada and willing to verify the implementation there

@speedking456
Copy link

I'm in Canada an have a vehicle registered with uvo. I have python experience as well so I'm more than willing to chip in where I can.

@dahlb
Copy link
Owner Author

dahlb commented Dec 13, 2021

@speedking456 that's very exciting, I'll start on a API wrapper for CA today and should have something for you to try in a day or two from the pypi package

@dahlb
Copy link
Owner Author

dahlb commented Dec 14, 2021

@speedking456 I think the wrapper is ready, can you run it in the python console to improve the wrapper's documentation?

pip3 install kia-uvo-api==1.1.7

from a python console run

import logging
from kia_uvo_api import CaKia
logger = logging.getLogger("kia_uvo_api.ca")
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
import asyncio
async def testing():
  ca = CaKia()
  pin = "PIN"
  login_response = await ca.login("user", "pass")
  access_token = login_response["access_token"]
  vehicles = await ca.get_vehicles(access_token)
  vehicle_id = vehicles["vehicles"][0]["vehicleId"]
  await ca.get_cached_vehicle_status(access_token=access_token, vehicle_id=vehicle_id)
  await ca.get_next_service_status(access_token=access_token, vehicle_id=vehicle_id)
  pin_token = await ca.get_pin_token(access_token=access_token, pin=pin)
  await ca.get_location(access_token=access_token, vehicle_id=vehicle_id, pin=pin, pin_token=pin_token)

asyncio.run(testing())

but with real username, password, and PIN. the console should show all the responses raw json; if you can post the responses I'll add them to the API files for reference like I did for the us kia version https://github.com/dahlb/kia_uvo/blob/master/kia_uvo_api/src/kia_uvo_api/us_kia.py#L139

BE SURE TO REMOVE ANY PII like vin, but I'm not sure which PII will be in the responses, you could email it to me at dahl.brendan@gmail.com if you want a second pair of eyes to check for PII before it's online. Feel free to add the documentation in a PR if you'd like :).

I'll start working on the HA side of changes for CA but that'll take a few days and be much better with the responses for reference.

@dahlb dahlb self-assigned this Dec 14, 2021
@dahlb
Copy link
Owner Author

dahlb commented Dec 15, 2021

I think I've gotten the bulk of it working for Canada in the integration; it's in master. The service calls are still in F instead of C but I'm hoping to work that out tomorrow. I haven't been able to test it but short of typos I'm pretty confident it'll work, please let me know your experience.

Having those responses documented for the API is still important and will help with the vehicle attributes like model name and debugging.

PS: I'm new to python myself, only been doing it the last month or so for this project. If you notice any best practices or other issues, please let me know and I'll work on improving it.

@dahlb dahlb added Canada Hyundai Involves CA Hyundai Code Canada Kia Involves Canada Kia Code labels Dec 25, 2021
@dahlb dahlb closed this as completed Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Canada Hyundai Involves CA Hyundai Code Canada Kia Involves Canada Kia Code enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants