Expand description
Async client for Hyundai Bluelink India and Kia Connect India.
hkconnect talks to the same undocumented servers as the official India
apps, using your own account. It is unofficial and not affiliated with
Hyundai or Kia; the API can change without notice.
§Features
- Login with automatic token refresh, and a
Sessionyou can persist to skip the slow login on the next run (Client::with_session). - Reads:
Client::vehicles, cachedClient::statusand car-wakingClient::refresh_status,Client::location,Client::maintenance,Client::capabilities, and trip history (Client::trips_in_month,Client::trips_on_day,Client::trip_detail). - Remote commands: lock/unlock, remote start with climate, stop, hazard
lights/horn, valet mode and sending a destination. Commands return a
CommandIdas soon as the server accepts them; useClient::wait_forto learn whether the car actually acted. - Errors mapped from the server’s result codes into
Error. - Lenient parsing: fields a car may omit are
Option, numbers sent as strings are accepted, and a list entry that cannot be read is skipped instead of failing the whole call. Timestamps (sent in Indian Standard Time) are converted to UTCjiff::Timestamps. - Data types implement
SerializeandDeserializewith the samesnake_casefield names both ways, so they can be stored or sent as JSON and read back; a storedTripstill works withClient::trip_detail.
§Status
Reads have been verified against a real 2024 Hyundai Creta. Remote
commands are experimental: they follow the reference implementation and
are tested against a fake server, but are not yet verified on a real car.
Kia uses the same protocol on a different host and is untested. Newer cars
that use the “CCS2” protocol are not supported: Client::status,
Client::refresh_status and the remote commands return
Error::UnsupportedVehicle for them.
§Example
Log in, pick the first car and read its cached status. The hkc
command-line crate in the same repository is a complete program built on
this library.
use hkconnect::{Brand, Client, Config, Credentials};
let client = Client::new(
Config::india(Brand::Hyundai),
Credentials::new("you@example.com", "password").with_pin("1234"),
)?;
let car = client.vehicles().await?.remove(0);
let status = client.status(&car).await?;
println!("locked: {:?}", status.locked);Re-exports§
Structs§
- Battery12V
- The 12V starter battery. Frequent
Client::refresh_statuscalls drain it. - Capabilities
- What the car is equipped to do remotely, from its factory profile
(
Client::capabilities). - Celsius
- A climate set-point in °C: 14.0–29.5 in 0.5 steps.
- Client
- Client for one Bluelink / Kia Connect India account.
- Climate
Options - Options for remote start with climate, passed to
Client::start_climate. - Command
Id - Identifies a command sent to the car, to check its result later with
Client::command_statusorClient::wait_for. - Config
- Everything needed to talk to one brand’s India API.
- Coordinates
- A position (WGS 84).
- Credentials
- Account login details.
- Destination
- A place to send to the car’s navigation with
Client::send_destination. - Distance
- A distance with its unit, as reported by the car.
- Doors
- Which doors are open. A door the car did not report counts as closed.
- Http
Error - A failed HTTP request, from
Error::Http. - Location
- Where the car was last parked, from
Client::location. - Maintenance
- Odometer and service intervals, from
Client::maintenance. - Maintenance
Item - One service item, such as engine oil or the air filter.
- Route
Point - One GPS point on a trip’s route.
- Service
Interval - How often a service item is due: by distance, time, or both, whichever
comes first. Each is
Noneif not reported. - Session
- A logged-in session. Persist it (securely) to skip the ~3.5 s login on the next run; the client refreshes it automatically.
- Trip
- One trip, as listed for a day. Pass it to
Client::trip_detailfor the route. - TripDay
- The trips taken on one day, from
Client::trips_on_day. - Trip
DayCount - How many trips were taken on one day of a
TripMonth. - Trip
Detail - One trip’s route and driving behaviour, from
Client::trip_detail. - Trip
Month - Totals for a month, and which days had trips, from
Client::trips_in_month. - Trip
Totals - Driving totals over some period: a month, a day, or one trip. Each field
is
Noneif the server did not report it. - Vehicle
- A car on the account, as returned by
Client::vehicles. - Vehicle
Status - A snapshot of the car’s state, from
Client::status(cached) orClient::refresh_status(live).
Enums§
- Brand
- Car brand. Hyundai and Kia India run the same protocol on different hosts.
- Command
Status - What happened to a command, from the server’s command records.
- Distance
Unit - Unit of a
Distance. The server sends a numeric code: 2 or 3 means miles, anything else kilometres. - Error
- Everything that can go wrong talking to the car.
- Powertrain
- A car’s engine type, from the server’s
typecode.