Giter Site home page Giter Site logo

hyundai_kia_connect_api's Introduction

Introduction

This is a Kia UVO and Hyundai Bluelink written in python. It is primary consumed by home assistant. If you are looking for a home assistant Kia / Hyundai implementation please look here: https://github.com/fuatakgun/kia_uvo. Much of this base code came from reading bluelinky and contributions to the kia_uvo home assistant project.

Usage

This package is designed to simplify the complexity of using multiple regions. It attempts to standardize the usage regardless of what brand or region the car is in. That isn't always possible though, in particular some features differ from one to the next.

Python 3.9 or newer is required to use this package. Vehicle manager is the key class that is called to manage the vehicle lists. One vehicle manager should be used per login. Key data points required to instantiate vehicle manager are:

region: int
brand: int,
username: str
password: str
pin: str (required for CA, and potentially USA, otherwise pass a blank string)

Key values for the int exist in the constant(https://github.com/fuatakgun/hyundai_kia_connect_api/blob/master/hyundai_kia_connect_api/const.py) file as:

REGIONS = {1: REGION_EUROPE, 2: REGION_CANADA, 3: REGION_USA}
BRANDS = {1: BRAND_KIA, 2: BRAND_HYUNDAI}

Once this is done you can now make the following calls against the vehicle manager:

#Checks the token is still valid and updates it if not.  Should be called before anything else.
check_and_refresh_token(self)

#Ideal fresh command. Checks if the car has been updated since the time in seconds provided.  If so does a cached update. If not force calls the car.
check_and_force_update_vehicles(self, force_refresh_interval) # Interval in seconds - consider API Rate Limits https://github.com/Hacksore/bluelinky/wiki/API-Rate-Limits

#Used to return a specific vehicle object:
get_vehicle(self, vehicle_id)

#Updates all cars with what is cached in the cloud:
update_all_vehicles_with_cached_state(self)

#Updates a specific car with cached state:
update_vehicle_with_cached_state(self, vehicle_id)

#Force refreshes all cars:
force_refresh_all_vehicles_states(self)

#Force refreshes a single car:
force_refresh_vehicles_states(self, vehicle_id)

An example call would be:

from hyundai_kia_connect_api import *
vm = VehicleManager(region=2, brand=1, username="[email protected]", password="password", pin="1234")
vm.check_and_refresh_token()
vm.update_all_vehicles_with_cached_state()
print(vm.vehicles)

If geolocation is required you can also allow this by running:

vm = VehicleManager(region=2, brand=1, username="[email protected]", password="password", pin="1234", geocode_api_enable=True, geocode_api_use_email=True)

This will populate the address of the vehicle in the vehicle instance.

The Bluelink App is reset to English for users who have set another language in the Bluelink App in Europe when using hyundai_kia_connect_api. To avoid this, you can pass the optional parameter language (default is "en") to the constructor of VehicleManager, e.g. for Dutch:

vm = VehicleManager(region=2, brand=1, username="[email protected]", password="password", pin="1234", language="nl")

Note: this is only implemented for Europe currently. For a list of language codes, see here: https://www.science.co.il/language/Codes.php. Currently in Europe the Bluelink App shows the following languages:

- "en" English
- "de" German
- "fr" French
- "it" Italian
- "es" Spanish
- "sv" Swedish
- "nl" Dutch
- "no" Norwegian
- "cs" Czech
- "sk" Slovak
- "hu" Hungarian
- "da" Danish
- "pl" Polish
- "fi" Finnish
- "pt" Portuguese

hyundai_kia_connect_api's People

Contributors

cdnninja avatar actions-user avatar fuatakgun avatar dependabot[bot] avatar zulufoxtrot avatar jwefers avatar torbjornaxelsson avatar empor-co avatar gd-l avatar jacobian avatar robhammond avatar zuinigerijder avatar lars-comtide avatar nprez83 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.