Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renault-api charge stop not working with Renault Zoe E-Tech R110 #763

Closed
mathieucarbou opened this issue Jan 5, 2023 · 18 comments
Closed

Comments

@mathieucarbou
Copy link
Contributor

Hello,
I need a way to remotely start and stop charging the car battery. I saw this api but it does not seem to work with my Zoe. I was wondering if there is a compatibility chart somewhere, and also if there is a way to remotely start/stop charging the Zoe R110.
Thanks!

> Downloads % renault-api status
lock status: VNEXT an internal error occured while processing request : 403 FORBIDDEN
res state: Access is denied for this resource
----------------  ------------------------------
Battery level     52 %
Last updated      2023-01-05 16:16:03
Available energy  22 kWh
Range estimate    161 km
Plug state        PlugState.PLUGGED
Charging state    ChargeState.CHARGE_IN_PROGRESS
Charge rate       0.07 kW
Time remaining    1005 min
Total mileage     1348.55 km
Fuel autonomy     0.0 km
Fuel quantity     0.0 L
GPS Latitude      
GPS Longitude    
GPS last updated  2023-01-05 11:15:15
HVAC status       off
----------------  ------------------------------

> Downloads % renault-api vehicle 
Registration    Brand    Model    VIN
--------------  -------  -------  -----------------
XXXXXXX         RENAULT  ZOE     XXXXXXXXXXXX

> Downloads % renault-api charge stop
{'action': 'stop'}

Charge does not stop.

@mathieucarbou mathieucarbou changed the title renault-api charge stop not working with Renault Zoe E-Tech R110 renault-api charge stop not working with Renault Zoe E-Tech R110 Jan 5, 2023
@epenet
Copy link
Collaborator

epenet commented Jan 5, 2023

There is no official documentation available, so it's all trial and error.

