audi_connect_ha icon indicating copy to clipboard operation
audi_connect_ha copied to clipboard

Start/Stop/Timed Charging Not Working

Open devslash0 opened this issue 1 year ago • 21 comments

Anyone got start_charger and stop_charger to work?

I can lock and unlock, but when i try to setup smart charging with home assistant i get:

2024-02-17 18:38:05.713 ERROR (MainThread) [custom_components.audiconnect.util] Unable to stop charger of vehicle XXX: Cannot stop charger, return code 'failed'

Running:

service: audiconnect.execute_vehicle_action data: vin: XXX action: 'stop_charger'

XXX is my VIN.

devslash0 avatar Feb 17 '24 17:02 devslash0

Try latest.

cdnninja avatar Mar 05 '24 16:03 cdnninja

Same, but new error message:

2024-03-05 17:32:48.897 ERROR (MainThread) [custom_components.audiconnect.util] Unable to start charger of vehicle XXX: 403, message='', url=URL('https://msg.volkswagen.de/fs-car/bs/batterycharge/v1/Audi/DE/vehicles/XXX/charger/actions') 2024-03-05 17:33:00.451 ERROR (MainThread) [custom_components.audiconnect.util] Unable to start charger of vehicle XXX: 403, message='', url=URL('https://msg.volkswagen.de/fs-car/bs/batterycharge/v1/Audi/DE/vehicles/XXX/charger/actions') 2024-03-05 17:33:20.668 ERROR (MainThread) [custom_components.audiconnect.util] Unable to stop charger of vehicle XXX: 403, message='', url=URL('https://msg.volkswagen.de/fs-car/bs/batterycharge/v1/Audi/DE/vehicles/XXX/charger/actions') 2024-03-05 17:33:29.862 ERROR (MainThread) [custom_components.audiconnect.util] Unable to start charger of vehicle XXX: 403, message='', url=URL('https://msg.volkswagen.de/fs-car/bs/batterycharge/v1/Audi/DE/vehicles/XXX/charger/actions')

VIN replaced with XXX.

devslash0 avatar Mar 05 '24 16:03 devslash0

Any update on the issue? I am wondering if start stop charging is actually working for someone.

DutchKillerbee avatar Apr 15 '24 18:04 DutchKillerbee

Is start_charger working, but stop_charging isn't? Can you provide logs during the service call?

coreywillwhat avatar Apr 15 '24 18:04 coreywillwhat

None of them work. Testet start_charging, stop_charging and start_timed_charging during the weekend. My car is not connected at the moment (at work), so I can provide logs)

.. few hours later. The error message in my logs are the same as above. 403 error.

devslash0 avatar Apr 16 '24 06:04 devslash0

I can tell that start stop charging is working for me! I am using version 1.6.2 I by coincident removed the pin code protection of my account in my car (Q3 tfsie) and after that it seems to be working! So I assume when you protected your account in your car with a pin code in some way you need to send the pin code as well Part of my debug log

2024-04-17 19:58:53.446 DEBUG (MainThread) [custom_components.audiconnect.audi_connect_account] Sending command to start charger to vehicle *************3327
2024-04-17 19:59:13.971 DEBUG (MainThread) [custom_components.audiconnect.audi_connect_account] Successfully started charger of vehicle *************3327
2024-04-17 19:59:13.972 DEBUG (MainThread) [custom_components.audiconnect.audi_connect_account] Sending command to refresh vehicle data for VIN: *************3327
2024-04-17 19:59:14.049 DEBUG (MainThread) [custom_components.audiconnect.audi_connect_account] ClientResponseError with status 403 while refreshing vehicle data for VIN: *************3327. Disabling refresh vehicle data support.
2024-04-17 19:59:14.049 DEBUG (MainThread) [custom_components.audiconnect.audi_account] Refresh vehicle data is disabled for VIN: *************3327
2024-04-17 19:59:14.049 DEBUG (MainThread) [custom_components.audiconnect.audi_account] Requesting to refresh cloud data in 5 seconds...

I could only see a 403 error message...

DutchKillerbee avatar Apr 17 '24 18:04 DutchKillerbee

