ardevd / jlrpy

Python library for interacting with the JLR Remote Car API
MIT License
84 stars 29 forks source link

Added function to add charging period. #27

Closed ardevd closed 5 years ago

ardevd commented 5 years ago

Ok, things get a bit weird here, but I've added a function to add a charging period. The API seems to indicate that you can define multiple but I don't know if that's actually the case. Again, this implementation is based on how the mobile app does things and from what I can tell, it seems to always add the following tariffZone entry unless you specify 00:00 as the from time.

{"zoneName":"TARIFF_ZONE_C","bandType":"PEAK","endTime":{"hour":0,"minute":0}}

At any rate, you can try to add a charging period as follows on a Vehicle object. The following example would set add a repeated charging period from 01:30 to 08:45 on monday, tuesday and wednesdays.

schedule = {"friday":false,"monday":true,"saturday":false,"sunday":false,"thursday":false,"tuesday":true,"wednesday":true}
v.add_charging_period(1, schedule, 1, 30, 8, 45)