控制捷豹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类之间并发性不一致的HashMap   插件如何在JavaSwing中使用UIManager和Classloader从外部jar安装外观?   java JasperReports:找不到子报表   在项目中找不到java生成的Javadoc文件   java BigDecimal。multiply()和divide()方法返回十六进制数。为什么?   java统计出现次数并从字符串中删除重复项   调用运算符时发生java NullPointerException   Spring和Hibernate之间的java配置错误   JavaZK将用户重定向回上一页   Javasocket为传出连接指定特定的网络接口   如果拖动到某个区域外,java Make按钮操作将被取消   如何在Eclipse for selenium 3.141.59中添加Java文档链接   java从匹配条件的数组中获取所有索引   docker未连接到RemoteWebDriver的java Gitlab ci selenium测试   java重写run方法   utf 8如何使用java解码UTF8编码的字符串?   java如何从eclipse调试部署在tomcat上的web应用程序?   将字母字符与前面没有百分号的Java正则表达式匹配