ricott / homey-com.volvocars

Volvo On Call app for Homey
https://apps.athom.com/app/com.volvocars
GNU General Public License v3.0
9 stars 5 forks source link

Request - Delay charging and start charing override #6

Closed kriborg closed 4 years ago

kriborg commented 4 years ago

Hi

Can you add this to your app, so we can control charging :)

First you need to add charging location in the Volvo ON-call-app

  1. Get charging locations https://vocapi.wirelesscar.net/customerapi/rest/v3.0/vehicles//chargeLocations?status=Accepted GET { "chargingLocations": [ { "chargeLocation": "https://vocapi.wirelesscar.net/customerapi/rest/v3.0/vehicles//chargeLocations/", "name": null, "plugInReminderEnabled": true, "position": { "longitude": xx.xxx, "latitude": xx.xxx, "streetAddress": "Street a", "postalCode": "5555", "city": "CITY", "ISO2CountryCode": "US", "Region": "Region" }, "delayCharging": { "enabled": true, "startTime": "00:40", "stopTime": "06:33" }, "status": "Accepted", "vehicleAtChargingLocation": true } ] }

  2. Set charging delay - this will pause the charging in the car when you connect it at the location https://vocapi.wirelesscar.net/customerapi/rest/v3.0/vehicles//chargeLocations/ PUT

Content: { "status": "Accepted", "plugInReminderEnabled": true, "delayCharging": { "enabled": true, "startTime": "00:31", "stopTime": "06:33" } }

  1. Override - start charing https://vocapi.wirelesscar.net/customerapi/rest/v3.0/vehicles//rbm/overrideDelayCharging POST
ricott commented 4 years ago

Hi!

Thanks for this! I started looking at this a while ago I see, but never completed it. I will think a little on how this can look like. Listing existing charging locations I just finalized, was the code I had started before.

Should we use geo-coordinates to automatically select the location which is to be treated at home? Or should the user be able to select which charging location is home?

The delay charging part, the time passed as start/stop I guess must be in the early morning timeframe, thinking of the Tibber use case when you want to start charging when electricity is the cheapest during the night.

Thinking about it a little more, maybe this should simply be two actions, delay charging and start charging. You need to select charging location from a drop-down (we can populate that dynamically). For delay action, you enter start and stop time. What do you think?

ricott commented 4 years ago

Learned a little more by testing

  1. Ok, works as expected

  2. Ok, possible to update a charge location and set delayed charging to true, and assign a time window. I'm guessing this works as expected, once the start time is passed charging will start automatically.

  3. Works technically, but I am unsure about what it actually does. It seems to communicate with the car directly since it responds with a service link that you need to poll to see the success or failure of the command. I don't know if this works everywhere, any charging location? It doesn't update the delayed charging since it still says true, so I don't know if there is a way to cancel or once you have run this command there is no way to stop charging?

Creating a charge location and setting delayed charging to true seems like a one-time thing then, assuming you don't want to build the full Tibber flow. When you plugin at home you want to charge until you have say 30%, then pause charging and charge fully during the night with the cheapest electricity.

You would start with delayed charging = false, then use a trigger and check when battery percentage is above 30, then you invoke delay charging and set delayed charging = true. Charging stops, then at night using some app to know when electricity is the cheapest you run start charging to fully charge the car. I guess this is a decent flow and possible to implement by exposing the two actions I mentioned above.

ricott commented 4 years ago

v1.0.8 TEST version is now available with these actions. Let me know what you think! https://homey.app/a/com.volvocars/test/

kriborg commented 4 years ago

Wow, this is great work ricott. I will for sure test your version 1.0.8 , ASAP :)

"Works technically, but I am unsure about what it actually does. It seems to communicate with the car directly since it responds with a service link that you need to poll to see the success or failure of the command. I don't know if this works everywhere, any charging location? It doesn't update the delayed charging since it still says true, so I don't know if there is a way to cancel or once you have run this command there is no way to stop charging?"

My guess is that this will work on any charging location , but only if the car has been setup with an delayed charging schedule.

If you unplug the charger after you have sent the overrideDelayCharging , it will still delay it after you have re-plugged the charger. It does not affect the schedule set for that charging location.

I'm pretty sure Volvo also have a overrid-pause-charging direct api call, as I have seen this in previous versions of the APP. But hard to figure out the commands without the old app version :)