Thank you for this @DutchKillerbee! this is a great hint towards a solution. We'll have to look into how this service call is implemented. Wondering if you could provide more information about the PIN though:

  • When you had the PIN implemented on your account, did you have to enter it to start the charger?
  • If so, was that always the case, or did that recently change?

Thanks for your help!

coreywillwhat avatar Apr 22 '24 18:04 coreywillwhat

Hmm. I have two Audi Accounts. The one i use in HA is a guest account, and I see now that "remote charging" is only visable in the main user. I'll try to swap to my main user and test again.

devslash0 avatar Apr 23 '24 13:04 devslash0

Testet with main account, still 403 error :/ I have my PIN entered in HA.

devslash0 avatar Apr 23 '24 14:04 devslash0

@coreywillwhat Sorry for my late response but let me try to describe what happened.

At a certain day (I forgot what day) I had to login with my audi account in my car profile! The message was something like "your account has not been used for a while. Please login" Funny I used my car the day before. I didn't have my credentials by hand so I used the profile of my son. Both profile didn't have a pincode. The day after I logged in my car with my credentials and all seems to be fine. But Audi forced me to set a pin code to protect my profile. I added a pin code and later I removed it again. In my car everything is back to normal now. My profile is working and also all the other users profiles/accounts in my car.

Since that moment start/stop charging is working for me! Still I have a pin code configured in the HA integration, but I think this is another pincode than the pincode in your car (to protect anybody else using your profile)

To be honest I don't know if there is any relation what I did but I can tell that start/stop charging is working for me now

If I can help you providing some logs/other stuff please let me know.

DutchKillerbee avatar Apr 25 '24 07:04 DutchKillerbee

Some additional (maybe helpful) information:

  • I have set timed charging on as well (using the app) Everyday at 7:50
  • Audi Q3 tfsi-e

DutchKillerbee avatar Apr 25 '24 12:04 DutchKillerbee

Thank you so much @DutchKillerbee this is great information. I took a look and it doesn't look like we're passing a PIN for setting the vehicle charger, which would explain why removing your PIN from the Audi Vehicle Account might allow it to work. I can see if implementing the same method as used in "lock"/"unlock", will fix it.

The problem is, I can't test this, and there is a chance any changes will break your ability to use it without a PIN @DutchKillerbee . At least until we get the chance to revert it back. I would rather test this prior to pushing to the master branch. If I draft up a PR, would either @DutchKillerbee or @devslash0 be willing to test the code before we push to the master branch?

coreywillwhat avatar Apr 25 '24 20:04 coreywillwhat

An additional question: What region are each of you? NA, EU, etc..

coreywillwhat avatar Apr 25 '24 20:04 coreywillwhat

I can test yes :) available this weekend. EU (Norway)

devslash0 avatar Apr 26 '24 04:04 devslash0

@coreywillwhat EU Netherlands. Ready to do some tests. Probably I will have to alter the files manually or could you prep a command to apply this patch to the current code. Currently running 1.7.0

DutchKillerbee avatar Apr 26 '24 07:04 DutchKillerbee

If need be, I can test as well. Audi Q4 etron, EU BE

harmendp avatar Apr 26 '24 13:04 harmendp

@coreywillwhat EU Netherlands. Ready to do some tests. Probably I will have to alter the files manually or could you prep a command to apply this patch to the current code. Currently running 1.7.0

We've debated a beta release, but it would complicate the auto-release schedule, so we haven't made any decisions on that yet. For testing, I would suggest using Studio Code Server add-on in HA to modify files/lines for testing based on the PR. It will be more clear what needs to be done when I actually put the PR together and you can take a look.

I've run into an issue with this update though, as I'm in the US, and my car doesn't support start/stop/timed charging, I won't be able to figure out the action required for the S-PIN security token.

@t0bias-r I'm not sure if you can help out here.... @DutchKillerbee is reporting that removing the SPIN from their audi account allows them to use the execute vehicle action to start/stop the charger. Looking at set_battery_charger it doens't look like we're using a security_token for this. If it is required for starting/stopping the charger, then we need to add it similar to the set_vehicle_lock. The only piece i think we're missing would be the action for the _get_security_token(). Is the action something you could help figure out?

coreywillwhat avatar Apr 26 '24 23:04 coreywillwhat

