控制捷豹i-pace

jlrp的Python项目详细描述


jlrpy

Join the chat at https://gitter.im/jlrpy/community

用于与JLR远程汽车API交互的Python3库。

文档

JLR InControl API的相关API文档对于任何想要使用此项目的人来说都是一本不错的读物。它目前可用here

安装

直接签出这个存储库或通过pip安装(对于python3)。

pip install jlrpy

用法

首先,实例化一个Connection对象,并传递与捷豹InControl智能驭享帐户相关的电子邮件地址和密码。

有两种方法可以对InControl进行身份验证。使用用户名和密码或使用有效的刷新令牌。

JLR API要求注册设备ID(Uuid4格式)。如果在实例化Connection对象时没有指定一个对象,它将自动为您的对象生成一个新对象。

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.vehicles将列出与您的帐户关联的所有车辆。

# 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()# 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)

示例

examples目录包含使jlrpy得到良好使用的示例脚本。

最大最小荷电比

^ {< CD5>}脚本允许您指定车辆所需的最大和最小充电状态。一旦达到最大充电状态,充电将停止,如果达到最小充电状态,充电将开始。

非峰荷Py<^ > ^ {CD6>}脚本允许您指定一个所需的(非高峰)充电时间和车辆的最大充电状态。如果车辆在规定的时间段内充电或一旦达到最大充电状态,充电将停止,如果充电状态低于最大值,充电将在规定的时间内启动。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java内存管理:使用各种方法保存静态/非静态对象,直到结束   在Wicket 9中的java中,当用户的会话在某些页面中过期时,它们将被重定向到登录页面,而不是会话过期页面   夏令时plusHours和plusDays之间的java JodaTime差异   java中的oracle Fetch pl/sql数组返回值   java我如何知道“程序文件”在哪里?   在Java中如何从字符串中修剪文件扩展名?   函数Java从泛型类对象获取方法   netbeans用java制作一款基本游戏,jFrame form vs jFrame   Java代理服务器在切换服务器时保持客户端连接活动   Java json从url到jcombobox获取数据   当我的JAXRS应用程序无法发送响应时,我可以记录java日志吗?(怎么做?)   爪哇什么是太阳。反映CallerSensitive注释是什么意思?   java处理多次按键忽略重复按键   java Spring会话Redis如何配置RedistemAlte以使用jackson序列化器/反序列化器   java为带有“&”字符的字符串创建XMLStreamReader   java Lanterna如何创建简单的复选框菜单?   java从Office365发送javamail v.s.gmail:有什么不同?   java自动包含另一个maven项目的子模块