Skip to main content

Crate hkconnect

Crate hkconnect 

Source
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

§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§

pub use jiff;
pub use url;

Structs§

Battery12V
The 12V starter battery. Frequent Client::refresh_status calls 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.
ClimateOptions
Options for remote start with climate, passed to Client::start_climate.
CommandId
Identifies a command sent to the car, to check its result later with Client::command_status or Client::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.
HttpError
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.
MaintenanceItem
One service item, such as engine oil or the air filter.
RoutePoint
One GPS point on a trip’s route.
ServiceInterval
How often a service item is due: by distance, time, or both, whichever comes first. Each is None if 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_detail for the route.
TripDay
The trips taken on one day, from Client::trips_on_day.
TripDayCount
How many trips were taken on one day of a TripMonth.
TripDetail
One trip’s route and driving behaviour, from Client::trip_detail.
TripMonth
Totals for a month, and which days had trips, from Client::trips_in_month.
TripTotals
Driving totals over some period: a month, a day, or one trip. Each field is None if the server did not report it.
Vehicle
A car on the account, as returned by Client::vehicles.
VehicleStatus
A snapshot of the car’s state, from Client::status (cached) or Client::refresh_status (live).

Enums§

Brand
Car brand. Hyundai and Kia India run the same protocol on different hosts.
CommandStatus
What happened to a command, from the server’s command records.
DistanceUnit
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 type code.

Type Aliases§

Result
Result type used throughout this crate, defaulting to Error.