volvo2mqtt icon indicating copy to clipboard operation
volvo2mqtt copied to clipboard

New endpoints in Energy API

Open FireWizard52 opened this issue 11 months ago • 10 comments

@Dielee,

Hi Linus,

For your information!

  1. Volvo actually activated 2FA, today at approx. 11 h. If you log-out from your Volvo Cars app and log-in afterwards a Volvo ID-verification code has to be submitted. This code you receive by email ( maybe sms as well ??).

  2. New endpoints for new functionality in the Energy API. See the Energy API, but new are:

  • Get charging current limit
  • Get target battery charge level

However, these new endpoints have also new "scopes" (energy:charging_current_limit and energy:target_battery_level) These scopes are not in the list of scopes and so I have not been able to test already.

Regards

FireWizard52 avatar Mar 18 '24 15:03 FireWizard52

Yeah, thanks for this information.

  1. I already developed the 2FA login for my plugin. Are you able to test the changes ?

  2. I will take a look the the new endpoints tomorrow. If they work, I will add two new sensors.

Dielee avatar Mar 18 '24 15:03 Dielee

Hi Linus, you said:

I already developed the 2FA login for my plugin. Are you able to test the changes ?

I saw it, and that you wanted also testers, but as you maybe know I do not use Home Assistant and I'm not a big fan of Docker either. So I'm afraid I will not be of much help.

I work with Node RED and all my automation's are done with that, but as I push them to MQTT, more or less all Home Automation system can be used. Regarding this 2FA I currently work in a little bit different direction.

  1. Check the output from the Volvo Server and in case the Volvo ID verification code is requested, I
  2. Check my email and
  3. Parse the verification code
  4. Put it into the verification flow on the right place.

But cannot test it yet, as Volvo ID server is not working

But let me know if the new sensors work, as my PHEV is still not supported.

Regards

FireWizard52 avatar Mar 18 '24 16:03 FireWizard52

Check the output from the Volvo Server and in case the Volvo ID verification code is requested, I Check my email and Parse the verification code Put it into the verification flow on the right place

This is what I have done with my last changes.

Dielee avatar Mar 18 '24 16:03 Dielee

I'm happy to support with testing if needed.

BertilJ avatar Mar 19 '24 07:03 BertilJ

@FireWizard52, I am also using this Tool without HA and without Docker. I just used the folder src and entered my data manually in the const file. Not a big issue.

schrej-zz avatar Mar 24 '24 08:03 schrej-zz

I'm also happy to Support.

schrej-zz avatar Apr 06 '24 13:04 schrej-zz

The new endpoint scopes are currently not working. Sorry guys, we have to wait.

The requested scope is invalid, unknown, malformed, or exceeds that which the client is permitted to request.

Dielee avatar Apr 08 '24 08:04 Dielee

This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days.

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

Keep it open.

schrej-zz avatar Apr 24 '24 05:04 schrej-zz

This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar May 11 '24 00:05 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar May 16 '24 00:05 github-actions[bot]

Hi Dielee,

The new endpoints should be available and work now. Would you be so kind to update the endpoints?

{ "status": 200, "data": { "chargingCurrentLimit": { "value": "32", "unit": "ampere", "timestamp": "2024-05-17T17:42:30Z" } },

mhpleite avatar Jul 04 '24 18:07 mhpleite

Hi Dielee,

The new endpoints should be available and work now. Would you be so kind to update the endpoints?

{ "status": 200, "data": { "chargingCurrentLimit": { "value": "32", "unit": "ampere", "timestamp": "2024-05-17T17:42:30Z" } },

Still does not work at my end. When generating a token for scope energy:charging_current_limit or energy:target_battery_level I still get response:

{
    "error_description": "The requested scope is invalid, unknown, malformed, or exceeds that which the client is permitted to request.",
    "error": "invalid_scope"
}

I only get it working when generating test access tokens on developer.volvocars.com

gurtjun avatar Jul 04 '24 19:07 gurtjun

Hi Dielee, The new endpoints should be available and work now. Would you be so kind to update the endpoints? { "status": 200, "data": { "chargingCurrentLimit": { "value": "32", "unit": "ampere", "timestamp": "2024-05-17T17:42:30Z" } },

Still does not work at my end. When generating a token for scope energy:charging_current_limit or energy:target_battery_level I still get response:

{
    "error_description": "The requested scope is invalid, unknown, malformed, or exceeds that which the client is permitted to request.",
    "error": "invalid_scope"
}

I only get it working when generating test access tokens on developer.volvocars.com

Is this small signal that these would be released for production use also considering the past - what is your take on this?

quenthal avatar Jul 15 '24 05:07 quenthal

Hi Dielee. Thanks for your work on this add on, I know it cannot be easy, given how difficult Volvo's API is. When testing on the Volvo website, it generates a 401 result more often than a 200 result for the same details.

However, I can access the full energy API (recharge-status) pasted below. So happy to help test if you are able to get access to it.

Many thanks.

Request: curl -X 'GET'
'https://api.volvocars.com/energy/v1/vehicles/[MY IN]/recharge-status'
-H 'accept: application/vnd.volvocars.api.energy.vehicledata.v1+json'
-H 'vcc-api-key: [API KEY]'
-H 'Authorization: Bearer [redacted]

Response: { "status": 200, "data": { "estimatedChargingTime": { "value": "0", "unit": "minutes", "timestamp": "2024-08-13T18:32:33Z" }, "targetBatteryChargeLevel": { "value": "80", "unit": "percentage", "timestamp": "2024-08-10T07:48:10Z" }, "chargingCurrentLimit": { "value": "32", "unit": "ampere", "timestamp": "2024-08-03T10:06:28Z" }, "batteryChargeLevel": { "value": "79.0", "unit": "percentage", "timestamp": "2024-08-13T18:32:33Z" }, "electricRange": { "value": "320", "unit": "kilometers", "timestamp": "2024-08-13T18:32:33Z" }, "chargingSystemStatus": { "value": "CHARGING_SYSTEM_IDLE", "timestamp": "2024-08-13T18:32:33Z" }, "chargingConnectionStatus": { "value": "CONNECTION_STATUS_DISCONNECTED", "timestamp": "2024-08-13T18:32:33Z" } }, "operationId": "d556b6dd-3afb-4aeb-b93c-56d3ebd3dea4" }

malrogers7 avatar Aug 14 '24 07:08 malrogers7

Hi Dielee. Thanks for your work on this add on, I know it cannot be easy, given how difficult Volvo's API is. When testing on the Volvo website, it generates a 401 result more often than a 200 result for the same details.

However, I can access the full energy API (recharge-status) pasted below. So happy to help test if you are able to get access to it.

Many thanks.

Request: curl -X 'GET' '[https://api.volvocars.com/energy/v1/vehicles/MY IN]/recharge-status' -H 'accept: application/vnd.volvocars.api.energy.vehicledata.v1+json' -H 'vcc-api-key: [API KEY]' -H 'Authorization: Bearer [redacted]

Response: { "status": 200, "data": { "estimatedChargingTime": { "value": "0", "unit": "minutes", "timestamp": "2024-08-13T18:32:33Z" }, "targetBatteryChargeLevel": { "value": "80", "unit": "percentage", "timestamp": "2024-08-10T07:48:10Z" }, "chargingCurrentLimit": { "value": "32", "unit": "ampere", "timestamp": "2024-08-03T10:06:28Z" }, "batteryChargeLevel": { "value": "79.0", "unit": "percentage", "timestamp": "2024-08-13T18:32:33Z" }, "electricRange": { "value": "320", "unit": "kilometers", "timestamp": "2024-08-13T18:32:33Z" }, "chargingSystemStatus": { "value": "CHARGING_SYSTEM_IDLE", "timestamp": "2024-08-13T18:32:33Z" }, "chargingConnectionStatus": { "value": "CONNECTION_STATUS_DISCONNECTED", "timestamp": "2024-08-13T18:32:33Z" } }, "operationId": "d556b6dd-3afb-4aeb-b93c-56d3ebd3dea4" }

Did you do the request via Volvo's Developer Portal? When I request a bearer token for scope energy:target_battery_level I still get the following response:

{
    "error_description": "The requested scope is invalid, unknown, malformed, or exceeds that which the client is permitted to request.",
    "error": "invalid_scope"
}

gurtjun avatar Aug 14 '24 07:08 gurtjun

Yes, on the Volvo Developer Portal here: https://developer.volvocars.com/apis/energy/v1/specification/

malrogers7 avatar Aug 14 '24 08:08 malrogers7

Yes, on the Volvo Developer Portal here: https://developer.volvocars.com/apis/energy/v1/specification/

Please read the comments above, that's a known issue

gurtjun avatar Aug 14 '24 08:08 gurtjun

Ok. I did read them, but it wasn't clear to me, so thought I'd try to help.

malrogers7 avatar Aug 14 '24 08:08 malrogers7

Ok. I did read them, but it wasn't clear to me, so thought I'd try to help.

Sadly we can't do anything about it I believe, waiting for Volvo to fix this.

gurtjun avatar Aug 14 '24 08:08 gurtjun