Package: aiojlrpy
aiojlrpyPython 3 Async library for interacting with the JLR Remote car rest and websocket APIs.InstallationEither check out this repository directly or install through pip (for Python3).pip install aiojlrpyUsageNOTE:  This is an async library, therefore must be run in a running event loop.To 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. However, it is highly recommended to provide a consistant device ID for your connection, especially if using the websocket function.InControl provides 2 different APIs.REST API
The main api to get vehicle data and perform actions on your account/vehicleWebsocket API
A push api that provides messages when things happen on your vehicle for service calls and things which update status attributes and alerts.  A status message is formatted from the library into a strucutred StatusMessage class object.fromaiojlrpyimportConnection,Vehicle,StatusMessage# Authenticate just the rest api using the username, password.c=Connection(EMAIL,PWD,device_id=DEVICEID,)awaitc.connect()v=c.vehicles[0]# Authenticate and enable the websocket connection (highly recommended to provide a fixed device id here).# on_message is a callback function in your code to receive websocket messagesc=Connection(EMAIL,PWD,device_id=DEVICE_ID,ws_message_callback=on_message,)awaitc.connect()asyncdefon_message(message:StatusMessage):print(message)# Authenticate using a refresh token (username must still be specified)c=Connection(email='my@email.com',refresh_token='124c3f21-42ds-2e4d-86f8-221v32392a1d')awaitc.connect()Connection.vehicleswill list all vehicles associated with your account.# Get user informationawaitc.get_user_info()# Update user information.p=awaitc.get_user_info()p['contact']['userPreferences']['unitsOfMeasurement']="Km Litre Celsius VolPerDist Wh DistPerkWh"awaitc.update_user_info(p)# Refresh access tokenawaitc.refresh_tokens()# Get attributes associated with vehicleawaitv.get_attributes()# Get current status of vehicleawaitv.get_status()# Get current active servicesawaitv.get_services()# Optionally, you can also specify a status value keyawaitv.get_status("EV_STATE_OF_CHARGE")# Get subscription packesawaitv.get_subscription_packages()# Get trip data (last 1000 trips).awaitv.get_trips()# Get data for a single trip (specified with trip id)awaitv.get_trip(121655021)# Get vehicle health statusawaitv.request_health_status()# Get departure timersawaitv.get_departure_timers()# Get configured wakeup timeawaitv.get_wakeup_time()# Honk horn and blink lightsawaitv.honk_blink()# Get current position of vehicleawaitv.get_position()# Start preconditioning at 21.0Cawaitv.preconditioning_start("210")# Stop preconditioningawaitv.precenditioning_stop()# Set vehicle nickname and registration numberawaitv.set_attributes("Name","reg-number")# Lock vehicleawaitv.lock(pin)# pin being the personal master pin# Unlock vehicleawaitv.unlock(pin)# Reset alarmawaitv.reset_alarm(pin)# Start chargingawaitv.charging_start()# Stop chargingawaitv.charging_stop()# Set max soc at 80% (Requires upcoming OTA update)awaitv.set_max_soc(80)# Set max soc for current charging session to 90% (Requires upcoming OTA update)awaitv.set_one_off_max_soc(90)# Add single departure timer (index, year, month, day, hour, minute)awaitv.add_departure_timer(10,2019,1,30,20,30)# Delete a single departure timer index.awaitv.delete_departure_timer(10)# Schedule repeated departure timer.schedule={"friday":False,"monday":True,"saturday":False,"sunday":False,"thursday":False,"tuesday":True,"wednesday":True}awaitv.add_repeated_departure_timer(10,20,30,schedule)# Set wakeup timer (epoch millis)awaitv.set_wakeup_time(1547845200000)# Cancel wakeup timerawaitv.delete_wakeup_time()# Enable service mode (requires personal PIN)awaitv.enable_service_mode("1234",1547551847000)# Enable transport mode (requires personal PIN)awaitv.enable_transport_mode("1234",1547551847000)# Enable privacy modeawaitv.enable_privacy_mode("1234")# Disable privacy modeawaitv.disable_privacy_mode("1234")# Add charging period with specified index identifier value.awaitv.add_charging_period(1,schedule,0,30,8,45)# Reverse geocodeawaitc.reverse_geocode(59.915475,10.733054)ExamplesThe examples directory contains example scripts that put aiojlrpy to good use. #TODOCreditsHuge shout out to @ardedv for his tremendous work in jlypy which this library uses as a base.