@t0bias-r I'm not sure if you can help out here.... @DutchKillerbee is reporting that removing the SPIN from their audi account allows them to use the execute vehicle action to start/stop the charger. Looking at set_battery_charger it doens't look like we're using a security_token for this. If it is required for starting/stopping the charger, then we need to add it similar to the set_vehicle_lock. The only piece i think we're missing would be the action for the _get_security_token(). Is the action something you could help figure out?

@coreywillwhat I try to help :-) Just so I'm doing the right thing. I need to capture the API request for an action that requires the SPIN, right?

t0bias-r avatar Apr 29 '24 09:04 t0bias-r

thank you @t0bias-r! Yes, specifically the start/stop/timed charging action, if you can.

coreywillwhat avatar Apr 29 '24 15:04 coreywillwhat

No matter which charging setting I change or charing action is execute (timer, immediately) in the app, I never have to enter the SPIN (for my Q8 etron). I just need the SPIN for locking and unlocking the car.

Here are the API calls: audi-car-locking.txt

What I don't currently know is which internal (security) calls are used for the challenge-response and for the hashing....

t0bias-r avatar May 03 '24 07:05 t0bias-r

Same for me, start charging does not work anymore for a while. Willing to test / share logs if needed. A3 Etron

TFhdKi95ae8L avatar May 10 '24 18:05 TFhdKi95ae8L

Same for me, start charging does not work anymore for a while. Willing to test / share logs if needed. A3 Etron

Started working again. Not sure since which version, but at least as from latest 1.10.4, maybe even 1 earlier.

TFhdKi95ae8L avatar Nov 11 '24 10:11 TFhdKi95ae8L

Same here :/

2024-11-11 11:36:21.203 ERROR (MainThread) [custom_components.audiconnect.util] Unable to start charger of vehicle xxx: 403, message='', url='https://msg.volkswagen.de/fs-car/bs/batterycharge/v1/Audi/DE/vehicles/xxx/charger/actions'

Same with stop and start_timed

thomas-hass avatar Nov 11 '24 10:11 thomas-hass

This issue is stale because it has been open for 45 days with no activity. Are you still experiencing this issue?

github-actions[bot] avatar Feb 11 '25 02:02 github-actions[bot]

Any update here? :)

thomas-hass avatar Feb 23 '25 14:02 thomas-hass

Hope we can do some work soon on this issue :D

ERROR (MainThread) [custom_components.audiconnect.util] Unable to start charger of vehicle xxx: 403, message='', url='https://msg.volkswagen.de/fs-car/bs/batterycharge/v1/Audi/DE/vehicles/xxx/charger/actions'

thomas-hass avatar Mar 26 '25 13:03 thomas-hass

with the new version I get a new Error, not 403 anymore, now I get this one if I try to start charging (A3 etron):

2025-03-26 17:34:16.335 ERROR (MainThread) [custom_components.audiconnect.util] Unable to start charger of vehicle XXXXX: 421, message='Misdirected Request', url='https://fal-3a.prd.eu.dp.vwg-connect.com/fs-car/bs/batterycharge/v1/Audi/DE/vehicles/XXXXX/charger/actions'

fischlein86 avatar Mar 26 '25 16:03 fischlein86

No updates were made in the new versions, so any response changes are on Audi side.

That said, if you'd like to test #558 it would be helpful. Potentially fixes execute vehicle action > start charger.

I'm having a hard time keeping track of all the request info, so this was a quick first pass. I need to go through all the issues and collate the data into the wiki for easy reference.

coreywillwhat avatar Mar 26 '25 18:03 coreywillwhat

I can try more tomorrow, late here now. But as far as i can see my line 543 are different than the patch. I have the latest version from HACS.

The URL is also different. Searched trough the code and I only find emea.bff.cariad.digital regarding to climatisation

thomas-hass avatar Mar 26 '25 20:03 thomas-hass

Tried to copy the whole file and are now getting:

2025-03-26 21:09:00.864 ERROR (MainThread) [custom_components.audiconnect.util] Unable to start charger of vehicle wauzzzge9kb016351: 403, message='Forbidden', url='https://emea.bff.cariad.digital/vehicle/v1/vehicles/xxx/charging/mode'

thomas-hass avatar Mar 26 '25 20:03 thomas-hass