Package: jlrpy
jlrpyPython 3 library for interacting with the JLR Remote car API.DocumentationThe associated API documentation for the JLR InControl API is a good read for anyone wanting to make use of this project. It's currently availablehereInstallationEither check out this repository directly or install through pip (for Python3).pip install jlrpyUsageTo get started, instantiate aConnectionobject and pass along the email address and password associated with your Jaguar InControl account.There are two ways to authenticate to InControl. Using the user name and password or with a valid refresh token.The JLR API requires a device ID to be registered (UUID4 formatted). If you do not specify one when instantiating theConnectionobject it will generate a new one for your automatically.importjlrpy# Authenticate using the username and passwordc=jlrpy.Connection('my@email.com','password')v=c.vehicles[0]# Authenticate using a refresh token (username must still be specified)c=jlrpy.Connection(email='my@email.com',refresh_token='124c3f21-42ds-2e4d-86f8-221v32392a1d')Connection.vehicleswill list all vehicles associated with your account.# Get user informationc.get_user_info()# Update user information.p=c.get_user_info()p['contact']['userPreferences']['unitsOfMeasurement']="Km Litre Celsius VolPerDist Wh DistPerkWh"c.update_user_info(p)# Refresh access tokenc.refresh_tokens()# Get attributes associated with vehiclev.get_attributes()# Get current status of vehiclev.get_status()# Get current active servicesv.get_services()# Optionally, you can also specify a status value keyv.get_status("EV_STATE_OF_CHARGE")# Get subscription packesv.get_subscription_packages()# Get trip data (last 1000 trips).v.get_trips()# Get data for a single trip (specified with trip id)v.get_trip(121655021)# Get vehicle health statusv.get_health_status()# Get departure timersv.get_departure_timers()# Get configured wakeup timev.get_wakeup_time()# Honk horn and blink lightsv.honk_blink()# Get current position of vehiclev.get_position()# Start preconditioning at 21.0Cv.preconditioning_start("210")# Stop preconditioningv.preconditioning_stop()# Set vehicle nickname and registration numberv.set_attributes("Name","reg-number")# Lock vehiclev.lock(pin)# pin being the personal master pin# Unlock vehiclev.unlock(pin)# Reset alarmv.reset_alarm(pin)# Start chargingv.charging_start()# Stop chargingv.charging_stop()# Set max soc at 80% (Requires upcoming OTA update)v.set_max_soc(80)# Set max soc for current charging session to 90% (Requires upcoming OTA update)v.set_one_off_max_soc(90)# Add single departure timer (index, year, month, day, hour, minute)v.add_departure_timer(10,2019,1,30,20,30)# Delete a single departure timer index.v.delete_departure_timer(10)# Schedule repeated departure timer.schedule={"friday":False,"monday":True,"saturday":False,"sunday":False,"thursday":False,"tuesday":True,"wednesday":True}v.add_repeated_departure_timer(10,20,30,schedule)# Set wakeup timer (epoch millis)v.set_wakeup_time(1547845200000)# Cancel wakeup timerv.delete_wakeup_time()# Enable service mode (requires personal PIN)v.enable_service_mode("1234",1547551847000)# Enable transport mode (requires personal PIN)v.enable_transport_mode("1234",1547551847000)# Enable privacy modev.enable_privacy_mode("1234")# Disable privacy modev.disable_privacy_mode("1234")# Add charging period with specified index identifier value.v.add_charging_period(1,schedule,0,30,8,45)# Reverse geocodec.reverse_geocode(59.915475,10.733054)ExamplesThe examples directory contains example scripts that put jlrpy to good use.max_min_soc.pyThemax_min_soc.pyscript allows you to specify a desired maximum and minimum state of charge for the vehicle. Charging will be stopped once the maximum state of charge is reached and it will be started if the minimum state of charge is reached.charge_offpeak.pyThecharge_offpeak.pyscript allows you to specify a desired (off-peak) charging time period and maximum state of charge for the vehicle. Charging will be stopped if the vehicle is charging outside of the specified time period or once the maximum state of charge is reached and it will be started during the specified time period if the state of charge is below the maximum.