Python Plugin: Volvo EV

Python and python framework

Moderator: leecollings

Post Reply
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Python Plugin: Volvo EV

Post by akamming »

Hi,

started working on the Volvo API's

it's still very experimental and doesn't have a lot of sensor yet, but give it a try if you own a Volvo (X)C40 Pure Electric (Twin).

to install
- go to <domoticz dir>/plugins
- git clone https://github.com/akamming/Domoticz_Vo ... rge_Plugin
- restart domoticz
- add hardware (Volvo Recharge (Full EV))
- configure VCC Key (can be acquired by registring an application on https://developer.volvocars.com/apis/do ... g-started/, Volvo on Call username and password
- and enjoy (for now just range en battery percentage, but more will be added)
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Volvo EV

Post by heggink »

Nice. I have an xc40 recharge and would love to be able to set charge timers from domoticz since the hourly electricity rates are already in my domoticz system.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
kiddigital
Posts: 435
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Python Plugin: Volvo EV

Post by kiddigital »

Hi @akamming , not sure if interesting/useful.. a while back I started some development on the Volvo-on-call API for another Volvo driver... it is native C++ hardware for Domoticz...

look at : https://github.com/kiddigital/domoticz/ ... olvooncall

Feel free to use it if interesting...
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

kiddigital wrote: Saturday 11 February 2023 20:37 Hi @akamming , not sure if interesting/useful.. a while back I started some development on the Volvo-on-call API for another Volvo driver... it is native C++ hardware for Domoticz...

look at : https://github.com/kiddigital/domoticz/ ... olvooncall

Feel free to use it if interesting...
This is definitely very interesting!

Question: This one is also referring to clientid and client secret from development console. Volvo did not approve my app , since i am not a company and therefor they stated they cannot approve an app because i'm not a legal entity... (has to do with liablity etc..)

What would have been the procedure in this case to get the client secret (apparently there has to be a legal entity with terms and conditions)
User avatar
kiddigital
Posts: 435
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Python Plugin: Volvo EV

Post by kiddigital »

Good question, no idea.

Looks like Volvo has a little different view on how to accept ‘clients/apps’ in comparison to others like Daimler, Tesla, Kia, etc.

For those, as an individual (without a legal entity) you can register yourself as a developer and access the data of your own car via the API’s.

That is why every user of these modules have to register themselves and get there own ClientId and ClientSecret.

Seems that Volvo does not provide this to Volvo car owners? Only to registered companies?

Maybe send them a mail and ask for an explanation why they have a different approach?
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

kiddigital wrote: Sunday 12 February 2023 9:23
Seems that Volvo does not provide this to Volvo car owners? Only to registered companies?

Maybe send them a mail and ask for an explanation why they have a different approach?
already asked them some time ago. Their reply was:
Thank you for the email.

As I mentioned in the previous one, our progressions with the clients are done on case-by-case basis, currently. And it highly involves adherences to GDPR and legal compliances – which our data protection officers and legal advocates have directed us to follow while creating applications.

While we encourage Open source solutions, being developer friendly - our aim is to support wide range of community. But due to our practical and administrative reasons attributing to the aforementioned compliance regulations, we are unfortunately feeling sorry in not processing with this approval further, at this point in time.

Hope you can understand the situation, looking forward to fix this for open source and will immediately come back to you with more support.
User avatar
kiddigital
Posts: 435
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Python Plugin: Volvo EV

Post by kiddigital »

Bummer.. seems like Volvo’s legal and compliance people look at things differently than others.

So, dead-end?
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

kiddigital wrote: Monday 13 February 2023 6:41 Bummer.. seems like Volvo’s legal and compliance people look at things differently than others.

So, dead-end?
Only way i can think of is that of Volvo Gers more requests they might start thinking differently…

Would it be an option for readers who read this to start registrering apps at https://developer.volvocars.com/apis/do ... g-started/ and asking for approvals? Hooefully we’ll convince them if they get more than one request

EDIT:

I just tried again, hopefully their policy changed already ;-)
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

No reply from Volvo yet,

