Python Plugin: Volvo EV

Python and python framework

Moderator: leecollings

User avatar
mvveelen
Posts: 721
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Python Plugin: Volvo EV

Post by mvveelen »

Sorry, haven't done anything with Github. At least not for the last years.

Code: Select all

diff --git a/plugin.py b/plugin.py
index ead9b6d..ff2300d 100644
--- a/plugin.py
+++ b/plugin.py
@@ -314,52 +314,52 @@ def CheckRefreshToken():
         else:
             Debug("Not logged in, retrying in "+str(MINTIMEBETWEENLOGINATTEMPTS-(time.time()-lastloginattempttimestamp))+" seconds")
 
-def VolvoAPI(url,mediatype):
+def VolvoAPI(url, mediatype):
     global vin
 
-    Debug("VolvoAPI("+url+","+mediatype+") called")
+    Debug("VolvoAPI(" + url + "," + mediatype + ") called")
     try:
-        starttime=datetime.datetime.now()
+        starttime = datetime.datetime.now()
         status = requests.get(
             url,
-            headers= {
+            headers={
                 "accept": mediatype,
                 "vcc-api-key": vccapikey,
                 "Authorization": "Bearer " + access_token
             },
             timeout=TIMEOUT
         )
-        endtime=datetime.datetime.now()
+        endtime = datetime.datetime.now()
 
         Debug("\nResult:")
         Debug(status)
-        Debug("Result took "+str(endtime-starttime))
+        Debug("Result took " + str(endtime - starttime))
 
         try:
             resp_json = status.json()
         except Exception as json_error:
-            Error("Response from "+url+" is not valid JSON: "+str(json_error))
-            output=status.text
-            Error("Raw response: "+output)
-            UpdateTextSensor(Parameters["Name"],APISTATUS,APISTATUSNAME,f"API Error: {output}")
+            Error("Response from " + url + " is not valid JSON: " + str(json_error))
+            output = status.text if status is not None else ""
+            Error("Raw response: " + output)
+            UpdateTextSensor(Parameters["Name"], APISTATUS, APISTATUSNAME, f"API Error: {output}")
             return None
 
         if status.status_code != 200:
-            Error("VolvoAPI failed calling "+url+", HTTP Statuscode "+str(status.status_code))
-            Error("Response: "+json.dumps(resp_json, indent=4))
-            output=status.text
-            UpdateTextSensor(Parameters["Name"],APISTATUS,APISTATUSNAME,f"API Error: {output}")
+            Error("VolvoAPI failed calling " + url + ", HTTP Statuscode " + str(status.status_code))
+            Error("Response: " + json.dumps(resp_json, indent=4))
+            output = status.text
:
RPi3b+/RFXCOM rfxtrx433E/Shelly/Sonoff Zigbee Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
akamming
Posts: 427
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

mvveelen wrote: Friday 07 November 2025 21:31 Sorry, haven't done anything with Github. At least not for the last years.

Code: Select all

diff --git a/plugin.py b/plugin.py
index ead9b6d..ff2300d 100644
--- a/plugin.py
+++ b/plugin.py
@@ -314,52 +314,52 @@ def CheckRefreshToken():
         else:
             Debug("Not logged in, retrying in "+str(MINTIMEBETWEENLOGINATTEMPTS-(time.time()-lastloginattempttimestamp))+" seconds")
 
-def VolvoAPI(url,mediatype):
+def VolvoAPI(url, mediatype):
     global vin
 
-    Debug("VolvoAPI("+url+","+mediatype+") called")
+    Debug("VolvoAPI(" + url + "," + mediatype + ") called")
     try:
-        starttime=datetime.datetime.now()
+        starttime = datetime.datetime.now()
         status = requests.get(
             url,
-            headers= {
+            headers={
                 "accept": mediatype,
                 "vcc-api-key": vccapikey,
                 "Authorization": "Bearer " + access_token
             },
             timeout=TIMEOUT
         )
-        endtime=datetime.datetime.now()
+        endtime = datetime.datetime.now()
 
         Debug("\nResult:")
         Debug(status)
-        Debug("Result took "+str(endtime-starttime))
+        Debug("Result took " + str(endtime - starttime))
 
         try:
             resp_json = status.json()
         except Exception as json_error:
-            Error("Response from "+url+" is not valid JSON: "+str(json_error))
-            output=status.text
-            Error("Raw response: "+output)
-            UpdateTextSensor(Parameters["Name"],APISTATUS,APISTATUSNAME,f"API Error: {output}")
+            Error("Response from " + url + " is not valid JSON: " + str(json_error))
+            output = status.text if status is not None else ""
+            Error("Raw response: " + output)
+            UpdateTextSensor(Parameters["Name"], APISTATUS, APISTATUSNAME, f"API Error: {output}")
             return None
 
         if status.status_code != 200:
-            Error("VolvoAPI failed calling "+url+", HTTP Statuscode "+str(status.status_code))
-            Error("Response: "+json.dumps(resp_json, indent=4))
-            output=status.text
-            UpdateTextSensor(Parameters["Name"],APISTATUS,APISTATUSNAME,f"API Error: {output}")
+            Error("VolvoAPI failed calling " + url + ", HTTP Statuscode " + str(status.status_code))
+            Error("Response: " + json.dumps(resp_json, indent=4))
+            output = status.text
:
I see what you did, i made a similar change now in the repository (but gives a bit more info tot the API Error field). I cannot test, since i never have this issue, so please update your plugin to the latest code and let me know the results...
User avatar
mvveelen
Posts: 721
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Python Plugin: Volvo EV

Post by mvveelen »

Done, but after a while:

Code: Select all

2025-11-08 10:54:32.875 Error: Volvo: Call to function 'onHeartbeat' failed, exception details:
2025-11-08 10:54:32.878 Error: Volvo: Traceback (most recent call last):
2025-11-08 10:54:32.878 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1712, in onHeartbeat
2025-11-08 10:54:32.878 Error: Volvo: _plugin.onHeartbeat()
2025-11-08 10:54:32.878 Error: Volvo: ~~~~~~~~~~~~~~~~~~~^^
2025-11-08 10:54:32.878 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1677, in onHeartbeat
2025-11-08 10:54:32.878 Error: Volvo: Heartbeat()
2025-11-08 10:54:32.878 Error: Volvo: ~~~~~~~~~^^
2025-11-08 10:54:32.878 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1426, in Heartbeat
2025-11-08 10:54:32.878 Error: Volvo: UpdateDevices()
2025-11-08 10:54:32.878 Error: Volvo: ~~~~~~~~~~~~~^^
2025-11-08 10:54:32.878 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1388, in UpdateDevices
2025-11-08 10:54:32.878 Error: Volvo: UpdateLastKnownLocation()
2025-11-08 10:54:32.878 Error: Volvo: ~~~~~~~~~~~~~~~~~~~~~~~^^
2025-11-08 10:54:32.878 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1332, in UpdateLastKnownLocation
2025-11-08 10:54:32.878 Error: Volvo: TripSpeed=int(((Triplength*1000.0)/TripDuration.total_seconds())*3.6)
2025-11-08 10:54:32.878 Error: Volvo: ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-11-08 10:54:32.878 Error: Volvo: ZeroDivisionError: float division by zero
RPi3b+/RFXCOM rfxtrx433E/Shelly/Sonoff Zigbee Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
akamming
Posts: 427
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

mvveelen wrote: Saturday 08 November 2025 11:48 Done, but after a while:

Code: Select all

2025-11-08 10:54:32.875 Error: Volvo: Call to function 'onHeartbeat' failed, exception details:
2025-11-08 10:54:32.878 Error: Volvo: Traceback (most recent call last):
2025-11-08 10:54:32.878 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1712, in onHeartbeat
2025-11-08 10:54:32.878 Error: Volvo: _plugin.onHeartbeat()
2025-11-08 10:54:32.878 Error: Volvo: ~~~~~~~~~~~~~~~~~~~^^
2025-11-08 10:54:32.878 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1677, in onHeartbeat
2025-11-08 10:54:32.878 Error: Volvo: Heartbeat()
2025-11-08 10:54:32.878 Error: Volvo: ~~~~~~~~~^^
2025-11-08 10:54:32.878 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1426, in Heartbeat
2025-11-08 10:54:32.878 Error: Volvo: UpdateDevices()
2025-11-08 10:54:32.878 Error: Volvo: ~~~~~~~~~~~~~^^
2025-11-08 10:54:32.878 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1388, in UpdateDevices
2025-11-08 10:54:32.878 Error: Volvo: UpdateLastKnownLocation()
2025-11-08 10:54:32.878 Error: Volvo: ~~~~~~~~~~~~~~~~~~~~~~~^^
2025-11-08 10:54:32.878 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1332, in UpdateLastKnownLocation
2025-11-08 10:54:32.878 Error: Volvo: TripSpeed=int(((Triplength*1000.0)/TripDuration.total_seconds())*3.6)
2025-11-08 10:54:32.878 Error: Volvo: ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-11-08 10:54:32.878 Error: Volvo: ZeroDivisionError: float division by zero
Could you switch on debugging and post the full plug-in logging?

Btw: this is all just attacking the symptoms. Your real issue is that you have connectivity issues. Are you still working on that?

EDIT:
Just to be safe, i made some handling around this division... so pls upgrade to latest version.

My remark on the connection issue still stands, now in some connection error cases it will now report some sensors to 0 instead of the real value, cause due to the connection issue which prevents it from getting data. So you get less errors in the log, but your issue is not solved
User avatar
mvveelen
Posts: 721
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Python Plugin: Volvo EV

Post by mvveelen »

I've updated just now, but I don't know why there are connectivity issues like you say. The NUC is connected by wire and I have a fast internet connection via KPN (glass). Could it be that I poll the server too often? I've got the interval set to every 60 seconds.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Sonoff Zigbee Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
akamming
Posts: 427
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

mvveelen wrote: Sunday 26 October 2025 10:58 I've migrated my Domoticz installation from a Raspberry Pi 3B+ to a NUC. Everything is working fine now, also the Volvo plugin.

But.

Once in a while I see a bunch of errors although the plugin is working fine.
What can be the cause of it and....what could be the solution to prevent these errors (which I didn't have on my RPi)? I could, of course, switch off error logging, but that's not a solution.

Update interval is (unchanged): 60

The errors:

Code: Select all

2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~~~~~~~~~~^^^
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3.13/ssl.py", line 1304, in recv_into
2025-10-26 10:30:01.490 Error: Volvo: return self.read(nbytes, buffer)
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~^^^^^^^^^^^^^^^^
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3.13/ssl.py", line 1138, in read
2025-10-26 10:30:01.490 Error: Volvo: return self._sslobj.read(len, buffer)
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
2025-10-26 10:30:01.490 Error: Volvo: ConnectionResetError: [Errno 104] Connection reset by peer
2025-10-26 10:30:01.490 Error: Volvo:
2025-10-26 10:30:01.490 Error: Volvo: During handling of the above exception, another exception occurred:
2025-10-26 10:30:01.490 Error: Volvo:
2025-10-26 10:30:01.490 Error: Volvo: Traceback (most recent call last):
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/requests/adapters.py", line 667, in send
2025-10-26 10:30:01.490 Error: Volvo: resp = conn.urlopen(
2025-10-26 10:30:01.490 Error: Volvo: method=request.method,
2025-10-26 10:30:01.490 Error: Volvo: ...<9 lines>...
2025-10-26 10:30:01.490 Error: Volvo: chunked=chunked,
2025-10-26 10:30:01.490 Error: Volvo: )
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in urlopen
2025-10-26 10:30:01.490 Error: Volvo: retries = retries.increment(
2025-10-26 10:30:01.490 Error: Volvo: method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]
2025-10-26 10:30:01.490 Error: Volvo: )
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 474, in increment
2025-10-26 10:30:01.490 Error: Volvo: raise reraise(type(error), error, _stacktrace)
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/urllib3/util/util.py", line 38, in reraise
2025-10-26 10:30:01.490 Error: Volvo: raise value.with_traceback(tb)
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 787, in urlopen
2025-10-26 10:30:01.490 Error: Volvo: response = self._make_request(
2025-10-26 10:30:01.490 Error: Volvo: conn,
2025-10-26 10:30:01.490 Error: Volvo: ...<10 lines>...
2025-10-26 10:30:01.490 Error: Volvo: **response_kw,
2025-10-26 10:30:01.490 Error: Volvo: )
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 534, in _make_request
2025-10-26 10:30:01.490 Error: Volvo: response = conn.getresponse()
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 516, in getresponse
2025-10-26 10:30:01.490 Error: Volvo: httplib_response = super().getresponse()
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3.13/http/client.py", line 1430, in getresponse
2025-10-26 10:30:01.490 Error: Volvo: response.begin()
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~~~~^^
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3.13/http/client.py", line 331, in begin
2025-10-26 10:30:01.490 Error: Volvo: version, status, reason = self._read_status()
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~~~~~~~^^
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3.13/http/client.py", line 292, in _read_status
2025-10-26 10:30:01.490 Error: Volvo: line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3.13/socket.py", line 719, in readinto
2025-10-26 10:30:01.490 Error: Volvo: return self._sock.recv_into(b)
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~~~~~~~~~~^^^
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3.13/ssl.py", line 1304, in recv_into
2025-10-26 10:30:01.490 Error: Volvo: return self.read(nbytes, buffer)
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~^^^^^^^^^^^^^^^^
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3.13/ssl.py", line 1138, in read
2025-10-26 10:30:01.490 Error: Volvo: return self._sslobj.read(len, buffer)
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
2025-10-26 10:30:01.490 Error: Volvo: urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
2025-10-26 10:30:01.490 Error: Volvo:
2025-10-26 10:30:01.490 Error: Volvo: During handling of the above exception, another exception occurred:
2025-10-26 10:30:01.490 Error: Volvo:
2025-10-26 10:30:01.490 Error: Volvo: Traceback (most recent call last):
2025-10-26 10:30:01.490 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 323, in VolvoAPI
2025-10-26 10:30:01.490 Error: Volvo: status = requests.get(
2025-10-26 10:30:01.490 Error: Volvo: url,
2025-10-26 10:30:01.490 Error: Volvo: ...<5 lines>...
2025-10-26 10:30:01.490 Error: Volvo: timeout=TIMEOUT
2025-10-26 10:30:01.490 Error: Volvo: )
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/requests/api.py", line 73, in get
2025-10-26 10:30:01.490 Error: Volvo: return request("get", url, params=params, **kwargs)
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/requests/api.py", line 59, in request
2025-10-26 10:30:01.490 Error: Volvo: return session.request(method=method, url=url, **kwargs)
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/requests/sessions.py", line 589, in request
2025-10-26 10:30:01.490 Error: Volvo: resp = self.send(prep, **send_kwargs)
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/requests/sessions.py", line 703, in send
2025-10-26 10:30:01.490 Error: Volvo: r = adapter.send(request, **kwargs)
2025-10-26 10:30:01.490 Error: Volvo: File "/usr/lib/python3/dist-packages/requests/adapters.py", line 682, in send
2025-10-26 10:30:01.490 Error: Volvo: raise ConnectionError(err, request=request)
2025-10-26 10:30:01.490 Error: Volvo: requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
2025-10-26 10:30:01.490 Error: Volvo:
2025-10-26 10:30:01.490 Error: Volvo: During handling of the above exception, another exception occurred:
2025-10-26 10:30:01.490 Error: Volvo:
2025-10-26 10:30:01.490 Error: Volvo: Traceback (most recent call last):
2025-10-26 10:30:01.490 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1712, in onHeartbeat
2025-10-26 10:30:01.490 Error: Volvo: _plugin.onHeartbeat()
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~~~~~~~~~^^
2025-10-26 10:30:01.490 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1677, in onHeartbeat
2025-10-26 10:30:01.490 Error: Volvo: Heartbeat()
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~^^
2025-10-26 10:30:01.490 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1426, in Heartbeat
2025-10-26 10:30:01.490 Error: Volvo: UpdateDevices()
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~~~^^
2025-10-26 10:30:01.490 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1372, in UpdateDevices
2025-10-26 10:30:01.490 Error: Volvo: GetLocation() #Location must be known before GetRechargeStatus te detect local charging and to detect if carhasmoved
2025-10-26 10:30:01.490 Error: Volvo: ~~~~~~~~~~~^^
2025-10-26 10:30:01.490 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1104, in GetLocation
2025-10-26 10:30:01.490 Error: Volvo: Location = VolvoAPI("https://api.volvocars.com/location/v1/vehicles/" + vin + "/location", "application/json")
2025-10-26 10:30:01.490 Error: Volvo: File "/home/marco/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 359, in VolvoAPI
2025-10-26 10:30:01.490 Error: Volvo: output=status.text
2025-10-26 10:30:01.490 Error: Volvo: ^^^^^^
2025-10-26 10:30:01.490 Error: Volvo: UnboundLocalError: cannot access local variable 'status' where it is not associated with a value
It's this logging what start this, The "ConnectionResetError: [Errno 104] Connection reset by peer" is the actual error which happens on your system.

This means that something (the “peer”) abruptly closes the TCP connection while your the plugin was trying to read or write data.

The domoticz Python plugin is making an HTTPS request to the Volvo API, The Volvo server (or something in between) sent a TCP RST packet, forcefully ending the connection. So the reset does not happens in Domoticz or Python.

I've asked chatgpt, and 2 possible causes:
- TLS/SSL issues (Some APIs require modern TLS versions or SNI support. Outdated Python versions or requests libraries can fail to negotiate properly.)
- or a router, proxy, or firewall might reset idle or long-running connections.
User avatar
mvveelen
Posts: 721
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Python Plugin: Volvo EV

Post by mvveelen »

No errors since the latest update. Yet.
Last edited by mvveelen on Thursday 07 May 2026 16:42, edited 1 time in total.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Sonoff Zigbee Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
User avatar
mvveelen
Posts: 721
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Python Plugin: Volvo EV

Post by mvveelen »

Using the latest Beta 2026.1 (build 17932) and I noticed the Volvo plugin hasn't updated any devices for a while now. There are no error messages, so what might be wrong? Anyone else with the same issue?

Edit: just run the python3 authorize.py again in the Plugins directory, enter the data and let it generate a new ini file. Restart Domoticz: done.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Sonoff Zigbee Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
microkid
Posts: 14
Joined: Tuesday 29 March 2016 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Volvo EV

Post by microkid »

mvveelen wrote: Thursday 07 May 2026 16:42 Using the latest Beta 2026.1 (build 17932) and I noticed the Volvo plugin hasn't updated any devices for a while now. There are no error messages, so what might be wrong? Anyone else with the same issue?

Edit: just run the python3 authorize.py again in the Plugins directory, enter the data and let it generate a new ini file. Restart Domoticz: done.
same issue here. I notice my Volvo stats has not been updated since 17/7. I tried to run authorize.py, it says "OTP sent to PINGFEDERATE.SMTP (<my mail address>)" but the OTP never arrives. Any ideas?
akamming
Posts: 427
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

microkid wrote: Monday 20 July 2026 17:09
mvveelen wrote: Thursday 07 May 2026 16:42 Using the latest Beta 2026.1 (build 17932) and I noticed the Volvo plugin hasn't updated any devices for a while now. There are no error messages, so what might be wrong? Anyone else with the same issue?

Edit: just run the python3 authorize.py again in the Plugins directory, enter the data and let it generate a new ini file. Restart Domoticz: done.
same issue here. I notice my Volvo stats has not been updated since 17/7. I tried to run authorize.py, it says "OTP sent to PINGFEDERATE.SMTP (<my mail address>)" but the OTP never arrives. Any ideas?
If it says OTP sent to PINGFEDERATE.SMTP, this means it got back a succesful API response, so the code seems to be working.

And i Just tested for myself, it still works i get a OTP in my email.

Did you check your spamfolder?
What happens if you login in the normal Volvo URL : https://www.volvocars.com/nl/support/to ... 117dbb3ba/ ?
microkid
Posts: 14
Joined: Tuesday 29 March 2016 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Volvo EV

Post by microkid »

akamming wrote: Monday 20 July 2026 21:04
microkid wrote: Monday 20 July 2026 17:09
mvveelen wrote: Thursday 07 May 2026 16:42 Using the latest Beta 2026.1 (build 17932) and I noticed the Volvo plugin hasn't updated any devices for a while now. There are no error messages, so what might be wrong? Anyone else with the same issue?

Edit: just run the python3 authorize.py again in the Plugins directory, enter the data and let it generate a new ini file. Restart Domoticz: done.
same issue here. I notice my Volvo stats has not been updated since 17/7. I tried to run authorize.py, it says "OTP sent to PINGFEDERATE.SMTP (<my mail address>)" but the OTP never arrives. Any ideas?
If it says OTP sent to PINGFEDERATE.SMTP, this means it got back a succesful API response, so the code seems to be working.

And i Just tested for myself, it still works i get a OTP in my email.

Did you check your spamfolder?
What happens if you login in the normal Volvo URL : https://www.volvocars.com/nl/support/to ... 117dbb3ba/ ?
Logon to the Volvo site works fine. Mail is not received however. I even checked the logs at my provider, there is no OTP mail received. Strange.
akamming
Posts: 427
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by akamming »

microkid wrote: Tuesday 21 July 2026 6:54
akamming wrote: Monday 20 July 2026 21:04
microkid wrote: Monday 20 July 2026 17:09

same issue here. I notice my Volvo stats has not been updated since 17/7. I tried to run authorize.py, it says "OTP sent to PINGFEDERATE.SMTP (<my mail address>)" but the OTP never arrives. Any ideas?
If it says OTP sent to PINGFEDERATE.SMTP, this means it got back a succesful API response, so the code seems to be working.

And i Just tested for myself, it still works i get a OTP in my email.

Did you check your spamfolder?
What happens if you login in the normal Volvo URL : https://www.volvocars.com/nl/support/to ... 117dbb3ba/ ?
Logon to the Volvo site works fine. Mail is not received however. I even checked the logs at my provider, there is no OTP mail received. Strange.
That should not be possible did you really grunten logon to your Volvo id on the page i sent you ( https://volvoid.eu.volvocars.com/Account/? And did you get the otp when logging in using that link?
microkid
Posts: 14
Joined: Tuesday 29 March 2016 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Volvo EV

Post by microkid »

Yes I received the 6 digit code in my mail when loggin in to the Volvo site.

update: after several attempts today, I finally received the OTP via the mail and the plugin started working right away :) Case closed.
BramDW
Posts: 1
Joined: Wednesday 02 September 2026 10:33
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: Volvo EV

Post by BramDW »

The latest Volvo Android app update introduces the ability to adjust the charging amp limit (at least for Belgian users).
Are there any plans to expose this feature through the integration/API so that automations can be created to dynamically change the charging limit?
User avatar
FireWizard
Posts: 1975
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 @ BramDW

As you might have read in this thread, I do not use this Python plugin (nor any other Python plugin), so to add things and to test new things, the original creater (akamming) and maintainer should become active again.

However:

You wrote:
The latest Volvo Android app update introduces the ability to adjust the charging amp limit (at least for Belgian users).
I am in The Netherlands and my latest version of the Volvo app is 7.2.0. As I own a XC40 PHEV I do not have that function.
However, I see:
You can now set a maximum amperage directly from the app, providing added control and convenience. Applies to XC40 Recharge Pure Electric, C40, EC40, and EX40 cars.
So I understand that I do not see it in my app.

You wrote also:
Are there any plans to expose this feature through the integration/API so that automations can be created to dynamically change the charging limit?
If it can be integrated in an application depends in the first place on the fact: "is it available in de Energy API v2 (or the Connected vehicle API).
The short answer is: "No, there is no command to set the Charging Limit

A longer answer is: Currently the API is under review again and I see some changes, but also additions.
So who knows, it will come available in the future.
But for now, it is simply not possible.

For people interested in the new data, see the list of modified Connected Vehicle API Endpoints below.

Endpoint:

Code: Select all

https://api.volvocars.com/connected-vehicle/v2/vehicles/"Volvo_VIN"/statistics
New:

Code: Select all

averageEnergyConsumption
averageEnergyConsumptionAutomatic
averageEnergyConsumptionSinceCharge
averageFuelConsumptionAutomatic
averageSpeedAutomatic
All these new sensors currently give null as value.

Endpoint:

Code: Select all

https://api.volvocars.com/connected-vehicle/v2/vehicles/"Volvo_VIN"/fuel
Returned sensor (previously: hvbatteryChargeLevel): batteryChargeLevel Value: null

Endpoint:

Code: Select all

https://api.volvocars.com/connected-vehicle/v2/vehicles/"Volvo_VIN"/command-accessibility

Changed value for sensor unavailableReason:previously "undefined", changed to null

Best regards
akamming
Posts: 427
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: Wednesday 02 September 2026 19:45 Hello @ BramDW

As you might have read in this thread, I do not use this Python plugin (nor any other Python plugin), so to add things and to test new things, the original creater (akamming) and maintainer should become active again.

However:

You wrote:
The latest Volvo Android app update introduces the ability to adjust the charging amp limit (at least for Belgian users).
I am in The Netherlands and my latest version of the Volvo app is 7.2.0. As I own a XC40 PHEV I do not have that function.
However, I see:
You can now set a maximum amperage directly from the app, providing added control and convenience. Applies to XC40 Recharge Pure Electric, C40, EC40, and EX40 cars.
So I understand that I do not see it in my app.

You wrote also:
Are there any plans to expose this feature through the integration/API so that automations can be created to dynamically change the charging limit?
If it can be integrated in an application depends in the first place on the fact: "is it available in de Energy API v2 (or the Connected vehicle API).
The short answer is: "No, there is no command to set the Charging Limit

A longer answer is: Currently the API is under review again and I see some changes, but also additions.
So who knows, it will come available in the future.
But for now, it is simply not possible.

For people interested in the new data, see the list of modified Connected Vehicle API Endpoints below.

Endpoint:

Code: Select all

https://api.volvocars.com/connected-vehicle/v2/vehicles/"Volvo_VIN"/statistics
New:

Code: Select all

averageEnergyConsumption
averageEnergyConsumptionAutomatic
averageEnergyConsumptionSinceCharge
averageFuelConsumptionAutomatic
averageSpeedAutomatic
All these new sensors currently give null as value.

Endpoint:

Code: Select all

https://api.volvocars.com/connected-vehicle/v2/vehicles/"Volvo_VIN"/fuel
Returned sensor (previously: hvbatteryChargeLevel): batteryChargeLevel Value: null

Endpoint:

Code: Select all

https://api.volvocars.com/connected-vehicle/v2/vehicles/"Volvo_VIN"/command-accessibility

Changed value for sensor unavailableReason:previously "undefined", changed to null

Best regards
this is the correct answer indeed: The plugin is a wrapper on the API, so if it's not available in the API it cannot be made available in the plugin...
Post Reply