ScottHelme / AlexaNissanLeaf

An Alexa Skill to control the Nissan Leaf
48 stars 19 forks source link

Add "Ask my car to charge to X%" intent #12

Closed filcole closed 7 years ago

filcole commented 7 years ago

Would be great to be able to charge to a certain percentage, i.e. 80% so that it doesn't fully charge to 100% and potentially wear the battery out. Thoughts on how to do this:

1) Add new "ChargeUpto" intent with a percentage slot to hold the percentage. Maybe store the Alexa user id, vin number, in a DynamoDB along for persistence

2) Somehow poll the car on a regular basis to check for the charge. Maybe via a timed/scheduled Lambda function; poll the car, check the charge level and charging status of the car, update the DynamoDB, compare the status against the target status, if greater then stop charging. If car status <> charging, or charge > target status then remove row from Dynamo db. (Perhaps would need to store login credentials in Dynamo DB in order to perform future checks.)

3) Would need to update the charge status to check if charging up to a limit, so that Alexa can say "The car is currently charging at 50% and will stop at 80%". Guesstimating time to charge to 80% could be difficult, but could use charge time to 100% as a very rough guide.

Would be great if could detect if the car has moved, so that can cancel the charge up to command. The API doesn't seem to return the location of the car, so I'm guessing the Leaf Manager android app only manages this through the GPS on the phone and the bluetooth connection. However Nissan know the location of the car on their website, so it might be possible to scrape it from there (yuk).

ScottHelme commented 7 years ago

To my knowledge, there is no way to stop the car charging using the API once a charge has been initiated. It will charge all the way to 100%.

The only way to stop this happening is using the controls within the vehicle itself. You can set the car to charge to 80% or 100% but this applies to all charges and there is no way to stop or change it remotely.

filcole commented 7 years ago

After looking around the API docs on the internet and the apps/websites for NissanConnect I too can't seem to find a way to stop a charge. Next best alternative would be get the car charged to a certain point by a certain time, but that's a whole different prospect. So I'll close this issue. Thanks for replying and considering though.