Python Plugin: Volvo EV

Python and python framework

Moderator: leecollings

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

Re: Python Plugin: Volvo EV

Post by akamming »

piefje wrote: Wednesday 08 May 2024 14:17 2024-05-08 14:16:07.352 xc60: INFO: retreived a XC60, **********, model year 2021
2024-05-08 14:16:07.352 xc60: ERROR: Selected vin is not an EV, not supported by this plugin
2024-05-08 14:16:07.353 xc60: INFO: Updating Devices
2024-05-08 14:16:07.668 xc60: ERROR: VolvoAPI failed calling https://api.volvocars.com/energy/v1/veh ... rge-status, HTTP Statuscode 404
2024-05-08 14:16:07.672 xc60: ERROR: Reponse: {'status': 404, 'operationId': '0e6f0f29-f141-4796-8a7e-534114c9aef9', 'error': {'message': 'NOT_FOUND', 'description': 'Car model is not supported'}}
2024-05-08 14:16:07.672 xc60: ERROR: Updating Recharge Status failed
It’s an ev plug-in. So it only supports electric vehicles… Will not work on your car model
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Python Plugin: Volvo EV

Post by Xavier82 »

Hi,

I own a Volvo XC60 2021 car, non electric, but I liked the Domoticz Volvo Plugin, so I have enhanced the original plugin of "akamming".

I have added a feature to support other vehicules with other fuel types.
Based on the fuel type different devices are created. If non-electric then no devices about recharge are created in Domoticz.
Though I encounter 4 or 5 issues:
1. Tanklid sensor/switch is not updated
2. Carlock update sensor not working
3. Volvo-Climatization switch update not working
4. Volvo-engineStatus switch update not working
5. Getting this error in Domoticz:

Code: Select all

2024-05-13 14:39:38.683 Error: Volvo: (CUnitEx_update) Failed to parse parameters: 'Log' and/or 'TypeName' expected.
2024-05-13 14:39:38.683 Error: Volvo: Call to function 'CUnitEx_update' failed, exception details:
2024-05-13 14:39:38.683 Error: Volvo: Exception: 'TypeError'. No traceback available.
I have created a seperated repository which can be found at:
https://github.com/Xavier82/Domoticz_Volvo_Plugin

Any help in fixing these issues would be great.

All other features, sensors, switches, etc. are working fine and are updated (90 seconds default).

The reason that I use this plugin is because the default Volvo app on my smartphone doesn't have pushnotifications for when car is used, as a kind of "alarm" feature when car is moving/started not done by myself/wife, in case of theft.

I hope others are able to use this to.
akamming
Posts: 368
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

Xavier82 wrote: Monday 13 May 2024 14:46 Hi,

I own a Volvo XC60 2021 car, non electric, but I liked the Domoticz Volvo Plugin, so I have enhanced the original plugin of "akamming".

I have added a feature to support other vehicules with other fuel types.
Based on the fuel type different devices are created. If non-electric then no devices about recharge are created in Domoticz.
Though I encounter 4 or 5 issues:
1. Tanklid sensor/switch is not updated
2. Carlock update sensor not working
3. Volvo-Climatization switch update not working
4. Volvo-engineStatus switch update not working
5. Getting this error in Domoticz:

Code: Select all

2024-05-13 14:39:38.683 Error: Volvo: (CUnitEx_update) Failed to parse parameters: 'Log' and/or 'TypeName' expected.
2024-05-13 14:39:38.683 Error: Volvo: Call to function 'CUnitEx_update' failed, exception details:
2024-05-13 14:39:38.683 Error: Volvo: Exception: 'TypeError'. No traceback available.
I have created a seperated repository which can be found at:
https://github.com/Xavier82/Domoticz_Volvo_Plugin

Any help in fixing these issues would be great.

All other features, sensors, switches, etc. are working fine and are updated (90 seconds default).

The reason that I use this plugin is because the default Volvo app on my smartphone doesn't have pushnotifications for when car is used, as a kind of "alarm" feature when car is moving/started not done by myself/wife, in case of theft.

I hope others are able to use the to.
Nice that you like the plugin.

Very Not nice that you copy my plugin to a new repository without any reference to the original.

If you really like the pluging and want to improve it, then feel free to develop and as soon as you have fixed it for the XC60 PHEV, you create a PR on the original repository, so we can all benefit from better code and not have competing sources.

So please remove this repository you created (you can always create one with the normal forking mechanism) and instead create a PR for the changes you made to make it work on a PHEV. I will review and merge

EDIT:
I just checked but i published the code under GPL3, which prohibits the action you just did. so pls revert...
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Python Plugin: Volvo EV

Post by Xavier82 »

Sorry for that.
I removed my repository, I think I did it now correctly, I forked yours and placed an update.
My XC60 model is from 2021 and is a Mild-Hybrid model.
With my update it is now possible to select different fuel types.

Still having the mentioned issues,
akamming
Posts: 368
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

tx,

when you have figured it out, create a PR, will review and merge!

BTW: based on input of another user i just made a change which should allow PHEV (so also XC60) in the plugin. I have no idea if it works, cause i cannot test myself..
User avatar
FireWizard
Posts: 1887
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 @akamming,

You wrote:
BTW: based on input of another user i just made a change which should allow PHEV (so also XC60) in the plugin. I have no idea if it works, cause i cannot test myself.
Unfortunately I have to confirm, that it will NOT work.
I own a Volvo XC40 PHEV 2023 and it used to work until 2024-02-14,15:00 h.
Suddenly they changed something at the Volvo server and since then all Energy API endpoints return:

Screenshot_Volvo-Energy-API.png
Screenshot_Volvo-Energy-API.png (11.6 KiB) Viewed 2440 times
This is the same for all Energy API endpoints.

Hope they will reverse that change someday or maybe a firmware update of my Volvo will change it.

Regards
akamming
Posts: 368
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

FireWizard wrote: Monday 13 May 2024 19:49 Unfortunately I have to confirm, that it will NOT work.
I own a Volvo XC40 PHEV 2023 and it used to work until 2024-02-14,15:00 h.
Suddenly they changed something at the Volvo server and since then all Energy API endpoints return:


Screenshot_Volvo-Energy-API.png

This is the same for all Energy API endpoints.

Hope they will reverse that change someday or maybe a firmware update of my Volvo will change it.