but some news: i think i finished the plugin using the current workaround (don't know how long Volvo will keep that loophole open. According to their docs the API should not work now ;) ), at least it seams quite stable now are there (X)C40 Pure electric owners here on the forum who would like to try if the plugin works for them as well?

Install instructions are in the 1st message of this thread
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Volvo EV

Post by heggink »

Installed and works like a charm. Would be brilliant if the charge planning could be set as well.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

heggink wrote: Monday 20 February 2023 12:21 Installed and works like a charm. Would be brilliant if the charge planning could be set as well.
agreed, unfortunately that API is not released to dev community...

it should be there, since you can this using the app. But in official docs(https://developer.volvocars.com/apis/) i have not yet found this functionality...
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Python Plugin: Volvo EV

Post by heggink »

Has this api been changed? Since a while, the plugin won;t work reporting a keyrror 'hood'..
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

heggink wrote: Tuesday 28 March 2023 14:48 Has this api been changed? Since a while, the plugin won;t work reporting a keyrror 'hood'..
hmmm... tx for noticing, just checked. Mine gives error too, and indeed just noticed output of API changed resulting in the plugin giving an error

bit busy now, will fix somewhere this week.
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

Fixed with latest commit
Naqua
Posts: 6
Joined: Thursday 11 August 2016 17:44
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by Naqua »

i get errors (below) login goes well. Anything i'm doing wrong?

2023-03-29 20:37:17.079 Volvo: INFO: Updating Devices
2023-03-29 20:37:17.458 Error: Volvo: Call to function 'onHeartbeat' failed, exception details:
2023-03-29 20:37:17.460 Error: Volvo: Traceback (most recent call last):
2023-03-29 20:37:17.460 Error: Volvo: File "/home/pi/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 681, in onHeartbeat
2023-03-29 20:37:17.460 Error: Volvo: _plugin.onHeartbeat()
2023-03-29 20:37:17.460 Error: Volvo: File "/home/pi/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 646, in onHeartbeat
2023-03-29 20:37:17.460 Error: Volvo: Heartbeat()
2023-03-29 20:37:17.461 Error: Volvo: File "/home/pi/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 477, in Heartbeat
2023-03-29 20:37:17.461 Error: Volvo: GetRechargeStatus()
2023-03-29 20:37:17.461 Error: Volvo: File "/home/pi/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 371, in GetRechargeStatus
2023-03-29 20:37:17.461 Error: Volvo: int(RechargeStatus["data"]["electricRange"]["value"]),
2023-03-29 20:37:17.461 Error: Volvo: KeyError: 'electricRange'
2023-03-29 20:37:21.246 Smartmeter: P1 Smart Meter (Electriciteit)
2023-03-29 20:37:21.282 Smartmeter: Usage (Usage L1)
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

i have no idea. At my side it's working fine...

Can you set debug to all (a setting in the plugin config). You might get more logging which will indicate the issue...
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

New Version available

(just do "git pull" and restart domoticz to upgrade, otherwise follow instruction in the above post)

Now contains ODOmeter and sends SOC to ABRP (if configured. Check github page for how to make setup).

Curious if this plugin is used and what your findings are..
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Volvo EV

Post by waltervl »

akamming wrote: Thursday 04 May 2023 10:37 Curious if this plugin is used and what your findings are..
https://docs.github.com/en/repositories ... repository
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
akamming
Posts: 337
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

waltervl wrote: Thursday 04 May 2023 10:53
akamming wrote: Thursday 04 May 2023 10:37 Curious if this plugin is used and what your findings are..
https://docs.github.com/en/repositories ... repository
tx..that's a good tip! (not a pro user, just a hobby dev ;-))
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Python Plugin: Volvo EV

Post by FireWizard »

Hello @kamming,

Did you come any further with the plugin for Volvo?

The reason I ask this, is that I succeeded the get the Connected AP v2 up and running, but not the Extended API, the Energy API and the Location API.

I did not try the Connected API v1, as this will be deprecated in a couple of month.

The Energy API does not give any data, but connects. The reason is probably that my car is a
XC40 PHEV and not a BEV. The other 2 give a "scope" error.

The Demo car and my own car, with the created authorization from the Volvo developer portal works fine.

Regards
.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest