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

Setting charge mode started failing #1223

Open
slyoldfox opened this issue Jun 12, 2024 · 13 comments
Open

Setting charge mode started failing #1223

slyoldfox opened this issue Jun 12, 2024 · 13 comments

Comments

@slyoldfox
Copy link

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
Copy link
Author

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?

@Zaphod-dev
Copy link

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 ?...

@bizoo
Copy link

bizoo commented Jun 13, 2024

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...

@epenet
Copy link
Collaborator

epenet commented Jun 13, 2024

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?

@HomeACcessoryKid
Copy link

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

@slyoldfox
Copy link
Author

@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.

@epenet
Copy link
Collaborator

epenet commented Jun 13, 2024

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!!!

@slyoldfox
Copy link
Author

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

@HomeACcessoryKid
Copy link

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

@epenet
Copy link
Collaborator

epenet commented Jun 17, 2024

Anyone willing to open a PR?

@slyoldfox
Copy link
Author

slyoldfox commented Jun 23, 2024

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 🙄

@HomeACcessoryKid
Copy link

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

@epenet
Copy link
Collaborator

epenet commented Jun 28, 2024

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

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

5 participants