Regards
on github the other user reported it does work for a XC60 PHEV (https://github.com/akamming/Domoticz_Vo ... 108473784_)

what is the output for your car for the verhicle api ? (https://api.volvocars.com/connected-veh ... hicles/VIN)

EDIT:

I found the cause why it does not work for XC40 PHEV: On this link you can find the supported models for the energy api:
https://developer.volvocars.com/apis/en ... ailability

This states:
List of supported cars:

XC40 and C40 BEV.
XC60 PHEV, S90 PHEV, V90 PHEV from model year 2022.
XC90 PHEV, S60 PHEV, V60 PHEV from model year 2023.
akamming
Posts: 368
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

i did an update to the plugin: It now calculates used and charged energy in 2 kwh counter devices.

The feature is still experimental, but i would like to get your feedback on if it calculates correctly...

to update the plugin
- go to the directory of this plugin
- give a "git pull" command
- restart domoticz
HvdW
Posts: 612
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: Python Plugin: Volvo EV

Post by HvdW »

For me the plugin doesn't update lately.
Today I uninstalled and reinstalled the plugin.
No success.
The log file doesn't complain except for ignoring ABRP
Any suggestions about what might be wrong?
Bugs bug me.
akamming
Posts: 368
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

Switch on debugging in the plugin config and inspect the logfile.
HvdW
Posts: 612
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: Python Plugin: Volvo EV

Post by HvdW »

HvdW wrote: Tuesday 25 June 2024 20:19 The log file doesn't complain except for ignoring ABRP
Meanwhile I have discovered what's wrong.
The car is offline. :(
This being offline has other effects.
Navigation doesn't show actual traffic (jams) anymore.
Bugs bug me.
akamming
Posts: 368
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

HvdW wrote: Wednesday 26 June 2024 10:36
HvdW wrote: Tuesday 25 June 2024 20:19 The log file doesn't complain except for ignoring ABRP
Meanwhile I have discovered what's wrong.
The car is offline. :(
This being offline has other effects.
Navigation doesn't show actual traffic (jams) anymore.
Check, tcam reset / infotainment reset mostly helps in that’s case…
User avatar
FireWizard
Posts: 1887
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 »

Hi @akamming,

To avoid these kind of issues, I suggest that your plugin uses the "Get accessibility status" endpoint.
See: https://developer.volvocars.com/apis/co ... ity-status

In case this endpoint returns UNAVAILABLE, you can issue a warning.

Regards
akamming
Posts: 368
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

FireWizard wrote: Friday 28 June 2024 16:06 Hi @akamming,

To avoid these kind of issues, I suggest that your plugin uses the "Get accessibility status" endpoint.
See: https://developer.volvocars.com/apis/co ... ity-status

In case this endpoint returns UNAVAILABLE, you can issue a warning.

Regards
a check, that's a good idea, although i do not know if all of theses statuses need to be a warning. If the car is in use, it will also be unavailable, but that's "normal" behaviour, you don't want to warn for. But i get your point, in the upcoming days somehwere i will add this call...
User avatar
FireWizard
Posts: 1887
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 »

Hi,

I don't think you need all warnings, but I think POWER_SAVING_MODE is the most important, as this happens if the car is not in use for a number of days (I think it is 5 days)
Of course you can use the field availabilityStatus.unavailableReason as the data to present, but that's up to you.

Regards
akamming
Posts: 368
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

FireWizard wrote: Friday 28 June 2024 16:29 Hi,

I don't think you need all warnings, but I think POWER_SAVING_MODE is the most important, as this happens if the car is not in use for a number of days (I think it is 5 days)
Of course you can use the field availabilityStatus.unavailableReason as the data to present, but that's up to you.

Regards
i now implemented it pretty general:
- added 2 selector switches which represent availability, so people can use their own scripting using these statuses
- added an error in the log if the car is unavaible (which also prints the json output of the availability status, so debugging is possible)

let's see what happens over time with the statuses, maybe i can the finetune the logic a bit more..
rensbr
Posts: 62
Joined: Friday 27 July 2018 19:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by rensbr »

I'm trying to connect my Volvo EX30 to Domoticz with this plugin, just see if it works. But it seems that it is not possible to register an app trought the Volvo website, I'm getting a 'no healthy upstream' error message when I'm logging into Github, i also tried my Volvo account, but i get the same error. What do I do wrong?
akamming
Posts: 368
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

rensbr wrote: Thursday 12 September 2024 8:18 I'm trying to connect my Volvo EX30 to Domoticz with this plugin, just see if it works. But it seems that it is not possible to register an app trought the Volvo website, I'm getting a 'no healthy upstream' error message when I'm logging into Github, i also tried my Volvo account, but i get the same error. What do I do wrong?
The ex30 has no api support (yet) by Volvo.
rensbr
Posts: 62
Joined: Friday 27 July 2018 19:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by rensbr »

akamming wrote: Thursday 12 September 2024 8:43
rensbr wrote: Thursday 12 September 2024 8:18 I'm trying to connect my Volvo EX30 to Domoticz with this plugin, just see if it works. But it seems that it is not possible to register an app trought the Volvo website, I'm getting a 'no healthy upstream' error message when I'm logging into Github, i also tried my Volvo account, but i get the same error. What do I do wrong?
The ex30 has no api support (yet) by Volvo.
This Home Assistant plugin works since a few days. Is the logic behind that plugin different than the Domoticz plugin?
akamming
Posts: 368
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

I don’t know the code of that solution, but I would assume it uses the same API’s

I just checked the docs )https://developer.volvocars.com/apis/en ... ailability ) and indeed Volvo added the ex30 to the list of supported cars

So in theory it should work now indeed…

I don’t know why you get the error message on the Volvo site: but I would suggest creating an entirely new account on the Volvo developer site…
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest