home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.17k stars 29.85k forks source link

Volvo integration #61785

Open MikaelHoogen opened 2 years ago

MikaelHoogen commented 2 years ago

The problem

Hello

I'm trying to use the Volvo integration. It doesn't work for me. When i'm reading the api documentation there is a OAuth 2.0 authorization with tokens. The only thing you can use in the integration is user and password. I don't understand how that is supposed to work?

https://developer.volvocars.com/volvo-api/connected-vehicle/

What version of Home Assistant Core has the issue?

2021.12

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Volvo On Call

Link to integration documentation on our website

https://www.home-assistant.io/integrations/volvooncall/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

nikagl commented 1 year ago

I did ask Tibber to create an app and they responded "it's on the list". So please ask as well, make sure to mention it's a new API (developer Volvo Cars.com) and not based on the vocapi. And for HASS I'm afraid you'll have to wait till someone develops it. Domoticz and a way in OpenHAB are available...

HWiese1980 commented 1 year ago

Thanks that you guys understand my anger and don't criticize me for it. I'll see what the Domoticz way can do for me. I find it weird thought that I have to use someone else's publicized token. It only adds to my feeling that there are some idiots at work at Volvo, be it in management, development, wherever, I don't care. They have a problem. That's undeniable.

josecarre commented 1 year ago

Hi, I got today a 2023 XC60 recharge... I've added the volvo on call integration in HA... logged... but not sensors are displayed... Is it really no supported? I have everything working in older cars in HA... and this fancy new one cannot be added in HA? im really really surprised :(

HWiese1980 commented 1 year ago

Doesn't look so. I've managed to integrate it manually by writing my own AppDaemon script. I'll see if I can clean it up to publish it. It's based on the Domoticz code linked by @nikagl (thanks). For now I can at least lock/unlock the doors and see lock/open status of doors, windows, hood and trunk, as well as the SoC. I still have to integrate HVAC.

I would love to turn it into a full-blown integration instead of running it through AppDaemon. But I have no experience in writing custom integrations for HA. Need to get up that learning curve first.

josecarre commented 1 year ago

Doesn't look so. I've managed to integrate it manually by writing my own AppDaemon script. I'll see if I can clean it up to publish it. It's based on the Domoticz code linked by @nikagl (thanks). For now I can at least lock/unlock the doors and see lock/open status of doors, windows, hood and trunk, as well as the SoC. I still have to integrate HVAC.

I would love to turn it into a full-blown integration instead of running it through AppDaemon. But I have no experience in writing custom integrations for HA. Need to get up that learning curve first.

Thanks for your reply, and same here... Anyway I see there is an API where we can work with, right? (https://developer.volvocars.com/apis/connected-vehicle/specification/) I guess I will do something similar as you, but with node-red in my case because Im used to it to automate unsupported stuff into HA, but same... i have no experience building HA integrations but if the APi is providing the info I dont see why it was not adapted yet. Anyway... is always good to have something to work in and play with the API meanwhile :), thanks!

josecarre commented 1 year ago

Ok, some good and bad news after some days playing :) I managed to check that a fix is doable, as I have integrated my 2023 XC60 PHEV into HA... but not with core integration (that one doesnt work...yet?), but manually with each API request and node-red, and from node-red to HA sensors/buttons...etc The way I handle the authentication is the dirty one, a full auth for each time i get sensors data. It seems to work fine... fuel status, battery, door status... lock doors... unlock doors... activate climate...etc All but car location because I cannot find how to get that info from API :( (in my former BMW i had a device tracker with car GPS location, it was really nice, but in Volvo i dont know how is handled)

So... at least we know that the API work and that the integration is fixable... Sadly my python skills are not enough for fixing the integration. Besides the Volvo developer portal where there is a lot of info... I got the requests formats and some very usefull toolkit to do tests from this repo from @andynash : https://www.postman.com/andynash/workspace/volvo-apis/collection/6009097-92ddc541-ef84-4d87-acec-03b1b19abd9b?tab=overview

For now I have just added some stuff that I use most (it gets refreshed every 5min), im only missing the car location: image

So for everyone... as doing this dirty way with node-red...etc is very far from clean... I can only say to other people that the integration is fixable for our cars... so with some time I guess we will have in Home Assistant core this working again :)

Mheel80 commented 1 year ago

Ok, some good and bad news after some days playing :) I managed to check that a fix is doable, as I have integrated my 2023 XC60 PHEV into HA... but not with core integration (that one doesnt work...yet?), but manually with each API request and node-red, and from node-red to HA sensors/buttons...etc The way I handle the authentication is the dirty one, a full auth for each time i get sensors data. It seems to work fine... fuel status, battery, door status... lock doors... unlock doors... activate climate...etc All but car location because I cannot find how to get that info from API :( (in my former BMW i had a device tracker with car GPS location, it was really nice, but in Volvo i dont know how is handled)

So... at least we know that the API work and that the integration is fixable... Sadly my python skills are not enough for fixing the integration. Besides the Volvo developer portal where there is a lot of info... I got the requests formats and some very usefull toolkit to do tests from this repo from @andynash : https://www.postman.com/andynash/workspace/volvo-apis/collection/6009097-92ddc541-ef84-4d87-acec-03b1b19abd9b?tab=overview

For now I have just added some stuff that I use most (it gets refreshed every 5min), im only missing the car location: image

So for everyone... as doing this dirty way with node-red...etc is very far from clean... I can only say to other people that the integration is fixable for our cars... so with some time I guess we will have in Home Assistant core this working again :)

Do you want to share your node-red flow?

josecarre commented 1 year ago

Ok, some good and bad news after some days playing :) I managed to check that a fix is doable, as I have integrated my 2023 XC60 PHEV into HA... but not with core integration (that one doesnt work...yet?), but manually with each API request and node-red, and from node-red to HA sensors/buttons...etc The way I handle the authentication is the dirty one, a full auth for each time i get sensors data. It seems to work fine... fuel status, battery, door status... lock doors... unlock doors... activate climate...etc All but car location because I cannot find how to get that info from API :( (in my former BMW i had a device tracker with car GPS location, it was really nice, but in Volvo i dont know how is handled) So... at least we know that the API work and that the integration is fixable... Sadly my python skills are not enough for fixing the integration. Besides the Volvo developer portal where there is a lot of info... I got the requests formats and some very usefull toolkit to do tests from this repo from @andynash : https://www.postman.com/andynash/workspace/volvo-apis/collection/6009097-92ddc541-ef84-4d87-acec-03b1b19abd9b?tab=overview For now I have just added some stuff that I use most (it gets refreshed every 5min), im only missing the car location: image So for everyone... as doing this dirty way with node-red...etc is very far from clean... I can only say to other people that the integration is fixable for our cars... so with some time I guess we will have in Home Assistant core this working again :)

Do you want to share your node-red flow?

Sure, I hope my effort save some time to other people, this is how it will look:

image

And this is the node-red flow, but do this replacements:

I think that should make it, please give me feedback just in case I need to put more instructions. Or remove anything but I think i have replaced all sensitive info.

Node-red flow:

[{"id":"63c0bc29bc8a38a5","type":"tab","label":"volvo","disabled":false,"info":"","env":[]},{"id":"9083145de1435853","type":"inject","z":"63c0bc29bc8a38a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":80,"wires":[["b9779afddc93d95d"]]},{"id":"cea83d458cd7388c","type":"debug","z":"63c0bc29bc8a38a5","name":"debug get token","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":300,"y":180,"wires":[]},{"id":"9c7475dbd69706c6","type":"http request","z":"63c0bc29bc8a38a5","name":"login","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://volvoid.eu.volvocars.com/as/token.oauth2?grant_type=password&access_token_manager_id=JWTh4Yf0b&username=PUT_USERNAME_HERE&password=PUT_PASSWORD_HERE&scope=openid%20email%20profile%20care_by_volvo:financial_information:invoice:read%20care_by_volvo:financial_information:payment_method%20care_by_volvo:subscription:read%20customer:attributes%20customer:attributes:write%20order:attributes%20vehicle:attributes%20tsp_customer_api:all%20conve:brake_status%20conve:climatization_start_stop%20conve:command_accessibility%20conve:commands%20conve:diagnostics_engine_status%20conve:diagnostics_workshop%20conve:doors_status%20conve:engine_status%20conve:environment%20conve:fuel_status%20conve:honk_flash%20conve:lock%20conve:lock_status%20conve:navigation%20conve:odometer_status%20conve:trip_statistics%20conve:tyre_status%20conve:unlock%20conve:vehicle_relation%20conve:warnings%20conve:windows_status%20energy:battery_charge_level%20energy:charging_connection_status%20energy:charging_system_status%20energy:electric_range%20energy:estimated_charging_time%20energy:recharge_status&","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":110,"y":140,"wires":[["cea83d458cd7388c","0f7f898f9ec5803d","e07d6af565a53cbe","9bd4062acabd6252"]]},{"id":"b9779afddc93d95d","type":"change","z":"63c0bc29bc8a38a5","name":"set get token","rules":[{"t":"set","p":"headers","pt":"msg","to":"{\"User-Agent\":\"okhttp/4.10.0\",\"Authorization\":\"Basic aDRZZjBiOlU4WWtTYlZsNnh3c2c1WVFxWmZyZ1ZtSWFEcGhPc3kxUENhVXNpY1F0bzNUUjVrd2FKc2U0QVpkZ2ZJZmNMeXc=\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":80,"wires":[["9c7475dbd69706c6"]]},{"id":"57c23ee13bd471d2","type":"http request","z":"63c0bc29bc8a38a5","name":"odometer","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/odometer","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":320,"y":220,"wires":[["ea5ca6dd7e8aff1e","b7291fb7e44867ac"]]},{"id":"ea5ca6dd7e8aff1e","type":"debug","z":"63c0bc29bc8a38a5","name":"debug odometer","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":510,"y":180,"wires":[]},{"id":"0f7f898f9ec5803d","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + msg.payload.access_token,\n    \"User-Agent\": \"okhttp/4.10.0\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":140,"y":220,"wires":[["57c23ee13bd471d2","2c846575f5c6b3a1","d94896164fbfbe7e","5590d11aeeac555b","73367129b6d7e045"]]},{"id":"a4d978e2986656a9","type":"debug","z":"63c0bc29bc8a38a5","name":"debug x10 odometer","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":200,"wires":[]},{"id":"b7291fb7e44867ac","type":"function","z":"63c0bc29bc8a38a5","name":"odometer x10","func":"msg.payload = (10 * msg.payload.data.odometer.value)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":220,"wires":[["a4d978e2986656a9","d999527895144f23"]]},{"id":"d999527895144f23","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.odometer","entityConfig":"bdb296329b836d7a","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":720,"y":220,"wires":[[]]},{"id":"2c846575f5c6b3a1","type":"http request","z":"63c0bc29bc8a38a5","name":"fuel","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/fuel","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":150,"y":300,"wires":[["7f682a0cecced8fa","7b366b68d30ab5f3"]]},{"id":"7f682a0cecced8fa","type":"debug","z":"63c0bc29bc8a38a5","name":"debug fuel","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":330,"y":300,"wires":[]},{"id":"d94896164fbfbe7e","type":"http request","z":"63c0bc29bc8a38a5","name":"recharge-status","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/energy/v1/vehicles/REPLACE_VIN_HERE/recharge-status","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":180,"y":500,"wires":[["a79556be76d0deaf","7aaf80648a66db92","a4b5f8a9033a1144","7aa36e6ae5f96d70"]]},{"id":"a79556be76d0deaf","type":"debug","z":"63c0bc29bc8a38a5","name":"debug echarge-status","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":240,"y":560,"wires":[]},{"id":"5590d11aeeac555b","type":"http request","z":"63c0bc29bc8a38a5","name":"statistics","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/statistics","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":160,"y":400,"wires":[["e40d1e3ef07d1fe4","182ca17104395dd8"]]},{"id":"e40d1e3ef07d1fe4","type":"debug","z":"63c0bc29bc8a38a5","name":"debug statistics","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":340,"y":380,"wires":[]},{"id":"a4b5f8a9033a1144","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.batteryChargeLevel","entityConfig":"c8b2f3f73256a16a","version":0,"state":"payload.data.batteryChargeLevel.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":410,"y":500,"wires":[[]]},{"id":"7b366b68d30ab5f3","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.fuelAmount","entityConfig":"db75ed4907249d8d","version":0,"state":"payload.data.fuelAmount.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":350,"y":320,"wires":[[]]},{"id":"182ca17104395dd8","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.distanceToEmpty","entityConfig":"575875e038160b10","version":0,"state":"payload.data.distanceToEmpty.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":360,"y":400,"wires":[[]]},{"id":"7aaf80648a66db92","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.electricrange","entityConfig":"983caf3ac93d119e","version":0,"state":"payload.data.electricRange.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":390,"y":460,"wires":[[]]},{"id":"a1a9a1601861c46e","type":"http request","z":"63c0bc29bc8a38a5","name":"doors","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v1/vehicles/REPLACE_VIN_HERE/doors","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":310,"y":760,"wires":[["9473ac50c019db9c","f4a55f45a6d39dd4"]]},{"id":"9473ac50c019db9c","type":"debug","z":"63c0bc29bc8a38a5","name":"debug doors","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":760,"wires":[]},{"id":"e07d6af565a53cbe","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + msg.payload.access_token,\n    \"User-Agent\": \"okhttp/4.10.0\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\",\n    \"accept\": \"application/vnd.volvocars.api.connected-vehicle.vehicledata.v1+json\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":140,"y":760,"wires":[["a1a9a1601861c46e"]]},{"id":"5ef424066ae3df34","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + flow.get(\"access_token\"),\n    \"Content-Type\": \"application/json\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":880,"wires":[["a33a22c82abd25f1"]]},{"id":"a33a22c82abd25f1","type":"http request","z":"63c0bc29bc8a38a5","name":"lock","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/commands/lock","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":880,"wires":[["84c2cabbf404e611"]]},{"id":"9bd4062acabd6252","type":"change","z":"63c0bc29bc8a38a5","name":"save global token","rules":[{"t":"set","p":"access_token","pt":"flow","to":"payload.access_token","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":140,"wires":[[]]},{"id":"13ea8a6277730da5","type":"inject","z":"63c0bc29bc8a38a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":880,"wires":[["5ef424066ae3df34"]]},{"id":"3e98ac7284292a27","type":"http request","z":"63c0bc29bc8a38a5","name":"unlock","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/commands/unlock","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":960,"wires":[["5200eaac936abc2b"]]},{"id":"18b4dd8acfeba7d9","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + flow.get(\"access_token\"),\n    \"Content-Type\": \"application/json\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\"\n}\nmsg.payload = { \"unlockDuration\": 120 }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":960,"wires":[["3e98ac7284292a27"]]},{"id":"d3381f63d46eb5a3","type":"inject","z":"63c0bc29bc8a38a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":960,"wires":[["18b4dd8acfeba7d9"]]},{"id":"84c2cabbf404e611","type":"debug","z":"63c0bc29bc8a38a5","name":"debug lock","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":880,"wires":[]},{"id":"5200eaac936abc2b","type":"debug","z":"63c0bc29bc8a38a5","name":"debug unlock","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":960,"wires":[]},{"id":"a6fe9869ef6bcee2","type":"ha-button","z":"63c0bc29bc8a38a5","name":"xc60.button.lock","version":0,"debugenabled":false,"outputs":1,"entityConfig":"386a96755b1ac874","outputProperties":[],"x":160,"y":840,"wires":[["5ef424066ae3df34"]]},{"id":"c144fbef805507d6","type":"ha-button","z":"63c0bc29bc8a38a5","name":"xc60.button.unlock","version":0,"debugenabled":false,"outputs":1,"entityConfig":"94d7b6e19c8ec5fb","outputProperties":[],"x":170,"y":920,"wires":[["18b4dd8acfeba7d9"]]},{"id":"2efe6b3ebe775079","type":"ha-button","z":"63c0bc29bc8a38a5","name":"xc60.button.refreshData","version":0,"debugenabled":false,"outputs":1,"entityConfig":"b6d85fce147a2039","outputProperties":[],"x":170,"y":40,"wires":[["b9779afddc93d95d"]]},{"id":"f4a55f45a6d39dd4","type":"ha-binary-sensor","z":"63c0bc29bc8a38a5","name":"xc60.carLocked","entityConfig":"db1605e3bab93381","version":0,"state":"payload.data.carLocked.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":500,"y":800,"wires":[[]]},{"id":"af9b0fd6e66c9f5a","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + flow.get(\"access_token\"),\n    \"Content-Type\": \"application/json\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\"\n}\nmsg.payload = { \"runtimeMinutes\": 5 }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":1080,"wires":[["f14ce0a72e0e8e79"]]},{"id":"f14ce0a72e0e8e79","type":"http request","z":"63c0bc29bc8a38a5","name":"climate-start","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/commands/climatization-start","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":1080,"wires":[["570fdb9827f3d7c6"]]},{"id":"4ddb14280a3136ef","type":"inject","z":"63c0bc29bc8a38a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1080,"wires":[["af9b0fd6e66c9f5a"]]},{"id":"8e0bf43bd2bfd399","type":"http request","z":"63c0bc29bc8a38a5","name":"climate-stop","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/commands/climatization-stop","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":1160,"wires":[["2231105df76c7dc5"]]},{"id":"cb3b262a6a30586c","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + flow.get(\"access_token\"),\n    \"Content-Type\": \"application/json\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":1160,"wires":[["8e0bf43bd2bfd399"]]},{"id":"78c074d5b9f11ca4","type":"inject","z":"63c0bc29bc8a38a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1160,"wires":[["cb3b262a6a30586c"]]},{"id":"570fdb9827f3d7c6","type":"debug","z":"63c0bc29bc8a38a5","name":"debug climate-start","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":1080,"wires":[]},{"id":"2231105df76c7dc5","type":"debug","z":"63c0bc29bc8a38a5","name":"debug climate-stop","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":1160,"wires":[]},{"id":"a31191e414ac6365","type":"ha-button","z":"63c0bc29bc8a38a5","name":"xc60.button.climate-start","version":0,"debugenabled":false,"outputs":1,"entityConfig":"76732bdab554f68e","outputProperties":[],"x":190,"y":1040,"wires":[["af9b0fd6e66c9f5a"]]},{"id":"fd8e3f7e1069a800","type":"ha-button","z":"63c0bc29bc8a38a5","name":"xc60.button.climate-stop","version":0,"debugenabled":false,"outputs":1,"entityConfig":"022b692d012e1793","outputProperties":[],"x":190,"y":1120,"wires":[["cb3b262a6a30586c"]]},{"id":"73367129b6d7e045","type":"http request","z":"63c0bc29bc8a38a5","name":"warnings","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v1/vehicles/REPLACE_VIN_HERE/warnings","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":160,"y":640,"wires":[["99d49bdedfe4b5b2","1c467836a4ea3f1f"]]},{"id":"99d49bdedfe4b5b2","type":"debug","z":"63c0bc29bc8a38a5","name":"debug warnings","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":340,"y":640,"wires":[]},{"id":"201ccbcebb7803c3","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.warnings","entityConfig":"f68f7e765627d28e","version":0,"state":"payload.data","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":640,"y":700,"wires":[[]]},{"id":"1c467836a4ea3f1f","type":"switch","z":"63c0bc29bc8a38a5","name":"","property":"payload.data","propertyType":"msg","rules":[{"t":"empty"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":700,"wires":[["8420256183d4e338"],["201ccbcebb7803c3"]]},{"id":"8420256183d4e338","type":"change","z":"63c0bc29bc8a38a5","name":"set if empty","rules":[{"t":"set","p":"payload.data","pt":"msg","to":"No warnings","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":680,"wires":[["201ccbcebb7803c3"]]},{"id":"1f9a306e4ea0a78c","type":"ha-binary-sensor","z":"63c0bc29bc8a38a5","name":"xc60.chargingConectionbinary","entityConfig":"fd4a2b93172da019","version":0,"state":"payload.data.chargingConnectionStatus.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":690,"y":520,"wires":[[]]},{"id":"bb81ff44b0eabc2b","type":"ha-binary-sensor","z":"63c0bc29bc8a38a5","name":"xc60.chargingStatusbinary","entityConfig":"168db5d09ca5d0a3","version":0,"state":"payload.data.chargingSystemStatus.value","stateType":"msg","attributes":[{"property":"Estimated charging time","value":"payload.data.estimatedChargingTime.value","valueType":"msg"}],"inputOverride":"allow","outputProperties":[],"x":800,"y":580,"wires":[[]]},{"id":"7aa36e6ae5f96d70","type":"function","z":"63c0bc29bc8a38a5","name":"to binaries","func":"\nif (msg.payload.data.chargingConnectionStatus.value.includes(\"CONNECTION_STATUS_DISCONNECTED\")) {\n    msg.payload.data.chargingConnectionStatus.value = \"off\";\n}\n\nif (msg.payload.data.chargingConnectionStatus.value.includes(\"CONNECTION_STATUS_CONNECTED\")) {\n    msg.payload.data.chargingConnectionStatus.value = \"on\";\n}\n\nif (msg.payload.data.chargingSystemStatus.value.includes(\"CHARGING_SYSTEM_CHARGING\")) {\n    msg.payload.data.chargingSystemStatus.value = \"on\";\n}\n\nif (msg.payload.data.chargingSystemStatus.value.includes(\"CHARGING_SYSTEM_UNSPECIFIED\")) {\n    msg.payload.data.chargingSystemStatus.value = \"off\";\n}\n\nif (msg.payload.data.chargingSystemStatus.value.includes(\"CHARGING_SYSTEM_IDLE\")) {\n    msg.payload.data.chargingSystemStatus.value = \"off\";\n}\n\n\nvar minutes = msg.payload.data.estimatedChargingTime.value;\nvar hours = Math.floor(minutes / 60);\nvar remainingMinutes = minutes % 60;\n\nvar formattedTime = ('0' + hours).slice(-2) + 'h:' + ('0' + remainingMinutes).slice(-2) + 'min';\n\nmsg.payload.data.estimatedChargingTime.value = formattedTime;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":560,"wires":[["1f9a306e4ea0a78c","bb81ff44b0eabc2b"]]},{"id":"e04750ec16c492d6","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false,"alpnprotocol":""},{"id":"bdb296329b836d7a","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.odometer","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.odometer"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"distance"},{"property":"unit_of_measurement","value":"km"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"c8b2f3f73256a16a","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.batteryChargeLevel","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.batteryChargeLevel"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"battery"},{"property":"unit_of_measurement","value":"%"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"db75ed4907249d8d","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.fuelAmount","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.fuelAmount"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"liters"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"575875e038160b10","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.distanceToEmpty","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.distanceToEmpty"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"distance"},{"property":"unit_of_measurement","value":"km"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"983caf3ac93d119e","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.electricRange","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.electricrange"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"distance"},{"property":"unit_of_measurement","value":"km"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"386a96755b1ac874","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.button.lock","version":"6","entityType":"button","haConfig":[{"property":"name","value":"xc60.button.lock"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"94d7b6e19c8ec5fb","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.button.unlock","version":"6","entityType":"button","haConfig":[{"property":"name","value":"xc60.button.unlock"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"b6d85fce147a2039","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.button.refreshData","version":"6","entityType":"button","haConfig":[{"property":"name","value":"xc60.button.refreshData"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"update"}],"resend":false,"debugEnabled":false},{"id":"db1605e3bab93381","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.carLocked","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"xc60.carLocked"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"lock"}],"resend":false,"debugEnabled":false},{"id":"76732bdab554f68e","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.button.climate-start","version":"6","entityType":"button","haConfig":[{"property":"name","value":"xc60.button.climate-start"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"022b692d012e1793","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.button.climate-stop","version":"6","entityType":"button","haConfig":[{"property":"name","value":"xc60.button.climate-stop"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"f68f7e765627d28e","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.warnings","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.warnings"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"fd4a2b93172da019","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.chargingConectionbinary","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"xc60.chargingConectionbinary"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"plug"}],"resend":false,"debugEnabled":false},{"id":"168db5d09ca5d0a3","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.chargingStatusbinary","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"xc60.chargingStatusbinary"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"battery_charging"}],"resend":false,"debugEnabled":false},{"id":"fc54beec.590b1","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","statusSeparator":"","enableGlobalContextStore":false}]
Mheel80 commented 1 year ago

Ok, some good and bad news after some days playing :) I managed to check that a fix is doable, as I have integrated my 2023 XC60 PHEV into HA... but not with core integration (that one doesnt work...yet?), but manually with each API request and node-red, and from node-red to HA sensors/buttons...etc The way I handle the authentication is the dirty one, a full auth for each time i get sensors data. It seems to work fine... fuel status, battery, door status... lock doors... unlock doors... activate climate...etc All but car location because I cannot find how to get that info from API :( (in my former BMW i had a device tracker with car GPS location, it was really nice, but in Volvo i dont know how is handled) So... at least we know that the API work and that the integration is fixable... Sadly my python skills are not enough for fixing the integration. Besides the Volvo developer portal where there is a lot of info... I got the requests formats and some very usefull toolkit to do tests from this repo from @andynash : https://www.postman.com/andynash/workspace/volvo-apis/collection/6009097-92ddc541-ef84-4d87-acec-03b1b19abd9b?tab=overview For now I have just added some stuff that I use most (it gets refreshed every 5min), im only missing the car location: image So for everyone... as doing this dirty way with node-red...etc is very far from clean... I can only say to other people that the integration is fixable for our cars... so with some time I guess we will have in Home Assistant core this working again :)

Do you want to share your node-red flow?

Sure, I hope my effort save some time to other people, this is how it will look:

image

And this is the node-red flow, but do this replacements:

  • Volvo username in: PUT_USERNAME_HERE
  • Volvo pass in: PUT_PASSWORD_HERE
  • Your VCC API Key from Volvo dev portal in all REPLACE_VCC_API_KEY_HERE
  • And car VIN replace in all REPLACE_VIN_HERE

I think that should make it, please give me feedback just in case I need to put more instructions. Or remove anything but I think i have replaced all sensitive info.

Node-red flow:

[{"id":"63c0bc29bc8a38a5","type":"tab","label":"volvo","disabled":false,"info":"","env":[]},{"id":"9083145de1435853","type":"inject","z":"63c0bc29bc8a38a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":80,"wires":[["b9779afddc93d95d"]]},{"id":"cea83d458cd7388c","type":"debug","z":"63c0bc29bc8a38a5","name":"debug get token","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":300,"y":180,"wires":[]},{"id":"9c7475dbd69706c6","type":"http request","z":"63c0bc29bc8a38a5","name":"login","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://volvoid.eu.volvocars.com/as/token.oauth2?grant_type=password&access_token_manager_id=JWTh4Yf0b&username=PUT_USERNAME_HERE&password=PUT_PASSWORD_HERE&scope=openid%20email%20profile%20care_by_volvo:financial_information:invoice:read%20care_by_volvo:financial_information:payment_method%20care_by_volvo:subscription:read%20customer:attributes%20customer:attributes:write%20order:attributes%20vehicle:attributes%20tsp_customer_api:all%20conve:brake_status%20conve:climatization_start_stop%20conve:command_accessibility%20conve:commands%20conve:diagnostics_engine_status%20conve:diagnostics_workshop%20conve:doors_status%20conve:engine_status%20conve:environment%20conve:fuel_status%20conve:honk_flash%20conve:lock%20conve:lock_status%20conve:navigation%20conve:odometer_status%20conve:trip_statistics%20conve:tyre_status%20conve:unlock%20conve:vehicle_relation%20conve:warnings%20conve:windows_status%20energy:battery_charge_level%20energy:charging_connection_status%20energy:charging_system_status%20energy:electric_range%20energy:estimated_charging_time%20energy:recharge_status&","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":110,"y":140,"wires":[["cea83d458cd7388c","0f7f898f9ec5803d","e07d6af565a53cbe","9bd4062acabd6252"]]},{"id":"b9779afddc93d95d","type":"change","z":"63c0bc29bc8a38a5","name":"set get token","rules":[{"t":"set","p":"headers","pt":"msg","to":"{\"User-Agent\":\"okhttp/4.10.0\",\"Authorization\":\"Basic aDRZZjBiOlU4WWtTYlZsNnh3c2c1WVFxWmZyZ1ZtSWFEcGhPc3kxUENhVXNpY1F0bzNUUjVrd2FKc2U0QVpkZ2ZJZmNMeXc=\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":80,"wires":[["9c7475dbd69706c6"]]},{"id":"57c23ee13bd471d2","type":"http request","z":"63c0bc29bc8a38a5","name":"odometer","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/odometer","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":320,"y":220,"wires":[["ea5ca6dd7e8aff1e","b7291fb7e44867ac"]]},{"id":"ea5ca6dd7e8aff1e","type":"debug","z":"63c0bc29bc8a38a5","name":"debug odometer","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":510,"y":180,"wires":[]},{"id":"0f7f898f9ec5803d","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + msg.payload.access_token,\n    \"User-Agent\": \"okhttp/4.10.0\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":140,"y":220,"wires":[["57c23ee13bd471d2","2c846575f5c6b3a1","d94896164fbfbe7e","5590d11aeeac555b","73367129b6d7e045"]]},{"id":"a4d978e2986656a9","type":"debug","z":"63c0bc29bc8a38a5","name":"debug x10 odometer","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":740,"y":200,"wires":[]},{"id":"b7291fb7e44867ac","type":"function","z":"63c0bc29bc8a38a5","name":"odometer x10","func":"msg.payload = (10 * msg.payload.data.odometer.value)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":220,"wires":[["a4d978e2986656a9","d999527895144f23"]]},{"id":"d999527895144f23","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.odometer","entityConfig":"bdb296329b836d7a","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":720,"y":220,"wires":[[]]},{"id":"2c846575f5c6b3a1","type":"http request","z":"63c0bc29bc8a38a5","name":"fuel","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/fuel","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":150,"y":300,"wires":[["7f682a0cecced8fa","7b366b68d30ab5f3"]]},{"id":"7f682a0cecced8fa","type":"debug","z":"63c0bc29bc8a38a5","name":"debug fuel","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":330,"y":300,"wires":[]},{"id":"d94896164fbfbe7e","type":"http request","z":"63c0bc29bc8a38a5","name":"recharge-status","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/energy/v1/vehicles/REPLACE_VIN_HERE/recharge-status","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":180,"y":500,"wires":[["a79556be76d0deaf","7aaf80648a66db92","a4b5f8a9033a1144","7aa36e6ae5f96d70"]]},{"id":"a79556be76d0deaf","type":"debug","z":"63c0bc29bc8a38a5","name":"debug echarge-status","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":240,"y":560,"wires":[]},{"id":"5590d11aeeac555b","type":"http request","z":"63c0bc29bc8a38a5","name":"statistics","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/statistics","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":160,"y":400,"wires":[["e40d1e3ef07d1fe4","182ca17104395dd8"]]},{"id":"e40d1e3ef07d1fe4","type":"debug","z":"63c0bc29bc8a38a5","name":"debug statistics","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":340,"y":380,"wires":[]},{"id":"a4b5f8a9033a1144","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.batteryChargeLevel","entityConfig":"c8b2f3f73256a16a","version":0,"state":"payload.data.batteryChargeLevel.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":410,"y":500,"wires":[[]]},{"id":"7b366b68d30ab5f3","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.fuelAmount","entityConfig":"db75ed4907249d8d","version":0,"state":"payload.data.fuelAmount.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":350,"y":320,"wires":[[]]},{"id":"182ca17104395dd8","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.distanceToEmpty","entityConfig":"575875e038160b10","version":0,"state":"payload.data.distanceToEmpty.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":360,"y":400,"wires":[[]]},{"id":"7aaf80648a66db92","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.electricrange","entityConfig":"983caf3ac93d119e","version":0,"state":"payload.data.electricRange.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":390,"y":460,"wires":[[]]},{"id":"a1a9a1601861c46e","type":"http request","z":"63c0bc29bc8a38a5","name":"doors","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v1/vehicles/REPLACE_VIN_HERE/doors","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":310,"y":760,"wires":[["9473ac50c019db9c","f4a55f45a6d39dd4"]]},{"id":"9473ac50c019db9c","type":"debug","z":"63c0bc29bc8a38a5","name":"debug doors","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":760,"wires":[]},{"id":"e07d6af565a53cbe","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + msg.payload.access_token,\n    \"User-Agent\": \"okhttp/4.10.0\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\",\n    \"accept\": \"application/vnd.volvocars.api.connected-vehicle.vehicledata.v1+json\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":140,"y":760,"wires":[["a1a9a1601861c46e"]]},{"id":"5ef424066ae3df34","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + flow.get(\"access_token\"),\n    \"Content-Type\": \"application/json\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":880,"wires":[["a33a22c82abd25f1"]]},{"id":"a33a22c82abd25f1","type":"http request","z":"63c0bc29bc8a38a5","name":"lock","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/commands/lock","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":880,"wires":[["84c2cabbf404e611"]]},{"id":"9bd4062acabd6252","type":"change","z":"63c0bc29bc8a38a5","name":"save global token","rules":[{"t":"set","p":"access_token","pt":"flow","to":"payload.access_token","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":140,"wires":[[]]},{"id":"13ea8a6277730da5","type":"inject","z":"63c0bc29bc8a38a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":880,"wires":[["5ef424066ae3df34"]]},{"id":"3e98ac7284292a27","type":"http request","z":"63c0bc29bc8a38a5","name":"unlock","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/commands/unlock","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":960,"wires":[["5200eaac936abc2b"]]},{"id":"18b4dd8acfeba7d9","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + flow.get(\"access_token\"),\n    \"Content-Type\": \"application/json\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\"\n}\nmsg.payload = { \"unlockDuration\": 120 }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":960,"wires":[["3e98ac7284292a27"]]},{"id":"d3381f63d46eb5a3","type":"inject","z":"63c0bc29bc8a38a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":960,"wires":[["18b4dd8acfeba7d9"]]},{"id":"84c2cabbf404e611","type":"debug","z":"63c0bc29bc8a38a5","name":"debug lock","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":880,"wires":[]},{"id":"5200eaac936abc2b","type":"debug","z":"63c0bc29bc8a38a5","name":"debug unlock","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":960,"wires":[]},{"id":"a6fe9869ef6bcee2","type":"ha-button","z":"63c0bc29bc8a38a5","name":"xc60.button.lock","version":0,"debugenabled":false,"outputs":1,"entityConfig":"386a96755b1ac874","outputProperties":[],"x":160,"y":840,"wires":[["5ef424066ae3df34"]]},{"id":"c144fbef805507d6","type":"ha-button","z":"63c0bc29bc8a38a5","name":"xc60.button.unlock","version":0,"debugenabled":false,"outputs":1,"entityConfig":"94d7b6e19c8ec5fb","outputProperties":[],"x":170,"y":920,"wires":[["18b4dd8acfeba7d9"]]},{"id":"2efe6b3ebe775079","type":"ha-button","z":"63c0bc29bc8a38a5","name":"xc60.button.refreshData","version":0,"debugenabled":false,"outputs":1,"entityConfig":"b6d85fce147a2039","outputProperties":[],"x":170,"y":40,"wires":[["b9779afddc93d95d"]]},{"id":"f4a55f45a6d39dd4","type":"ha-binary-sensor","z":"63c0bc29bc8a38a5","name":"xc60.carLocked","entityConfig":"db1605e3bab93381","version":0,"state":"payload.data.carLocked.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":500,"y":800,"wires":[[]]},{"id":"af9b0fd6e66c9f5a","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + flow.get(\"access_token\"),\n    \"Content-Type\": \"application/json\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\"\n}\nmsg.payload = { \"runtimeMinutes\": 5 }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":1080,"wires":[["f14ce0a72e0e8e79"]]},{"id":"f14ce0a72e0e8e79","type":"http request","z":"63c0bc29bc8a38a5","name":"climate-start","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/commands/climatization-start","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":1080,"wires":[["570fdb9827f3d7c6"]]},{"id":"4ddb14280a3136ef","type":"inject","z":"63c0bc29bc8a38a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1080,"wires":[["af9b0fd6e66c9f5a"]]},{"id":"8e0bf43bd2bfd399","type":"http request","z":"63c0bc29bc8a38a5","name":"climate-stop","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v2/vehicles/REPLACE_VIN_HERE/commands/climatization-stop","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":1160,"wires":[["2231105df76c7dc5"]]},{"id":"cb3b262a6a30586c","type":"function","z":"63c0bc29bc8a38a5","name":"inject headers","func":"msg.headers = {\n    Authorization: \"Bearer \" + flow.get(\"access_token\"),\n    \"Content-Type\": \"application/json\",\n    \"vcc-api-key\": \"REPLACE_VCC_API_KEY_HERE\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":1160,"wires":[["8e0bf43bd2bfd399"]]},{"id":"78c074d5b9f11ca4","type":"inject","z":"63c0bc29bc8a38a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1160,"wires":[["cb3b262a6a30586c"]]},{"id":"570fdb9827f3d7c6","type":"debug","z":"63c0bc29bc8a38a5","name":"debug climate-start","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":1080,"wires":[]},{"id":"2231105df76c7dc5","type":"debug","z":"63c0bc29bc8a38a5","name":"debug climate-stop","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":1160,"wires":[]},{"id":"a31191e414ac6365","type":"ha-button","z":"63c0bc29bc8a38a5","name":"xc60.button.climate-start","version":0,"debugenabled":false,"outputs":1,"entityConfig":"76732bdab554f68e","outputProperties":[],"x":190,"y":1040,"wires":[["af9b0fd6e66c9f5a"]]},{"id":"fd8e3f7e1069a800","type":"ha-button","z":"63c0bc29bc8a38a5","name":"xc60.button.climate-stop","version":0,"debugenabled":false,"outputs":1,"entityConfig":"022b692d012e1793","outputProperties":[],"x":190,"y":1120,"wires":[["cb3b262a6a30586c"]]},{"id":"73367129b6d7e045","type":"http request","z":"63c0bc29bc8a38a5","name":"warnings","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.volvocars.com/connected-vehicle/v1/vehicles/REPLACE_VIN_HERE/warnings","tls":"e04750ec16c492d6","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":160,"y":640,"wires":[["99d49bdedfe4b5b2","1c467836a4ea3f1f"]]},{"id":"99d49bdedfe4b5b2","type":"debug","z":"63c0bc29bc8a38a5","name":"debug warnings","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":340,"y":640,"wires":[]},{"id":"201ccbcebb7803c3","type":"ha-sensor","z":"63c0bc29bc8a38a5","name":"xc60.warnings","entityConfig":"f68f7e765627d28e","version":0,"state":"payload.data","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":640,"y":700,"wires":[[]]},{"id":"1c467836a4ea3f1f","type":"switch","z":"63c0bc29bc8a38a5","name":"","property":"payload.data","propertyType":"msg","rules":[{"t":"empty"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":700,"wires":[["8420256183d4e338"],["201ccbcebb7803c3"]]},{"id":"8420256183d4e338","type":"change","z":"63c0bc29bc8a38a5","name":"set if empty","rules":[{"t":"set","p":"payload.data","pt":"msg","to":"No warnings","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":680,"wires":[["201ccbcebb7803c3"]]},{"id":"1f9a306e4ea0a78c","type":"ha-binary-sensor","z":"63c0bc29bc8a38a5","name":"xc60.chargingConectionbinary","entityConfig":"fd4a2b93172da019","version":0,"state":"payload.data.chargingConnectionStatus.value","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":690,"y":520,"wires":[[]]},{"id":"bb81ff44b0eabc2b","type":"ha-binary-sensor","z":"63c0bc29bc8a38a5","name":"xc60.chargingStatusbinary","entityConfig":"168db5d09ca5d0a3","version":0,"state":"payload.data.chargingSystemStatus.value","stateType":"msg","attributes":[{"property":"Estimated charging time","value":"payload.data.estimatedChargingTime.value","valueType":"msg"}],"inputOverride":"allow","outputProperties":[],"x":800,"y":580,"wires":[[]]},{"id":"7aa36e6ae5f96d70","type":"function","z":"63c0bc29bc8a38a5","name":"to binaries","func":"\nif (msg.payload.data.chargingConnectionStatus.value.includes(\"CONNECTION_STATUS_DISCONNECTED\")) {\n    msg.payload.data.chargingConnectionStatus.value = \"off\";\n}\n\nif (msg.payload.data.chargingConnectionStatus.value.includes(\"CONNECTION_STATUS_CONNECTED\")) {\n    msg.payload.data.chargingConnectionStatus.value = \"on\";\n}\n\nif (msg.payload.data.chargingSystemStatus.value.includes(\"CHARGING_SYSTEM_CHARGING\")) {\n    msg.payload.data.chargingSystemStatus.value = \"on\";\n}\n\nif (msg.payload.data.chargingSystemStatus.value.includes(\"CHARGING_SYSTEM_UNSPECIFIED\")) {\n    msg.payload.data.chargingSystemStatus.value = \"off\";\n}\n\nif (msg.payload.data.chargingSystemStatus.value.includes(\"CHARGING_SYSTEM_IDLE\")) {\n    msg.payload.data.chargingSystemStatus.value = \"off\";\n}\n\n\nvar minutes = msg.payload.data.estimatedChargingTime.value;\nvar hours = Math.floor(minutes / 60);\nvar remainingMinutes = minutes % 60;\n\nvar formattedTime = ('0' + hours).slice(-2) + 'h:' + ('0' + remainingMinutes).slice(-2) + 'min';\n\nmsg.payload.data.estimatedChargingTime.value = formattedTime;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":560,"wires":[["1f9a306e4ea0a78c","bb81ff44b0eabc2b"]]},{"id":"e04750ec16c492d6","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false,"alpnprotocol":""},{"id":"bdb296329b836d7a","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.odometer","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.odometer"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"distance"},{"property":"unit_of_measurement","value":"km"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"c8b2f3f73256a16a","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.batteryChargeLevel","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.batteryChargeLevel"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"battery"},{"property":"unit_of_measurement","value":"%"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"db75ed4907249d8d","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.fuelAmount","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.fuelAmount"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"liters"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"575875e038160b10","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.distanceToEmpty","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.distanceToEmpty"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"distance"},{"property":"unit_of_measurement","value":"km"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"983caf3ac93d119e","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.electricRange","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.electricrange"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"distance"},{"property":"unit_of_measurement","value":"km"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"386a96755b1ac874","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.button.lock","version":"6","entityType":"button","haConfig":[{"property":"name","value":"xc60.button.lock"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"94d7b6e19c8ec5fb","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.button.unlock","version":"6","entityType":"button","haConfig":[{"property":"name","value":"xc60.button.unlock"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"b6d85fce147a2039","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.button.refreshData","version":"6","entityType":"button","haConfig":[{"property":"name","value":"xc60.button.refreshData"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"update"}],"resend":false,"debugEnabled":false},{"id":"db1605e3bab93381","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.carLocked","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"xc60.carLocked"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"lock"}],"resend":false,"debugEnabled":false},{"id":"76732bdab554f68e","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.button.climate-start","version":"6","entityType":"button","haConfig":[{"property":"name","value":"xc60.button.climate-start"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"022b692d012e1793","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.button.climate-stop","version":"6","entityType":"button","haConfig":[{"property":"name","value":"xc60.button.climate-stop"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"f68f7e765627d28e","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.warnings","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"xc60.warnings"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"fd4a2b93172da019","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.chargingConectionbinary","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"xc60.chargingConectionbinary"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"plug"}],"resend":false,"debugEnabled":false},{"id":"168db5d09ca5d0a3","type":"ha-entity-config","server":"fc54beec.590b1","deviceConfig":"","name":"xc60.chargingStatusbinary","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"xc60.chargingStatusbinary"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"entity_picture","value":""},{"property":"device_class","value":"battery_charging"}],"resend":false,"debugEnabled":false},{"id":"fc54beec.590b1","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","statusSeparator":"","enableGlobalContextStore":false}]

Thank you it workes great with my XC40 P8.

shillbom commented 1 year ago

Great. The node red setup works for me to! Now I can finally replace my "witchbot carkey button locker": image

I use this to "wake" my car at night when I enable my charger, otherwise the car is asleep and does not realise that the power is on...

HWiese1980 commented 1 year ago

Great. The node red setup works for me to! Now I can finally replace my "witchbot carkey button locker": image

I use this to "wake" my car at night when I enable my charger, otherwise the car is asleep and does not realise that the power is on...

Hacking at its best πŸ’―

josecarre commented 1 year ago

Great. The node red setup works for me to! Now I can finally replace my "witchbot carkey button locker": image

I use this to "wake" my car at night when I enable my charger, otherwise the car is asleep and does not realise that the power is on...

I'm happy to her that my flow is helping you!, but that lego-technics hack is a master piece, I'm a bit sad retiring such art :D

wixoff commented 1 year ago

Has anyone had success with this access in the North America region? The API info page says it’s not supported. But it also says that about all this.

Dielee commented 1 year ago

I'm working on a mqtt bridge for new AAOS cars. If someone is interested, I will make it public. Basic actions and sensors are already working.

Screenshot_20230616-072839.png

HWiese1980 commented 1 year ago

I'm working on a mqtt bridge for new AAOS cars. If someone is interested, I will make it public. Basic actions and sensors are already working.

Screenshot_20230616-072839.png

Absolutely! Go for it! Every bit helps

raftheunis87 commented 1 year ago

I'm working on a mqtt bridge for new AAOS cars. If someone is interested, I will make it public. Basic actions and sensors are already working.

Screenshot_20230616-072839.png

Yes please!!! πŸ‘ŒπŸ»

jesuisla91 commented 1 year ago

is there a way to close the windows and sunroof remotely?

Dielee commented 1 year ago

is there a way to close the windows and sunroof remotely?

No, not yet.

Dielee commented 1 year ago

It took some time, but now the first version should be usable. Take a look at here: https://github.com/Dielee/volvo2mqtt. Feel free to open feature requests and issues if something does not work!

pi4lab commented 1 year ago

It took some time, but now the first version should be usable. Take a look at here: https://github.com/Dielee/volvo2mqtt. Feel free to open feature requests and issues if something does not work!

Just installed Volvo2mqtt version 1.3.2 as a add-on on my RPi4 and i now finally have data on my XC40 MY2022 BEV (Fully Electric) in Home assistant. Works like a charm. Thanks for great work ! Look no further. :-)

XC40-2022-AAOS-2023-06-23 21-16-46

nikagl commented 1 year ago

While reviewing your code I noticed you have location too! Well done. I hadn't realised/noticed it yet, but also published the location API: https://developer.volvocars.com/apis/location/v1/overview/

Regards,

Nika.

Dielee commented 1 year ago

While reviewing your code I noticed you have location too! Well done. I hadn't realised/noticed it yet, but also published the location API: https://developer.volvocars.com/apis/location/v1/overview/

Regards,

Nika.

Jep, they just added location API. Maybe there is waiting something more to be released.

kernalkue commented 1 year ago

It took some time, but now the first version should be usable. Take a look at here: https://github.com/Dielee/volvo2mqtt. Feel free to open feature requests and issues if something does not work!

Just installed Volvo2mqtt version 1.3.2 as a add-on on my RPi4 and i now finally have data on my XC40 MY2022 BEV (Fully Electric) in Home assistant. Works like a charm. Thanks for great work ! Look no further. :-)

XC40-2022-AAOS-2023-06-23 21-16-46

Just added my 2022 XC40 BEV successfully too. You can definitely add it to your "Confirmed working with" list @Dielee. Great work! Thanks!

cybermaniapt commented 1 year ago

Very well done! worked perfectly on my XC60 (2023).

Already rearranged on my dashboard and added a location map.

Your work will me allow to create a few needed automations on my side:

Many thanks, will send something for a deserved coffee :) [image: image.png]

On Sat, 24 Jun 2023 at 14:24, kernalkue @.***> wrote:

It took some time, but now the first version should be usable. Take a look at here: https://github.com/Dielee/volvo2mqtt. Feel free to open feature requests and issues if something does not work!

Just installed Volvo2mqtt version 1.3.2 as a add-on on my RPi4 and i now finally have data on my XC40 MY2022 BEV (Fully Electric) in Home assistant. Works like a charm. Thanks for great work ! Look no further. :-)

[image: XC40-2022-AAOS-2023-06-23 21-16-46] https://user-images.githubusercontent.com/99322979/248379802-a0eeea43-ea79-472a-9d3b-1b93827e2b07.png

Just added my 2022 XC40 BEV successfully too. You can definitely add it to your "Confirmed working with" list @Dielee https://github.com/Dielee. Great work! Thanks!

β€” Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/61785#issuecomment-1605494552, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARTCKHGHV44GBYUNKTSH72LXM3TCRANCNFSM5KAO57KA . You are receiving this because you commented.Message ID: @.***>

jesuisla91 commented 1 year ago

Great ! it works on XC40(2021). Thank you so much

Dielee commented 1 year ago

Great ! it works on XC40(2021). Thank you so much

BEV?

jesuisla91 commented 1 year ago

rechargeable hybrid

jesuisla91 commented 1 year ago

What would be interesting is to have additional entities:

After that, having the option of remotely closing the windows and sunroof ... but that's not possible :)

Dielee commented 1 year ago

What would be interesting is to have additional entities:

  • all windows are closed
  • all doors including the tailgate are closed.
  • average fuel consumption.

After that, having the option of remotely closing the windows and sunroof ... but that's not possible :)

Please open a feature request!

ad0lf030 commented 1 year ago

Great!! It is working on a xc40 twin recharge 2021

Renko72 commented 1 year ago

Hello i have all so running the volvo2mqtt since 1 week , thanks for the work @Dielee @@ Hope you enjoyed my first cup of coffee :) Its running since monday on following versions: HA 2023.6.3 in a docker container volvo2mqtt 1.7.2 in a docker container
MQTT (Mosquito 2.0.15) in a docker container CAR = VOLVO XC 60 PHEV 2022 early odometer value i had to set to 10 for this car

One question to all , did you actual have all so some issues with the API Connect to volvo So today at approx. 17:00 the value from my odometer changed big from last 31240 to 312440 This was looking like it should be not like set to 10

So then i stopped the volvo2Mqtt Docker and start it new to see which data i get when i start it new After that i get now following error and the docker container will no longer start :( The day before i made all so some restarts of my server regarding other issues there the start of volvo2mqtt was o.k. without errors

image

Did someone has actual the same effect , actual it looks like the volvo api changed something or i do not longer have access

I actual checked login with my Volvo Account user and pw and i checked all so if the api is still valid in the Volvo Depeloper Website . SO token should be still actoiv and has enough request open

image

Dielee commented 1 year ago

Hello i have all so running the volvo2mqtt since 1 week , thanks for the work @Dielee @@ Hope you enjoyed my first cup of coffee :) Its running since monday on following versions: HA 2023.6.3 in a docker container volvo2mqtt 1.7.2 in a docker container
MQTT (Mosquito 2.0.15) in a docker container CAR = VOLVO XC 60 PHEV 2022 early odometer value i had to set to 10 for this car

One question to all , did you actual have all so some issues with the API Connect to volvo So today at approx. 17:00 the value from my odometer changed big from last 31240 to 312440 This was looking like it should be not like set to 10

So then i stopped the volvo2Mqtt Docker and start it new to see which data i get when i start it new After that i get now following error and the docker container will no longer start :( The day before i made all so some restarts of my server regarding other issues there the start of volvo2mqtt was o.k. without errors

image

Did someone has actual the same effect , actual it looks like the volvo api changed something or i do not longer have access

I actual checked login with my Volvo Account user and pw and i checked all so if the api is still valid in the Volvo Depeloper Website . SO token should be still actoiv and has enough request open

image

Please open an issue for this!

This issue seems to be related to this

fars-fede-fire commented 11 months ago

I have started creating a Volvo integration. It can be added using HACS custom repo. It is still a work in progress! Check it out at: https://github.com/fars-fede-fire/volvoaaos

Dielee commented 11 months ago

I have started creating a Volvo integration. It can be added using HACS custom repo. It is still a work in progress! Check it out at: https://github.com/fars-fede-fire/volvoaaos

There is an existing integration: https://github.com/Dielee/volvo2mqtt

fars-fede-fire commented 11 months ago

Thanks, I have seen that before. But as I understand you need both to install something in Docker and have a MQTT broker?

andynash commented 9 months ago

Thanks, I have seen that before. But as I understand you need both to install something in Docker and have a MQTT broker?

Correct, I have stuck with my yaml REST solution for now as I'm not yet using MQTT for anything and don't want to complicate HA further - I'm using Core so cannot install add-ons.

Look forward to seeing where you take your AAOS integration - think there can be room for both native and MQTT integrations - GivEnergy being a good example where both co-exist.

For both integrations, have you noticed Volvo have recently provided "Release Notes" for the Connected Vehicle API? This includes some significant changes including simplification and deprecation (which bodes well for a more active and sensible approach to APIs from Volvo 🀞). I've updated Postman to reflect these...

The Volvo commands may also be a good use case for the new HA capability which allows services to return data.

JoaquimPinto commented 7 months ago

https://github.com/Dielee/volvo2mqtt

@Dielee Thanks a lot for your work.

I had a V60 D4 2020, plus HA running on a RPi3 and the normal integration was working. now i change to XC40 pure electric, plus HA running on a Container on NAS Synology... Now i strugling to make it work. I'm a newbie using HA add ons/ integration on the HA docker version, RPi is straight foward... I have similar config as @Renko72 HA in a docker container volvo2mqtt in a docker container MQTT in a docker container

although i cannot add/find/make it work on the HA. Could some one help me?

Thanks

Renko72 commented 7 months ago

Hello @

https://github.com/Dielee/volvo2mqtt

@Dielee Thanks a lot for your work.

I had a V60 D4 2020, plus HA running on a RPi3 and the normal integration was working. now i change to XC40 pure electric, plus HA running on a Container on NAS Synology... Now i strugling to make it work. I'm a newbie using HA add ons/ integration on the HA docker version, RPi is straight foward... I have similar config as @Renko72 HA in a docker container volvo2mqtt in a docker container MQTT in a docker container

although i cannot add/find/make it work on the HA. Could some one help me?

Thanks

@JoaquimPinto on the weekend we can contact then i can try to help you getting the version ruinning on your home assistant

JoaquimPinto commented 7 months ago

Thanks, i apreciate all the help to learn a bit more.

Renko72 commented 7 months ago

@JoaquimPinto are you online ?

JoaquimPinto commented 7 months ago

Hi, sorry, i was at work, i have tried to login but i didnt had the opportunity.

Today i have to work again, i write here if i can join online.

thanks

JoaquimPinto commented 7 months ago

I think, i have 2 issues, first the Volvo2mqtt is not connecting to the Volvo server "fully" due "invalid VCC-API-KEY", second i think the connetion Mosquitto broker with Volvo2mqtt is not happening. I create a new person/user, with same user/pass, as previous defined on all settings for the Mosquitto broker and Volvo2mqtt, at the NAS config i linked all 3 container - Mosquitto with HA, and Volvo2mqtt with Mosquitto broker and HA. I have tried to - add devide / add integration - MQTT, but it always fail to connect to Broker. any idea?

Renko72 commented 7 months ago

First one question you have on your HA only one MQTT Connection configured ? Because when i started with the integration i had a other system running which was all so using a mqtt connection to a other Adress and regarding my informration it can handle only one connection

JoaquimPinto commented 7 months ago

That's my issue, i cannot make any MQTT connection.

JoaquimPinto commented 7 months ago

i followed this link - https://www.homeautomationguy.io/blog/docker-tips/configuring-the-mosquitto-mqtt-docker-container-for-use-with-home-assistant - to make my container, i tried with and without password, but last step always with connection failed

JoaquimPinto commented 7 months ago

Screenshot 2024-01-28 at 10 10 48 this is all what i have a the moment

Renko72 commented 7 months ago

I cannot see the MQTT integration on your screenshot

One question did you try to connect to your MQTT Docker Container over the MQTT Explorer to check if the connection works https://mqtt-explorer.com/

JoaquimPinto commented 7 months ago

Thanks, Once the connection of the MQTT intregation between the MQTT broker Mosquitto is always failing, the integration doesnt "stay" on the installed. I will try to tomorow this MQTT Explorer, to try to understatnd the issue, and maybe start over to understand the issues. I will bring updates.

JoaquimPinto commented 7 months ago

Hello all, Just an update. After several lost trying to reconfigure the Mosquitto Broker, i just create a new one from scratch, and it work out. than i went back to the old one, and it seems the problem was the user/pass wrong confirgure. Now its working, just need to clean the all mess/tries i created, without destroing the working on. eheh Thanks for the support. The MQTT Explorer tip was very important to understand the issue. Thanks

acoutts commented 7 months ago

Looks like USA is not supported: https://developer.volvocars.com/terms-and-conditions/apis-supported-locations/

I had an old api key I generated last year. I tried the addon today and was getting 404 on every request. I deleted and generated a new api key and now i simply get "Error getting vehicles: 401. Access denied due to invalid VCC-API-KEY. Make sure to provide a valid key for an active application."

I guess volvo has turned off the api for US.. bummer