Dielee / volvo2mqtt

Home Assistant addon for connecting AAOS Volvos
MIT License
127 stars 25 forks source link

Climate / Engine remote start #118

Closed ChristianNiklasson closed 6 months ago

ChristianNiklasson commented 8 months ago

Would it be possible to have two climate activate options? As it works now as far as I can see is that the climate activation does so with the ”leave in 30 min” option ending up with no engine start.

if it is possible i would also like to have a “leave in 15 min” option that would also start the engine.

Dielee commented 7 months ago

I just checked and using the engine start stop end points, it works for me too.

image

Are those endpoints really starting your engine ? Are you able to confirm this ?

ChristianNiklasson commented 7 months ago

I can confirm that the endpoints above works but for the start command you need to add a time integer as mentioned earlier

Rustymage commented 7 months ago

https://github.com/Dielee/volvo2mqtt/assets/19926955/ad9763ea-f6ee-46cb-9248-e92783cef93e

I failed to set a timer and it seems to lock you out after a few attempts of failing to notice a 0 minute run time.

You get the idea.

Dielee commented 7 months ago

Alright, thanks. Currently I'm waiting for Volvo to publish my oauth2 app. Hopefully they will do!

FireWizard52 commented 6 months ago

Hi @Dielee

You said:

Currently I'm waiting for Volvo to publish my oauth2 app. Hopefully they will do!

I do not want to disappoint you, but I'm sorry that I have to say: "They will not approve your application"

I'm not a Home Assistant user, but I created my first integration of my Volvo to Domoticz, using MQTT, Node-RED and the Python application, created by 'Molobrakos' in 2019. See: https://github.com/molobrakos/volvooncall. This is the default HA Integration. When the Extended API and Connected API were published in 2021, I created another Node-RED flow and tried to get an access code in a legal way and made a request for publication. They never answered. So I deleted my project and created a new one. That was in January this year. Still no answer. Other developers got a negative answer, because they were a person and as such not a legal entity (a company) or had to submit a business plan first.

So if you have further developments in mind, do not wait for Volvo's approval.

About 2 weeks ago, I saw a question about authorization and I understand your answer. But also the scope is in the body of the request. I noticed that they have changed today the scope of the "Fuel" endpoint and there is a new one: "conve:battery_charge_level". See: https://developer.volvocars.com/apis/connected-vehicle/v2/endpoints/fuel/

However adding this scope to the list of scopes in the body gives an error: invalid scope.

So there are still a few issues. Hope this will give you some information, in case question will arrive, that something isn't working anymore

Regards

Dielee commented 6 months ago

Thanks for this answer! So I will stop the publication and implement the new auth flow, I discovered a few days ago to keep this integration alive. Unfortunately the scope, which is needed for the engine start, doesn't work. Maybe it isn't even working, or it isn't working because of their reverse engineered auth method and the used client id. What do you think ? Is it simply not working ? Maybe we can have some more exchange about this topic at discord or something?

FireWizard52 commented 6 months ago

Hello

So I will stop the publication

Well, I would leave it, as it is. Some users (developers at Domoticz) has got an answer and not what they wanted. What I wanted to say, do not wait for an approval, as I made my last request January 12, this year and still no answer. I know, it is not very polite, but that is, what it is in bigger companies.

I discovered a few days ago to keep this integration alive.

That it is interesting, but a lot of things are not stable and not according to what we should expect from the documentation.

  1. As you also discovered, trying to start or stop the engine does not work. It gives:

error: object message: "FORBIDDEN" description: "Access is denied"

I do not have that option in my Volvo Cars app, so maybe it does not exist for my car. It is strange, because it is in the list of available commands, if you query the "commands" endpoint

I realized, that the scope doesn't contain "conve:engine_start_stop" So I added it, but then the Authorization request returns "invalid scope"

  1. I removed a lot of unnecessary items from the scope, so that only "openid", and all the conve and energy items remain.
  2. Also the header, I modified, so that it only contains the "magic string"
  3. I also receive the location data, while "location:read" is not in the scope and while I use the VCC-API-key of the "Connected" API.
  4. I get a valid (200) response from the Energy API, but the data object is empty. Probably due to the fact that my car XC40 PHEV 2023 is not supported, yet
  5. After the authorization I receive of course an access token and a refresh token, but it indicates "expires_in: 1799. Strange, as all documentation mentioned 1 hour validity for the access token. This is 30 minutes. So I send a refresh every 20 minutes and that has worked for me. I have a test running now for approx 3 weeks.
  6. Also the new discovered scope for the battery_charge_level gives an error, if you add it to the list of scopes.

Maybe we can have some more exchange about this topic at discord or something?

Yes we can, but in fact the only issue that we (and all other users) have is how to get access to the API in a clean way in order to integrate it with Home Automation systems. And that all available scopes really give data.

Regards

github-actions[bot] commented 6 months ago

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] commented 6 months ago

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

BernoldNL commented 6 months ago

Thanks for this answer! So I will stop the publication and implement the new auth flow, I discovered a few days ago to keep this integration alive. Unfortunately the scope, which is needed for the engine start, doesn't work. Maybe it isn't even working, or it isn't working because of their reverse engineered auth method and the used client id. What do you think ? Is it simply not working ? Maybe we can have some more exchange about this topic at discord or something?

@Dielee I am very interested to hear more about that new auth flow. It doesn't look like it's in your code yet. Can you share how it works?