Re: Python Plugin: Volvo EV
Posted: Thursday 23 November 2023 22:07
Yes, plug-in is working fine for me…
But I Only can test with full ev
But I Only can test with full ev
Code: Select all
2023-12-14 16:07:06.404 Status: Volvo: Stop directive received.
2023-12-14 16:07:06.465 Status: Volvo: Exiting work loop.
2023-12-14 16:07:06.504 Status: Volvo: Stopping threads.
2023-12-14 16:07:06.504 Status: Volvo: Stopped.
2023-12-14 16:07:06.504 Status: Volvo: Entering work loop.
2023-12-14 16:07:06.504 Status: Volvo: Started.
2023-12-14 16:07:06.909 Status: Volvo: Initialized version 0.1.0, author 'akamming'
2023-12-14 16:07:07.123 Volvo: INFO: Login successful!
2023-12-14 16:07:07.306 Volvo: ERROR: VolvoAPI failed calling https://api.volvocars.com/connected-vehicle/v2/vehicles, HTTP Statuscode 401
2023-12-14 16:07:07.307 Volvo: ERROR: Reponse: {'status': 401, 'error': {'message': 'Access denied due to invalid VCC-API-KEY. Make sure to provide a valid key for an active application.'}}You should use your Volvo on call e-mailadres/passwordHvdW wrote: Thursday 14 December 2023 15:54 Almost there.Remark: username cannot find it , used my Volvo mail address.Code: Select all
2023-12-14 16:07:06.404 Status: Volvo: Stop directive received. 2023-12-14 16:07:06.465 Status: Volvo: Exiting work loop. 2023-12-14 16:07:06.504 Status: Volvo: Stopping threads. 2023-12-14 16:07:06.504 Status: Volvo: Stopped. 2023-12-14 16:07:06.504 Status: Volvo: Entering work loop. 2023-12-14 16:07:06.504 Status: Volvo: Started. 2023-12-14 16:07:06.909 Status: Volvo: Initialized version 0.1.0, author 'akamming' 2023-12-14 16:07:07.123 Volvo: INFO: Login successful! 2023-12-14 16:07:07.306 Volvo: ERROR: VolvoAPI failed calling https://api.volvocars.com/connected-vehicle/v2/vehicles, HTTP Statuscode 401 2023-12-14 16:07:07.307 Volvo: ERROR: Reponse: {'status': 401, 'error': {'message': 'Access denied due to invalid VCC-API-KEY. Make sure to provide a valid key for an active application.'}}
Even after regenerating my API key it is rejected in the Domoticz call to Volvo.
You are welcomeLosje wrote: Wednesday 27 December 2023 21:49 Very cool stuff. I was surprised by how many data I got from my XC40![]()
Setup was quite painless, well explained by akamming! Thanks a lot!
the volvo id and he id you use to login to developer site of volvo deos not have to be the same id or linked. Just register on the developer site and create an API key, that's enough..HvdW wrote: Saturday 30 December 2023 12:47 I'd like to get some assistance.
I have my own Volvo ID using mail and password.
When I go to Developers I can only login with my github account.
There is an option to login on volvocars.biz and an option to login with Google. The first is not possible and the Google option is not connected to my Volvo car ID.
How do I get to the right spot?
Code: Select all
2023-12-30 23:12:17.483 Volvo: Worker thread started.
2023-12-30 23:12:17.382 Status: Volvo: Stop directive received.
2023-12-30 23:12:17.480 Status: Volvo: Exiting work loop.
2023-12-30 23:12:17.482 Status: Volvo: Stopping threads.
2023-12-30 23:12:17.483 Status: Volvo: Stopped.
2023-12-30 23:12:17.483 Status: Volvo: Started.
2023-12-30 23:12:17.483 Status: Volvo: Entering work loop.
2023-12-30 23:12:17.885 Status: Volvo: Initialized version 0.1.0, author 'akamming'
2023-12-30 23:12:18.097 Volvo: INFO: Login successful!
2023-12-30 23:12:18.365 Volvo: INFO: 1 car(s) attached to your Volvo ID account:
2023-12-30 23:12:18.365 Volvo: INFO: YV1XZEEE4R2288999
2023-12-30 23:12:18.365 Volvo: INFO: Using configured VIN YV1XZEEE4R2288999
2023-12-30 23:12:18.713 Volvo: INFO: retreived a XC40, color Jupiter, model year 2024
2023-12-30 23:12:18.714 Volvo: INFO: Setting BatteryCapacity to 81.608
2023-12-30 23:12:18.714 Volvo: INFO: Updating Devices
2023-12-30 23:12:18.922 Error: Volvo: Call to function 'onStart' failed, exception details:
2023-12-30 23:12:18.929 Error: Volvo: Traceback (most recent call last):
2023-12-30 23:12:18.929 Error: Volvo: File "/home/hein/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1083, in onStart
2023-12-30 23:12:18.929 Error: Volvo: _plugin.onStart()
2023-12-30 23:12:18.929 Error: Volvo: File "/home/hein/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1040, in onStart
2023-12-30 23:12:18.929 Error: Volvo: Heartbeat()
2023-12-30 23:12:18.929 Error: Volvo: File "/home/hein/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 877, in Heartbeat
2023-12-30 23:12:18.929 Error: Volvo: GetRechargeStatus()
2023-12-30 23:12:18.929 Error: Volvo: File "/home/hein/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 688, in GetRechargeStatus
2023-12-30 23:12:18.929 Error: Volvo: UpdateSensor(vin,BATTERYCHARGELEVEL,"batteryChargeLevel",243,6,None,
2023-12-30 23:12:18.929 Error: Volvo: File "/home/hein/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 356, in UpdateSensor
2023-12-30 23:12:18.929 Error: Volvo: Devices[vin].Units[idx].nValue = nv
2023-12-30 23:12:18.929 Error: Volvo: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-12-30 23:12:18.929 Error: Volvo: TypeError: 'float' object cannot be interpreted as an integerJust ran into the same bug when trying to upgrade my rpi to debian bookworm. You are probably also on bookworm / python 3.11?HvdW wrote: Saturday 30 December 2023 23:10 Done!
Great!
Except for:Volvo Climatization, Volvo Electric range and Volvo battery charge level are present.Code: Select all
2023-12-30 23:12:17.483 Volvo: Worker thread started. 2023-12-30 23:12:17.382 Status: Volvo: Stop directive received. 2023-12-30 23:12:17.480 Status: Volvo: Exiting work loop. 2023-12-30 23:12:17.482 Status: Volvo: Stopping threads. 2023-12-30 23:12:17.483 Status: Volvo: Stopped. 2023-12-30 23:12:17.483 Status: Volvo: Started. 2023-12-30 23:12:17.483 Status: Volvo: Entering work loop. 2023-12-30 23:12:17.885 Status: Volvo: Initialized version 0.1.0, author 'akamming' 2023-12-30 23:12:18.097 Volvo: INFO: Login successful! 2023-12-30 23:12:18.365 Volvo: INFO: 1 car(s) attached to your Volvo ID account: 2023-12-30 23:12:18.365 Volvo: INFO: YV1XZEEE4R2288999 2023-12-30 23:12:18.365 Volvo: INFO: Using configured VIN YV1XZEEE4R2288999 2023-12-30 23:12:18.713 Volvo: INFO: retreived a XC40, color Jupiter, model year 2024 2023-12-30 23:12:18.714 Volvo: INFO: Setting BatteryCapacity to 81.608 2023-12-30 23:12:18.714 Volvo: INFO: Updating Devices 2023-12-30 23:12:18.922 Error: Volvo: Call to function 'onStart' failed, exception details: 2023-12-30 23:12:18.929 Error: Volvo: Traceback (most recent call last): 2023-12-30 23:12:18.929 Error: Volvo: File "/home/hein/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1083, in onStart 2023-12-30 23:12:18.929 Error: Volvo: _plugin.onStart() 2023-12-30 23:12:18.929 Error: Volvo: File "/home/hein/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 1040, in onStart 2023-12-30 23:12:18.929 Error: Volvo: Heartbeat() 2023-12-30 23:12:18.929 Error: Volvo: File "/home/hein/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 877, in Heartbeat 2023-12-30 23:12:18.929 Error: Volvo: GetRechargeStatus() 2023-12-30 23:12:18.929 Error: Volvo: File "/home/hein/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 688, in GetRechargeStatus 2023-12-30 23:12:18.929 Error: Volvo: UpdateSensor(vin,BATTERYCHARGELEVEL,"batteryChargeLevel",243,6,None, 2023-12-30 23:12:18.929 Error: Volvo: File "/home/hein/domoticz/plugins/Domoticz_VolvoRecharge_Plugin/plugin.py", line 356, in UpdateSensor 2023-12-30 23:12:18.929 Error: Volvo: Devices[vin].Units[idx].nValue = nv 2023-12-30 23:12:18.929 Error: Volvo: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2023-12-30 23:12:18.929 Error: Volvo: TypeError: 'float' object cannot be interpreted as an integer
Code: Select all
local range = domoticz.devices('Volvo-fullRange').fullRangeImam not a scripting guru so maybe someone else can better anwser this question.HvdW wrote: Wednesday 03 January 2024 0:12 Question:
How do I get the value of Volvo-fullRangeIs it km, range, fullrange?Code: Select all
local range = domoticz.devices('Volvo-fullRange').fullRange
Code: Select all
2024-01-03 15:25:00.330 Status: dzVents: device> idx: 252
2024-01-03 15:25:00.330 Status: dzVents: device> sValue: 442.3
2024-01-03 15:25:00.330 Status: dzVents: device> nValue: 442
2024-01-03 15:25:00.330 Status: dzVents: device> baseType: device
2024-01-03 15:25:00.330 Status: dzVents: device> id: 252
2024-01-03 15:25:00.330 Status: dzVents: device> hardwareTypeValue: 94
2024-01-03 15:25:00.330 Status: dzVents: device> switchTypeValue: 0
2024-01-03 15:25:00.330 Status: dzVents: device> name: Volvo-fullRange
2024-01-03 15:25:00.330 Status: dzVents: device> active: false
2024-01-03 15:25:00.330 Status: dzVents: device> sensorValue: 442.3
2024-01-03 15:25:00.330 Status: dzVents: device> sensorUnit: km
2024-01-03 15:25:00.330 Status: dzVents: device> Image: Custom
2024-01-03 15:25:00.330 Status: dzVents: device> _nValue: 442
2024-01-03 15:25:00.330 Status: dzVents: device> changed: false
2024-01-03 15:25:00.331 Status: dzVents: device> signalLevel: 12
2024-01-03 15:25:00.331 Status: dzVents: device> isSecurity: false
2024-01-03 15:25:00.331 Status: dzVents: device> isHardware: false
2024-01-03 15:25:00.331 Status: dzVents: device> rawData:
2024-01-03 15:25:00.331 Status: dzVents: device> 1: 442.3
2024-01-03 15:25:00.331 Status: dzVents: device> isScene: false
2024-01-03 15:25:00.331 Status: dzVents: device> deviceId: VIN number
2024-01-03 15:25:00.331 Status: dzVents: device> unit: 2
2024-01-03 15:25:00.331 Status: dzVents: device> description:
2024-01-03 15:25:00.331 Status: dzVents: device> hardwareId: 13
2024-01-03 15:25:00.331 Status: dzVents: device> isTimer: false
2024-01-03 15:25:00.331 Status: dzVents: device> deviceSubType: Custom Sensor
2024-01-03 15:25:00.331 Status: dzVents: device> hardwareID: 13
2024-01-03 15:25:00.331 Status: dzVents: device> lastUpdate: 2024-01-03 02:40:46
2024-01-03 15:25:00.331 Status: dzVents: device> _state: 442.3
2024-01-03 15:25:00.331 Status: dzVents: device> isDevice: true
2024-01-03 15:25:00.331 Status: dzVents: device> hardwareType: Volvo Recharge (Full EV)
2024-01-03 15:25:00.331 Status: dzVents: device> state: 442.3
2024-01-03 15:25:00.331 Status: dzVents: device> switchType: On/Off
2024-01-03 15:25:00.331 Status: dzVents: device> inActive: true
2024-01-03 15:25:00.331 Status: dzVents: device> sensorType: 1
2024-01-03 15:25:00.331 Status: dzVents: device> isHTTPResponse: false
2024-01-03 15:25:00.331 Status: dzVents: device> bState: false
2024-01-03 15:25:00.331 Status: dzVents: device> protected: false
2024-01-03 15:25:00.331 Status: dzVents: device> customImage: 0
2024-01-03 15:25:00.331 Status: dzVents: device> timedOut: true
2024-01-03 15:25:00.331 Status: dzVents: device> hardwareName: Volvo
2024-01-03 15:25:00.331 Status: dzVents: device> _data:
2024-01-03 15:25:00.331 Status: dzVents: device> rawData:
2024-01-03 15:25:00.331 Status: dzVents: device> 1: 442.3
2024-01-03 15:25:00.331 Status: dzVents: device> switchType: On/Off
2024-01-03 15:25:00.331 Status: dzVents: device> lastLevel: 0
2024-01-03 15:25:00.331 Status: dzVents: device> id: 252
2024-01-03 15:25:00.331 Status: dzVents: device> deviceID: VIN number
2024-01-03 15:25:00.331 Status: dzVents: device> image:
2024-01-03 15:25:00.331 Status: dzVents: device> lastUpdate: 2024-01-03 02:40:46
2024-01-03 15:25:00.331 Status: dzVents: device> iconNumber: 0
2024-01-03 15:25:00.331 Status: dzVents: device> switchTypeValue: 0
2024-01-03 15:25:00.331 Status: dzVents: device> protected: false
2024-01-03 15:25:00.331 Status: dzVents: device> subType: Custom Sensor
2024-01-03 15:25:00.331 Status: dzVents: device> timedOut: true
2024-01-03 15:25:00.331 Status: dzVents: device> description:
2024-01-03 15:25:00.331 Status: dzVents: device> changed: false
2024-01-03 15:25:00.331 Status: dzVents: device> batteryLevel: 255
2024-01-03 15:25:00.331 Status: dzVents: device> data:
2024-01-03 15:25:00.331 Status: dzVents: device> _state: 442.3
2024-01-03 15:25:00.331 Status: dzVents: device> protected: false
2024-01-03 15:25:00.331 Status: dzVents: device> unit: 2
2024-01-03 15:25:00.331 Status: dzVents: device> icon: Custom
2024-01-03 15:25:00.331 Status: dzVents: device> hardwareName: Volvo
2024-01-03 15:25:00.331 Status: dzVents: device> _nValue: 442
2024-01-03 15:25:00.331 Status: dzVents: device> customImage: 0
2024-01-03 15:25:00.331 Status: dzVents: device> sensorUnit: km
2024-01-03 15:25:00.331 Status: dzVents: device> Image: Custom
2024-01-03 15:25:00.331 Status: dzVents: device> hardwareTypeValue: 94
2024-01-03 15:25:00.331 Status: dzVents: device> hardwareType: Volvo Recharge (Full EV)
2024-01-03 15:25:00.331 Status: dzVents: device> hardwareID: 13
2024-01-03 15:25:00.331 Status: dzVents: device> sensorType: 1
2024-01-03 15:25:00.331 Status: dzVents: device> signalLevel: 12
2024-01-03 15:25:00.331 Status: dzVents: device> deviceType: General
2024-01-03 15:25:00.331 Status: dzVents: device> name: Volvo-fullRange
2024-01-03 15:25:00.331 Status: dzVents: device> baseType: device
2024-01-03 15:25:00.331 Status: dzVents: device> _adapters:
2024-01-03 15:25:00.331 Status: dzVents: device> 1: Custom sensor device adapter
2024-01-03 15:25:00.331 Status: dzVents: device> isGroup: false
2024-01-03 15:25:00.331 Status: dzVents: device> deviceType: General
2024-01-03 15:25:00.331 Status: dzVents: device> isVariable: false
2024-01-03 15:25:00.331 Status: dzVents: device> icon: Custom
2024-01-03 15:25:00.331 Status: dzVents: Debug: Volvo XC40 range: nilCode: Select all
return {
on = {
timer = {'every 15 minutes'},
},
data = {},
logging = {
level = domoticz.LOG_DEBUG,
-- change LOG_DEBUG to LOG_ERROR to stop logging in the log
marker = 'Volvo XC40 range',
},
execute = function(domoticz, triggeredItem)
local range = domoticz.devices('Volvo-fullRange').state
local temp = domoticz.devices('Buitentemperatuur').temperature
domoticz.log('De Volvo range is : ' .. range, domoticz.LOG_DEBUG)
domoticz.log('De buitentemperatuur is : ' .. temp, domoticz.LOG_DEBUG)
domoticz.devices('Reikweidte').updateTempHum(temp, range)
-- domoticz.devices(252).dump()
domoticz.log(domoticz.devices('Volvo-fullRange').dump(),domoticz.LOG_DEBUG)
end
}Please look at the documentation: the plug-in is Only a wrapper around the API. If a feature is not present in the API I cannot make it available in the plug-inHvdW wrote: Sunday 28 January 2024 20:53 Hi @akamming
There is an option that hasn't been added in de python plugin yet.
It is reading and setting charging amperage.
I'd be very happy if it could be added.
Would serve well to balance PV output and home power consumption where the car can be charged from excess solar energy.