Closed ChristianNiklasson closed 6 months ago
I don't know what you want, sorry. If you activate the climate, it will start immediately, until the engine starts, or for 30 minutes.
If you in the Volvo app start the climate with a 15 minute delay or less the engine will start.
If you start the climate with a 20 minute or more delay only the heater will start.
So, the effect will also be that if only the heater is started the heated steering wheel will not activate as well as other electric heated functions such as mirrors and so on.
Therefore if it would be possible to also send the "minutes to leave" information that i assume is sent by the native app with the command to start the climate it would automatically force an engine start (if set to 15min or less)
Ah okay, this is a feature I wasn't aware of. I can't find any API endpoint to support the feature in the HA Add-on, sorry. Feel free to search on your own!
There is apparently a direct command to start the engine
Documentation found here:
https://developer.volvocars.com/apis/connected-vehicle/v1/specification/
Yes, I know, but without any timer function. This is On/Off.
Understand, but i took a look in the Volvo app and there aren't some many time options.
So a engine start option would probably be a 15 minute timer and heater start would then be a 30 min timer.
So just to have the engine start option in the integration would solve the issue the way i was looking for from the start.
As I can't test the engine start endpoint, are you able to test some dev releases ?
Sure, might need some guidance for the installation though 🙃
Are you using the HA Add-on?
Yep 👍🏻
Are you able to start your engine via the volvo devloper portal ?
Mine isn't starting:
{
"error": {
"message": "FORBIDDEN",
"description": "Access is denied"
}
}
The developer portal apparently has runtime minutes if that's of use here?
curl -X 'POST' \
'https://api.volvocars.com/connected-vehicle/v1/vehicles/TESTVIN/commands/engine-start' \
-H 'accept: application/vnd.volvocars.api.connected-vehicle.commandinvokeresponse.v1+json' \
-H 'Content-Type: application/vnd.volvocars.api.connected-vehicle.enginestart.v1+json' \
-d '{
"runtimeMinutes": 10
}'
The engine start uses runtime in minutes, the climate not.
Ah, yes and the max would be 15 minutes then
Are you able to start your engine via the volvo devloper portal ?
Mine isn't starting:
{ "error": { "message": "FORBIDDEN", "description": "Access is denied" } }
I received Error 500 internal Server error
Great... This API is real garbage at this time!
If this won't work, I can't implement the engine start, sorry.
So i was able to start the engine via the Volvo Dev site.
It needed both the VIN and authentication with a token from my Volvo ID and the API Key.
So at least it works there both the engine start and the engine stop command worked fine
I just checked and using the engine start stop end points, it works for me too.
Nice, I will implement it if I have some spare time.
Are your Cars phevs or mild hybrids ? Or even bevs are working?
Mine is Mild-hybrid
Are your Cars phevs or mild hybrids ? Or even bevs are working?
Mild hybrid. B5.
So please send me your response from this endpoint:
https://api.volvocars.com/connected-vehicle/v2/vehicles/<YOUR VIN>/commands
{
"data": [
{
"command": "LOCK_REDUCED_GUARD",
"href": "/v2/vehicles/VIN/commands/lock-reduced-guard"
},
{
"command": "LOCK",
"href": "/v2/vehicles/VIN/commands/lock"
},
{
"command": "UNLOCK",
"href": "/v2/vehicles/VIN/commands/unlock"
},
{
"command": "ENGINE_START",
"href": "/v2/vehicles/VIN/commands/engine-start"
},
{
"command": "ENGINE_STOP",
"href": "/v2/vehicles/VIN/commands/engine-stop"
}
]
}
{ "data": [ { "command": "LOCK_REDUCED_GUARD", "href": "/v2/vehicles/VIN/commands/lock-reduced-guard" }, { "command": "LOCK", "href": "/v2/vehicles/VIN/commands/lock" }, { "command": "UNLOCK", "href": "/v2/vehicles/VIN/commands/unlock" }, { "command": "ENGINE_START", "href": "/v2/vehicles/VIN/commands/engine-start" }, { "command": "ENGINE_STOP", "href": "/v2/vehicles/VIN/commands/engine-stop" } ] }
Climate isn't supported by your car, interesting. Can you confirm this ?
There is a new feature container available. Please test the engine start feature:
ghcr.io/dielee/volvo2mqtt:engine_start_feature
There will be two new entities:
I have climate, see photo.
I don't have a start/stop option in the app, however the developer portal climate API doesn't work, yet start/stop does...
Will try the feature when I'm home.
Thank you!
The climate api doesn't work, this is what I wanted to know. If you delete the mqtt device in HA and run the new 1.9.0, the climate entity will not even appear anymore, as it isn't supported by your car.
If you start the climate with "Leave in" minutes, the motor starts immediately?
If you start the climate with "Leave in" minutes, the motor starts immediately?
In the Volvo app, yes. The hazards flash and car starts. It stays locked and needs the key and a twist of the internal 'start/stop dial' to fully unlock and allow driving.
Alright, than the changes should do what you want! But I can't test it, as my BEV doesn't support engine start. So if something is not working, please provide debug logs.
Could you guide me on how to install the package?
If you are using the HA Addon, there is no way. You have to install dev containers via docker.
Noted, so i will just wait for the next uppdate then?
I need some testers... If nobody can test this, I will not merge this into main...
I need some testers... If nobody can test this, I will not merge this into main...
I'll take a look when I'm home and get back to you.
I have climate, see photo.
I don't have a start/stop option in the app, however the developer portal climate API doesn't work, yet start/stop does...
Will try the feature when I'm home.
Thank you!
I would say that you dont have the extra fuel warmer on your car, thats why you cant choose more than 15 minutes, in my example i have the diesel warmer that i can use instead of turning the car on. So the effect will be that the "start climate" will start the dieselwarmer for a 30 min runtime.
So: 1-15 minutes leave time will start the engine. (/vehicles/{vin}/commands/engine-start) 30 minutes will start the climate (fuel/diesel warmer)
I'd hope mine didn't have a diesel warmer as it's a petrol ;)
Here's the log:
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Starting volvo2mqtt version v1.9.0
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Using VCCAPIKEY: KEY
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Vin: ['VIN'] found!
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Failed, Battery Charge Level (sensor) is unfortunately not supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Failed, Battery Charge Level (sensor) is unfortunately not supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Failed, Electric Range (sensor) is unfortunately not supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Failed, Estimated Charging Time (sensor) is unfortunately not supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Failed, Charging System Status (sensor) is unfortunately not supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Failed, Charging Connection Status (sensor) is unfortunately not supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Failed, Estimated Charging Finish Time (sensor) is unfortunately not supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Odometer (sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Last Data Update (sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Active schedules (sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Window Front Left (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Window Front Right (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Window Rear Left (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Window Rear Right (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Door Front Left (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Door Front Right (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Door Rear Left (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Door Rear Right (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Tailgate (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Engine Hood (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Tank Lid (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Sunroof (binary_sensor) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Failed, Air Conditioning (switch) is unfortunately not supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Engine State (switch) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Leave in (number) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Lock state (lock) is supported by your vehicle.
Nov 22 19:13:40 volvo2mqtt [1] - INFO: Success! Force Update Data (button) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Location (device_tracker) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Tire Front Left (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Tire Front Right (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Tire Rear Left (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Tire Rear Right (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Fuel Level (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Average Fuel Consumption (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Failed, Average Energy Consumption (sensor) is unfortunately not supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Distance to Empty Tank (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Failed, Distance to Empty Battery (sensor) is unfortunately not supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Average Speed (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Hours to Service (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Distance to Service (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Time to Service (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Service warning status (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! Washer Fluid Level warning (sensor) is supported by your vehicle.
Nov 22 19:13:41 volvo2mqtt [1] - INFO: Success! API Backend status (sensor) is supported by your vehicle.
Nov 22 19:13:43 volvo2mqtt [1] - INFO: Sending mqtt update...
Nov 22 19:13:44 volvo2mqtt [1] - INFO: Mqtt update done. Next run in 300 seconds.
Nov 22 19:13:51 volvo2mqtt [1] - ERROR: API Call failed. Status Code: 403. Error: {
"error" : {
"message" : "FORBIDDEN",
"description" : "Access is denied"
}
}
Okay, we have some API issues. The 403 is the start engine switch ?
Enabling CONF_debug
doesn't get me further detail..?
The below just repeats and toggling state doesn't change the output - happy to do something different if asked.
Nov 22 19:22:46 volvo2mqtt [1] - DEBUG: Starting GET call against https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/diagnostics
Nov 22 19:22:46 volvo2mqtt [1] - DEBUG: Response status code: 200
Nov 22 19:22:46 volvo2mqtt [1] - DEBUG: {
"data" : {
"serviceWarning" : {
"value" : "NO_WARNING",
"timestamp" : "2023-11-22T16:29:59.366Z"
},
"engineHoursToService" : {
"value" : 598,
"unit" : "h",
"timestamp" : "2023-11-22T16:29:59.366Z"
},
"distanceToService" : {
"value" : 42476,
"unit" : "km",
"timestamp" : "2023-11-22T16:29:59.366Z"
},
"washerFluidLevelWarning" : {
"value" : "NO_WARNING",
"timestamp" : "2023-11-22T16:29:59.366Z"
},
"timeToService" : {
"value" : 10,
"unit" : "months",
"timestamp" : "2023-11-22T16:29:59.366Z"
}
}
}
Okay, we have some API issues. The 403 is the start engine switch ?
The 403 is a direct response to switching on the state switch.
Aaah, I have a idea, please wait a few minutes.
The conve:engine_start_stop
scope is missing from the authentication. Unfortunately the authorization against the used endpoint, is returning an error, if this scope is posted. For now, there is no soloution. I will take a look tomorrow.
conve:engine_start_stop
I'm not following on whether I can assist in posting the scope or how?
What's conve:engine_start_stop
?
API authentication stuff.. There is nothing you can do at this time, thanks!
You have noted that the API needs an access token from your Volvo ID aswell as the VIN and ofcourse the API key? Seen as the second authorisation below
The auth. key for the Volvo ID should be found here: https://volvoid.eu.volvocars.com/VolvoLogin/login?resumePath=j6dPwGVjUq&client_id=developervcarsdotcom
I might just be stupid but still wanted to point it out, this was the authorization i missed when i first tried the command on the Volvo Dev. site.
Yes Sure, I know the API very good at this time. The authorization is missing the conve:engine_start_stop
scope. I will try my best.
It looks like the needed scope conve:engine_start_stop
to start and stop the engine isn't working with the used authentication method. I started an app publication at Volvo. Hopefully, they will review my app. If my app is reviewed and published, I have to implement an oauth2 auth flow. If there is something new, I will keep you updated.
UPDATE: I deep dived into the app authentication. There is something new, which I would be able to implement, but this wouldn't fix the access to the "Engine Start" Resource.
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.