This is the list of all endpoints: https://renault-api.readthedocs.io/en/latest/endpoints.html
Some have notes (like https://renault-api.readthedocs.io/en/latest/endpoints.html#actions-hvac-start)

@mathieucarbou
Copy link
Contributor Author

Oh boy! I feel your pain!
So actually the current impl works with some cars, but, like the HVAC option, which is also not working on my Zoe from Home Assistant by the way, the stop charge action might also just not work / not be implemented for the Zoe E-Tech R110, or might work but with a different http call or payload, but we don't know ?

@epenet
Copy link
Collaborator

epenet commented Jan 5, 2023

Exactly...

If the "stop" action works from the phone app, and you are able to trace the API call, then I am happy to add it in.
However, my own trace tools have stopped working due to Android security settings so I can no longer trace the calls.

I really wish the API was properly documented by Renault!

@mathieucarbou
Copy link
Contributor Author

mathieucarbou commented Jan 5, 2023

I wish there were such button ;-) I can only start the HVAC, not even stop it :-(

If I want to test some requests the right way would be like that ?

> renault-api --debug --json http post /commerce/v1/accounts/<UUID>/kamereon/kca/car-adapter/v1/cars/<MY_VIN>/actions/charging-start {"data":{"type": "ChargingStart","attributes":{"action":"cancel"}}}

I have an error doing so:

 {"type":"FUNCTIONAL","messages":[{"code":"err.func.400","message":"{\"errors\":[{\"status\":\"Bad Request\",\"code\":\"400\",\"title\":\"Http message is not readable\"}]}"}],"errors":[{"errorCode":"err.func.400","errorMessage":"{\"errors\":[{\"status\":\"Bad Request\",\"code\":\"400\",\"title\":\"Http message is not readable\"}]}"}],"error_reference":"FUNCTIONAL"}
Error: ('err.func.400', 'Http message is not readable')

@mathieucarbou
Copy link
Contributor Author

ok but if I try with this payload, I don't get the error:" `'{"data":{"type": "ChargingStart","attributes":{"action":"stop"}}}'. So I guess the bad request is because the cancel action is wrong ;-) Got my answer I think.

@mathieucarbou
Copy link
Contributor Author

mathieucarbou commented Jan 7, 2023

@epenet : I have installed Mobilize Smart Charge.
And it turns out that, through this app, I can start a charge (what they call boost charge) and click on cancel after to stop it. And it actually works through the app. BUT...

  • The stop takes time because the request does not seem to be received by the vehicule immediately (I would say about 30 sec).
  • it can also fail if the rate limit is reached on the account, so the app displays that the charge has stopped, but it actually continues

Is there an easy way to capture the request done by the android phone ?

https://i.imgur.com/OhUC3DZ.png

@mathieucarbou
Copy link
Contributor Author

I've checked their APK. They have left the debug settings activated:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <debug-overrides>
        <trust-anchors>
            <certificates src="system" />
            <certificates src="user" />
        </trust-anchors>
    </debug-overrides>
</network-security-config>

So it should be possible to use an https proxy with a user certificate installed and trusted on android to decrypt all ssl com from the app.

@mathieucarbou
Copy link
Contributor Author

my attempt was not successful... So with HA, I am still able to auto start a charge, but not stop it :-(

@mathieucarbou
Copy link
Contributor Author

Com is done with these hosts. I think they have a B2B com.
image

@mathieucarbou
Copy link
Contributor Author

@epenet : I found a way to remotely stop the charge.

The trick is to charge_set_schedules service (I am using home assistant) and send a schedule with a duration of 1 minute. For example:

      schedules:
        - id: 1
          activated: true
          monday:
            startTime: T05:00Z
            duration: 1
          tuesday:
            startTime: T05:00Z
            duration: 1
          wednesday:
            startTime: T05:00Z
            duration: 1
          thursday:
            startTime: T05:00Z
            duration: 1
          friday:
            startTime: T05:00Z
            duration: 1
          saturday:
            startTime: T05:00Z
            duration: 1
          sunday:
            startTime: T05:00Z
            duration: 1

So I have a solution now to automatically start and stop the charge depending in the solar production.

@jumpjack
Copy link

You don't need to edit schedule: just change charge mode from/to always/scheduled to start/stop charge.

  • Start charge: charge mode = always
  • Stop charge: charge mode = scheduled

(Tested on Renault Captur plugin)

@epenet
Copy link
Collaborator

epenet commented Jan 17, 2023

I think it would be good if either of you could open a docs PR to indicate this.
Maybe also in the home-assistant renault docs

That would be appreciated.

@jumpjack
Copy link

@epenet : I have installed Mobilize Smart Charge.

I can't find it, can you post a link?

@mathieucarbou
Copy link
Contributor Author

You don't need to edit schedule: just change charge mode from/to always/scheduled to start/stop charge.

  • Start charge: charge mode = always
  • Stop charge: charge mode = scheduled

(Tested on Renault Captur plugin)

I wanted to use that (it's in this API). Sadly it is not available in Home Assistant to use for automations and scripts

image

And I don't know if there is a way to get it exposed in HA.

@mathieucarbou
Copy link
Contributor Author

@epenet : I have installed Mobilize Smart Charge.

I can't find it, can you post a link?

https://play.google.com/store/apps/details?id=com.renault.zesmartcharge

@epenet
Copy link
Collaborator

epenet commented Jan 17, 2023

I wanted to use that (it's in this API). Sadly it is not available in Home Assistant to use for automations and scripts

In Home Assistant it is not a service, it is a "select" entity. You should be able to set the charge mode value that way.

@mathieucarbou
Copy link
Contributor Author

mathieucarbou commented Jan 17, 2023

Oh! Thanks! I see it now... Within a script I have to choose the device, then the action and the choice appears.

But even if that works, I still prefer to send a schedule. At least this makes sure that this will work if someone has modified the schedule in the car. Also when using an app like Mobilize Smart Charge, it will modify the schedule plan, so just changing the charge mode might not be enough to trigger the stop of a charge.

@jumpjack
Copy link

@epenet : I have installed Mobilize Smart Charge.

I can't find it, can you post a link?

https://play.google.com/store/apps/details?id=com.renault.zesmartcharge

"Not available for any of your devices" :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants