renault-api icon indicating copy to clipboard operation
renault-api copied to clipboard

Setting charge mode started failing

Open slyoldfox opened this issue 1 year ago • 13 comments

About a day or two ago, the /charge-mode endpoint started failing.

$ /renault-api --debug charge mode --set schedule_mode
WARNING:renault_api:Debug output enabled. Logs may contain personally identifiable information and account credentials! Be sure to sanitise these logs before sending them to a third party or posting them online.
DEBUG:renault_api.kamereon:Send Kamereon POST request to https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx/kamereon/kca/car-adapter/v1/cars/VIN/actions/charge-mode?country=BE with body: {"data": {"type": "ChargeMode", "attributes": {"action": "schedule_mode"}}}
DEBUG:renault_api.kamereon:Received Kamereon response 404 on POST to https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx/kamereon/kca/car-adapter/v1/cars/VIN/actions/charge-mode?country=BE: {"type":"FUNCTIONAL","messages":[{"code":"err.func.wired.not-found","message":"The specified url does not exist"}],"errors":[{"errorCode":"err.func.wired.not-found","errorMessage":"The specified url does not exist"}],"error_reference":"FUNCTIONAL"}
Error: ('err.func.wired.not-found', 'The specified url does not exist')

Retrieving still seems to work:

$ renault-api charge mode
Charge mode: schedule_mode

slyoldfox avatar Jun 12 '24 20:06 slyoldfox

This is on 0.2.3 by the way.

Also weird .. I had to revert hvacStatus back to hvacStatus: Optional[str] - is anyone else seeing this? Did they revert their change?

slyoldfox avatar Jun 12 '24 20:06 slyoldfox

Also weird .. I had to revert hvacStatus back to hvacStatus: Optional[str] - is anyone else seeing this? Did they revert their change?

I confirm that after having previously upgraded to 0.2.3 because of the hvacStatus change, I also just now had to revert int back to str - what the heck are they up to ?...

Zaphod-dev avatar Jun 12 '24 20:06 Zaphod-dev

This is on 0.2.3 by the way.

Also weird .. I had to revert hvacStatus back to hvacStatus: Optional[str] - is anyone else seeing this? Did they revert their change?

Same here, and same for set charge mode. Someone at Renault need to learn about managing api endpoint version...

bizoo avatar Jun 13 '24 12:06 bizoo

Yeah - it's infuriating!!! It's not specific to this project - even the phone app seems to be breaking every other day with their dodgy endpoint changes.

I'm happy to take a PR to revert the original change - but how long will it last?

epenet avatar Jun 13 '24 12:06 epenet

same here, though the error message, while similar, is slightly different

2024-06-13 18:05:36.998 Error: Captur: Retrieve Error: ('err.func.vcps.ev.charge-mode.error', '{"errors":[{"errorCode":"400000","errorMessage":"Content-Type is not supported","errorLevel":"error","errorType":"functional"}],"error_reference":"rrt-0c763753ae4cd3205-b-eu-18225-55842039-109"}')

Using this script for Domoticz: https://github.com/HomeACcessoryKid/Domoticz-Renault-Plugin which uses this repo api

HomeACcessoryKid avatar Jun 13 '24 16:06 HomeACcessoryKid

@epenet how do you debug the endpoint changes locally? Do you have a rooted android/iOS device to hook into this?

I don't mind digging deeper in the latest changes, just interested in how you keep up with their app (endpoint) changes.

slyoldfox avatar Jun 13 '24 20:06 slyoldfox

I no longer try to keep up. I originally used an https proxy but that no longer works so I rely on the community.

The worst part is that quite often even their app stops working!!!

epenet avatar Jun 13 '24 21:06 epenet

For reference I ended up downloading the My Renault android apk and uploading it to www.decompiler.com (https://www.decompiler.com/jar/591d0352c74840909291f718456bf807/base.apk), opened the decompiled code in Intellij CE.

I did find the endpoint and it doesn't seem to have changed (if indeed this is the last apk). While debugging it seems that this endpoint just started working again for me.

Is anyone else seeing this? @bizoo @HomeACcessoryKid @Zaphod-dev

slyoldfox avatar Jun 15 '24 13:06 slyoldfox

I still had issues, but just found the change in the json format. After fixing that, normal behaviour observed.

Up till recent, there was different vocabulary for reading (res) the chargeMode and for changing (cmd) the chargeMode. This has now been unified. The read vocabulary has been changed to use the change vocabulary.

so before:

        cmd={ self.CHARGE_ALWAYS:   "always_charging",
              self.CHARGE_SCHEDULED:"schedule_mode",
        res={ self.CHARGE_ALWAYS:   "always",
              self.CHARGE_SCHEDULED:"scheduled",

and now

        cmd={ self.CHARGE_ALWAYS:   "always_charging",
              self.CHARGE_SCHEDULED:"schedule_mode",
        res={ self.CHARGE_ALWAYS:   "always_charging",
              self.CHARGE_SCHEDULED:"schedule_mode",

PS. this is from my python script referenced before

HomeACcessoryKid avatar Jun 16 '24 10:06 HomeACcessoryKid

Anyone willing to open a PR?

epenet avatar Jun 17 '24 07:06 epenet

I'm at a loss what has changed to be honest :-) I am not sure if this has always been this way but there is a difference between:

response = await vehicle.get_charging_settings()
response2 = await vehicle.get_charge_mode()

The first one will return scheduled for response.mode while response2.chargeMode returns schedule_mode.

Likewise when you set it to Instant in the app, there is a difference:

Charge settings: always
Charge mode: always_charging

I was gonna comment on the hvacStatus - it seems it has gone back to a string, but right now I can't confirm since gigya is throwing me an invalid loginID and password 🙄

slyoldfox avatar Jun 23 '24 11:06 slyoldfox

for me there is a new error, but if I do not call vehicle.get_charges(now,now) then all works fine for me.

The key issue seems to be that MAYBE renault is using API versions, but we seem to tap into latest always. If anyone could find a valid versioned URL, then a lot of stability will return IMHO

HomeACcessoryKid avatar Jun 23 '24 14:06 HomeACcessoryKid

Side note: I have published a new release with a fix for hvacStatus

epenet avatar Jun 28 '24 09:06 epenet

There hasn't been any activity on this issue recently. Please make sure to update to the Renault API version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Apr 24 '25 12:04 github-actions[bot]

Closing this in favour of #1708

slyoldfox avatar Sep 21 '25 10:09 slyoldfox