Help Required on BMW Plugin

Python and python framework

Moderator: leecollings

Post Reply
Filip
Posts: 117
Joined: Thursday 03 November 2016 10:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Help Required on BMW Plugin

Post by Filip »

Hi all,
Who will be able to help as this topics requires a bit deeper technical knowledge.
I developed a while ago the https://github.com/FilipDem/Domoticz-BMW-plugin, relying on the bimmer_connected library (https://github.com/bimmerconnected/bimmer_connected).

All works fine and seems to be used by multiple people.

The plugin needs a username/password to access the BMW Connected Drive (and some other data); all handled by the bimmer_connected library. In theory it would be possible to install twice the plugin in case two cars need to be managed. However we are getting into trouble as described by MadPatrick in https://github.com/FilipDem/Domoticz-BM ... 3146468947.

See the logs added by MadPatrick ("BMW" is one car; "Mini" is a second car):

Code: Select all

2025-08-02 14:15:28.378 Error: Mini: (Bmw) failed to load 'plugin.py', Python Path used was '/home/patrick/domoticz/plugins/Bmw/:/usr/lib/python311.zip:/usr/lib/python3.11:/usr/lib/python3.11/lib-dynload:/usr/local/lib/python3.11/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.11/dist-packages'.
2025-08-02 14:15:28.379 Error: Mini: Traceback (most recent call last):
2025-08-02 14:15:28.379 Error: Mini: File "/home/patrick/domoticz/plugins/Bmw/plugin.py", line 109, in <module>
2025-08-02 14:15:28.379 Error: Mini: from bimmer_connected.account import MyBMWAccount
2025-08-02 14:15:28.379 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/bimmer_connected/account.py", line 10, in <module>
2025-08-02 14:15:28.379 Error: Mini: from bimmer_connected.api.authentication import MyBMWAuthentication
2025-08-02 14:15:28.379 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/bimmer_connected/api/authentication.py", line 14, in <module>
2025-08-02 14:15:28.379 Error: Mini: import jwt
2025-08-02 14:15:28.379 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/jwt/__init__.py", line 1, in <module>
2025-08-02 14:15:28.379 Error: Mini: from .api_jwk import PyJWK, PyJWKSet
2025-08-02 14:15:28.379 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/jwt/api_jwk.py", line 7, in <module>
2025-08-02 14:15:28.379 Error: Mini: from .algorithms import get_default_algorithms, has_crypto, requires_cryptography
2025-08-02 14:15:28.379 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/jwt/algorithms.py", line 12, in <module>
2025-08-02 14:15:28.379 Error: Mini: from .utils import (
2025-08-02 14:15:28.379 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/jwt/utils.py", line 7, in <module>
2025-08-02 14:15:28.379 Error: Mini: from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve
2025-08-02 14:15:28.379 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/cryptography/hazmat/primitives/asymmetric/ec.py", line 11, in <module>
2025-08-02 14:15:28.379 Error: Mini: from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
2025-08-02 14:15:28.379 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/cryptography/exceptions.py", line 9, in <module>
2025-08-02 14:15:28.379 Error: Mini: from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions
2025-08-02 14:15:28.379 Error: Mini: ImportError: PyO3 modules do not yet support subinterpreters, see https://github.com/PyO3/pyo3/issues/576
2025-08-02 14:15:28.451 Status: BMW: Initialized version 4.1.0, author 'Filip Demaertelaere'
2025-08-02 14:15:30.696 Status: BMW: Login successful! BMW iX1 xDrive30 and VIN xxxxxxxxxxxxxxxxxx  found! Updating the status...
Who would be able to give some hints on the problem? It stops on an "import" problem of the PyO3 modules ("do not yet support subinterpreters"). Probably because they are being imported a second time... Using only one plugin installation doesn't give this problem...
Would this be linked to the embedded python of Domoticz? Other ideas?

Thanks for your help!

Filip
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Help Required on BMW Plugin

Post by waltervl »

Not a python programmer but to debug, is it possible to run a double session (in 2 terminal sessions) with the bimmer_connected library?
Just to test if the issue is in the Domoticz side or the bimner_connected side.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Help Required on BMW Plugin

Post by madpatrick »

I'll post some log soon.
Need to make some time to test is a seperate VM
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Help Required on BMW Plugin

Post by madpatrick »

Ok.

I've succedeed to add the second car and here is the log

Code: Select all

2025-08-22 19:12:10.781 Status: Domoticz V2025.1 (c)2012-2025 GizMoCuz
2025-08-22 19:12:10.781 Status: Build Hash: 89d5c900d, Date: 2025-05-05 09:02:49
2025-08-22 19:12:10.781 Status: Startup Path: /home/patrick/domoticz/
2025-08-22 19:12:10.797 Status: PluginSystem: Started, Python version '3.11.2', 9 plugin definitions loaded.
2025-08-22 19:12:10.798 Status: WebServer(HTTP) started on address: :: with port 8080
2025-08-22 19:12:10.800 Status: WebServer(SSL) started on address: :: with port 443
2025-08-22 19:12:10.801 Status: TCPServer: shared server started...
2025-08-22 19:12:10.801 Status: RxQueue: queue worker started...
2025-08-22 19:12:10.990 Status: BMW: Stop directive received.
2025-08-22 19:12:10.990 Status: BMW: Stopping threads.
2025-08-22 19:12:10.990 Status: BMW: Stopped.
2025-08-22 19:12:10.990 Status: BMW: Started.
2025-08-22 19:12:10.991 Status: [web:443] Incoming connection from: 192.168.1.201
2025-08-22 19:12:10.991 Status: BMW: Entering work loop.
2025-08-22 19:12:11.249 Status: BMW: Initialized version 4.1.0, author 'Filip Demaertelaere'
2025-08-22 19:12:11.250 BMW: 0.1 Unit nValue: 0
2025-08-22 19:12:11.250 BMW: 0.1 Unit sValue: 0
2025-08-22 19:12:11.250 BMW: 0.1 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.2 Unit number: 3
2025-08-22 19:12:11.250 BMW: 0.2 Unit name: BMW - Windows
2025-08-22 19:12:11.250 BMW: 0.2 Unit nValue: 0
2025-08-22 19:12:11.250 BMW: 0.2 Unit sValue: 0
2025-08-22 19:12:11.250 BMW: 0.2 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.3 Unit number: 4
2025-08-22 19:12:11.250 BMW: 0.3 Unit name: BMW - Remain mileage (fuel)
2025-08-22 19:12:11.250 BMW: 0.3 Unit nValue: 0
2025-08-22 19:12:11.250 BMW: 0.3 Unit sValue:
2025-08-22 19:12:11.250 BMW: 0.3 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.4 Unit number: 5
2025-08-22 19:12:11.250 BMW: 0.4 Unit name: BMW - Remain mileage (elec)
2025-08-22 19:12:11.250 BMW: 0.4 Unit nValue: 182
2025-08-22 19:12:11.250 BMW: 0.4 Unit sValue: 182
2025-08-22 19:12:11.250 BMW: 0.4 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.5 Unit number: 6
2025-08-22 19:12:11.250 BMW: 0.5 Unit name: BMW - Charging
2025-08-22 19:12:11.250 BMW: 0.5 Unit nValue: 0
2025-08-22 19:12:11.250 BMW: 0.5 Unit sValue: 0
2025-08-22 19:12:11.250 BMW: 0.5 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.6 Unit number: 7
2025-08-22 19:12:11.250 BMW: 0.6 Unit name: BMW - Charging time
2025-08-22 19:12:11.250 BMW: 0.6 Unit nValue: 0
2025-08-22 19:12:11.250 BMW: 0.6 Unit sValue: 0
2025-08-22 19:12:11.250 BMW: 0.6 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.7 Unit number: 8
2025-08-22 19:12:11.250 BMW: 0.7 Unit name: BMW - Battery Level
2025-08-22 19:12:11.250 BMW: 0.7 Unit nValue: 48
2025-08-22 19:12:11.250 BMW: 0.7 Unit sValue: 48
2025-08-22 19:12:11.250 BMW: 0.7 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.8 Unit number: 9
2025-08-22 19:12:11.250 BMW: 0.8 Unit name: BMW - Remote Services
2025-08-22 19:12:11.250 BMW: 0.8 Unit nValue: 0
2025-08-22 19:12:11.250 BMW: 0.8 Unit sValue:
2025-08-22 19:12:11.250 BMW: 0.8 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.9 Unit number: 10
2025-08-22 19:12:11.250 BMW: 0.9 Unit name: BMW - Car
2025-08-22 19:12:11.250 BMW: 0.9 Unit nValue: 0
2025-08-22 19:12:11.250 BMW: 0.9 Unit sValue: 0
2025-08-22 19:12:11.250 BMW: 0.9 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.10 Unit number: 11
2025-08-22 19:12:11.250 BMW: 0.10 Unit name: BMW - Mileage (Day)
2025-08-22 19:12:11.250 BMW: 0.10 Unit nValue: 0
2025-08-22 19:12:11.250 BMW: 0.10 Unit sValue: 69676
2025-08-22 19:12:11.250 BMW: 0.10 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.11 Unit number: 12
2025-08-22 19:12:11.250 BMW: 0.11 Unit name: BMW - Driving
2025-08-22 19:12:11.250 BMW: 0.11 Unit nValue: 0
2025-08-22 19:12:11.250 BMW: 0.11 Unit sValue: 0
2025-08-22 19:12:11.250 BMW: 0.11 Unit LastLevel: 0
2025-08-22 19:12:11.250 BMW: 0.12 Unit number: 13
2025-08-22 19:12:11.250 BMW: 0.12 Unit name: BMW - Home
2025-08-22 19:12:11.250 BMW: 0.12 Unit nValue: 1
2025-08-22 19:12:11.250 BMW: 0.12 Unit sValue: 1
2025-08-22 19:12:11.250 BMW: 0.12 Unit LastLevel: 1
2025-08-22 19:12:11.250 BMW: 0.13 Unit number: 14
2025-08-22 19:12:11.250 BMW: 0.13 Unit name: BMW - AC Limits
2025-08-22 19:12:11.250 BMW: 0.13 Unit nValue: 2
2025-08-22 19:12:11.250 BMW: 0.13 Unit sValue: 100
2025-08-22 19:12:11.250 BMW: 0.13 Unit LastLevel: 100
2025-08-22 19:12:11.250 BMW: 0.14 Unit number: 15
2025-08-22 19:12:11.250 BMW: 0.14 Unit name: BMW - Charging Mode
2025-08-22 19:12:11.250 BMW: 0.14 Unit nValue: 2
2025-08-22 19:12:11.250 BMW: 0.14 Unit sValue: 0
2025-08-22 19:12:11.250 BMW: 0.14 Unit LastLevel: 0
2025-08-22 19:12:11.251 BMW: Loaded polling settings: Home distance=500m, Fast polling distance=2000m, Fast polling delay=2min
2025-08-22 19:12:11.251 BMW: Device ID BMW set to timeout True.
2025-08-22 19:12:11.251 BMW: Entering tasks handler
2025-08-22 19:12:11.251 BMW: Acquiring GIL for 'onStartCallback'
2025-08-22 19:12:11.251 BMW: Handling task: Login.
2025-08-22 19:12:11.251 BMW: Try login without captcha...
2025-08-22 19:12:11.251 BMW: oauth data loaded from database: {'access_token': 'QxVzGCt7t25xliO8VLPUefS7tE8', 'gcid': '13099a2f-386d-40a4-9e82-34a1ec016525', 'refresh_token': 'm7BkfsDK-AVZVqlw4ig0Xoeko2Y', 'session_id': 'e81c76ae-aa8a-43ba-8bf7-c45669c807f0'}
2025-08-22 19:12:11.251 BMW: myBMW object created (no connection to the BMW API yet!): MyBMWAccount(username='XXXXXXXXXXX', region=<Regions.REST_OF_WORLD: 'row'>, config=MyBMWClientConfiguration(authentication=<bimmer_connected.api.authentication.MyBMWAuthentication object at 0x7fba2cd882d0>, log_responses=False, observer_position=None, verify=True), vehicles=[])
2025-08-22 19:12:11.251 BMW: Trying to get the vehicles from myBMW (includes login).
2025-08-22 19:12:12.801 Mini: Worker thread started.
2025-08-22 19:12:12.801 Status: Mini: Started.
2025-08-22 19:12:12.802 Status: EventSystem: reset all events...
2025-08-22 19:12:12.802 Status: dzVents: Write file: /home/patrick/domoticz/scripts/dzVents/generated_scripts/Tablet_Mini.lua
2025-08-22 19:12:12.802 Status: EventSystem: reset all device statuses...
2025-08-22 19:12:12.807 Status: NotificationSystem: thread started...
2025-08-22 19:12:12.807 Status: Mini: Entering work loop.
2025-08-22 19:12:12.829 Status: Python EventSystem: Initializing event module.
2025-08-22 19:12:12.829 Status: EventSystem: Queue thread started...
2025-08-22 19:12:12.830 Status: EventSystem: Started
2025-08-22 19:12:12.961 Error: Mini: (BMW) failed to load 'plugin.py', Python Path used was '/home/patrick/domoticz/plugins/Bmw/:/usr/lib/python311.zip:/usr/lib/python3.11:/usr/lib/python3.11/lib-dynload:/usr/local/lib/python3.11/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.11/dist-packages'.
2025-08-22 19:12:12.962 Error: Mini: Traceback (most recent call last):
2025-08-22 19:12:12.962 Error: Mini: File "/home/patrick/domoticz/plugins/Bmw/plugin.py", line 109, in <module>
2025-08-22 19:12:12.962 Error: Mini: from bimmer_connected.account import MyBMWAccount
2025-08-22 19:12:12.962 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/bimmer_connected/account.py", line 10, in <module>
2025-08-22 19:12:12.962 Error: Mini: from bimmer_connected.api.authentication import MyBMWAuthentication
2025-08-22 19:12:12.962 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/bimmer_connected/api/authentication.py", line 14, in <module>
2025-08-22 19:12:12.962 Error: Mini: import jwt
2025-08-22 19:12:12.962 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/jwt/__init__.py", line 1, in <module>
2025-08-22 19:12:12.962 Error: Mini: from .api_jwk import PyJWK, PyJWKSet
2025-08-22 19:12:12.962 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/jwt/api_jwk.py", line 7, in <module>
2025-08-22 19:12:12.962 Error: Mini: from .algorithms import get_default_algorithms, has_crypto, requires_cryptography
2025-08-22 19:12:12.962 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/jwt/algorithms.py", line 12, in <module>
2025-08-22 19:12:12.962 Error: Mini: from .utils import (
2025-08-22 19:12:12.962 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/jwt/utils.py", line 7, in <module>
2025-08-22 19:12:12.962 Error: Mini: from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve
2025-08-22 19:12:12.962 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/cryptography/hazmat/primitives/asymmetric/ec.py", line 11, in <module>
2025-08-22 19:12:12.962 Error: Mini: from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
2025-08-22 19:12:12.962 Error: Mini: File "/usr/local/lib/python3.11/dist-packages/cryptography/exceptions.py", line 9, in <module>
2025-08-22 19:12:12.962 Error: Mini: from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions
2025-08-22 19:12:12.962 Error: Mini: ImportError: PyO3 modules do not yet support subinterpreters, see https://github.com/PyO3/pyo3/issues/576
2025-08-22 19:12:13.167 BMW: Authentication tokens (oauth): {'access_token': 'QxVzGCt7t25xliO8VLPUefS7tE8', 'gcid': '13099a2f-386d-40a4-9e82-34a1ec016525', 'refresh_token': 'm7BkfsDK-AVZVqlw4ig0Xoeko2Y', 'session_id': 'e81c76ae-aa8a-43ba-8bf7-c45669c807f0', 'session_id_timestamp': 1755882291.449912}
2025-08-22 19:12:13.167 BMW: oauth data stored to database: {'refresh_token': 'm7BkfsDK-AVZVqlw4ig0Xoeko2Y', 'gcid': '13099a2f-386d-40a4-9e82-34a1ec016525', 'access_token': 'QxVzGCt7t25xliO8VLPUefS7tE8', 'session_id': 'e81c76ae-aa8a-43ba-8bf7-c45669c807f0', 'session_id_timestamp': 1755882291.449912}
2025-08-22 19:12:13.168 Status: BMW: Login successful! BMW iX1 xDrive30 and VIN XXXXXXXXXXX found! Updating the status...
2025-08-22 19:12:13.168 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=2; nValue=0; sValue=0
2025-08-22 19:12:13.168 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=3; nValue=0; sValue=0
2025-08-22 19:12:13.168 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=10; nValue=0; sValue=0
2025-08-22 19:12:13.169 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=1; nValue=69676; sValue=69676
2025-08-22 19:12:13.169 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=11; nValue=0; sValue=69676
2025-08-22 19:12:13.169 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=5; nValue=182; sValue=182
2025-08-22 19:12:13.169 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=6; nValue=0; sValue=0
2025-08-22 19:12:13.170 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=8; nValue=48; sValue=48
2025-08-22 19:12:13.170 BMW: Remaining charging time: None; Last info time: 2025-08-22 17:12:12+00:00
2025-08-22 19:12:13.170 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=7; nValue=0; sValue=0
2025-08-22 19:12:13.170 BMW: Location of vehicle: VehicleLocation(location=GPSPosition(latitude=51.XXXXXXXXXXX, longitude=4.XXXXXXXXXXX), heading=75, vehicle_update_timestamp=datetime.datetime(2025, 8, 22, 17, 12, 12, tzinfo=datetime.timezone.utc), account_region=<Regions.REST_OF_WORLD: 'row'>, remote_service_position=None) (or as workaround {'coordinates': {'latitude': 51.XXXXXXXXXXX, 'longitude': 4.XXXXXXXXXXX}, 'address': {'formatted': 'XXXXXXXXXXX 18, XXXXXXXXXXX LW XXXXXXXXXXX'}, 'heading': 75})
2025-08-22 19:12:13.170 BMW: Distance car-home: 0.00993319502020557 km
2025-08-22 19:12:13.170 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=13; nValue=1; sValue=1
2025-08-22 19:12:13.171 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=12; nValue=0; sValue=0
2025-08-22 19:12:13.171 BMW: Available AC limitations: [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 32]
2025-08-22 19:12:13.171 BMW: Current AC limitations: 16
2025-08-22 19:12:13.171 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=14; nValue=2; sValue=100
2025-08-22 19:12:13.171 BMW: Charging mode: ChargingMode.IMMEDIATE_CHARGING
2025-08-22 19:12:13.171 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=15; nValue=2; sValue=0
2025-08-22 19:12:13.171 BMW: Finished handling task: Login.
2025-08-22 19:12:13.294 Status: PluginSystem: 2 plugins started.
2025-08-22 19:12:20.027 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:12:20.077 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:12:20.078 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:12:20.078 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:12:20.078 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:12:30.005 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:12:30.055 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:12:30.056 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:12:30.056 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:12:30.056 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:12:40.029 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:12:40.079 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:12:40.080 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:12:40.080 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:12:40.080 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:12:40.718 Status: Incoming Domoticz connection from: 192.168.1.5
2025-08-22 19:12:40.718 Status: Authentication succeeded for user slave on 192.168.1.5
2025-08-22 19:12:50.054 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:12:50.104 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:12:50.104 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:12:50.104 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:12:50.104 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:00.031 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:13:00.081 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:13:00.081 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:00.081 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:13:00.081 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:10.006 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:13:10.056 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:13:10.057 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:10.057 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:13:10.057 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:10.057 BMW: Handling task: StatusUpdate.
2025-08-22 19:13:11.115 BMW: Car iX1 xDrive30 found after update!
2025-08-22 19:13:11.115 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=2; nValue=0; sValue=0
2025-08-22 19:13:11.115 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=3; nValue=0; sValue=0
2025-08-22 19:13:11.116 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=10; nValue=0; sValue=0
2025-08-22 19:13:11.116 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=1; nValue=69676; sValue=69676
2025-08-22 19:13:11.116 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=11; nValue=0; sValue=69676
2025-08-22 19:13:11.116 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=5; nValue=182; sValue=182
2025-08-22 19:13:11.117 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=6; nValue=0; sValue=0
2025-08-22 19:13:11.117 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=8; nValue=48; sValue=48
2025-08-22 19:13:11.117 BMW: Remaining charging time: None; Last info time: 2025-08-22 17:13:10+00:00
2025-08-22 19:13:11.117 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=7; nValue=0; sValue=0
2025-08-22 19:13:11.117 BMW: Location of vehicle: VehicleLocation(location=GPSPosition(latitude=51.XXXXXXXXXXX, longitude=4.XXXXXXXXXXX), heading=75, vehicle_update_timestamp=datetime.datetime(2025, 8, 22, 17, 13, 10, tzinfo=datetime.timezone.utc), account_region=<Regions.REST_OF_WORLD: 'row'>, remote_service_position=None) (or as workaround {'coordinates': {'latitude': 51.XXXXXXXXXXX, 'longitude': 4.XXXXXXXXXXX}, 'address': {'formatted': 'XXXXXXXXXXX 18, XXXXXXXXXXX LW XXXXXXXXXXX'}, 'heading': 75})
2025-08-22 19:13:11.118 BMW: Distance car-home: 0.00993319502020557 km
2025-08-22 19:13:11.118 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=13; nValue=1; sValue=1
2025-08-22 19:13:11.118 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=12; nValue=0; sValue=0
2025-08-22 19:13:11.119 BMW: Available AC limitations: [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 32]
2025-08-22 19:13:11.119 BMW: Current AC limitations: 16
2025-08-22 19:13:11.119 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=14; nValue=2; sValue=100
2025-08-22 19:13:11.119 BMW: Charging mode: ChargingMode.IMMEDIATE_CHARGING
2025-08-22 19:13:11.119 BMW: Update device with AlwaysUpdate=False; DeviceID=BMW; Unit=15; nValue=2; sValue=0
2025-08-22 19:13:11.119 BMW: Authentication tokens (oauth): {'access_token': 'QxVzGCt7t25xliO8VLPUefS7tE8', 'gcid': '13099a2f-386d-40a4-9e82-34a1ec016525', 'refresh_token': 'm7BkfsDK-AVZVqlw4ig0Xoeko2Y', 'session_id': 'e81c76ae-aa8a-43ba-8bf7-c45669c807f0', 'session_id_timestamp': 1755882291.449912}
2025-08-22 19:13:11.120 BMW: oauth data stored to database: {'refresh_token': 'm7BkfsDK-AVZVqlw4ig0Xoeko2Y', 'gcid': '13099a2f-386d-40a4-9e82-34a1ec016525', 'access_token': 'QxVzGCt7t25xliO8VLPUefS7tE8', 'session_id': 'e81c76ae-aa8a-43ba-8bf7-c45669c807f0', 'session_id_timestamp': 1755882291.449912}
2025-08-22 19:13:11.120 BMW: Finished handling task: StatusUpdate.
2025-08-22 19:13:20.031 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:13:20.082 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:13:20.082 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:20.082 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:13:20.082 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:20.847 Error: Mini hardware (2) thread seems to have ended unexpectedly
2025-08-22 19:13:30.007 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:13:30.057 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:13:30.057 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:30.057 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:13:30.058 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:34.851 Error: Mini hardware (2) thread seems to have ended unexpectedly
2025-08-22 19:13:40.031 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:13:40.081 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:13:40.082 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:40.082 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:13:40.082 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:48.854 Error: Mini hardware (2) thread seems to have ended unexpectedly
2025-08-22 19:13:50.005 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:13:50.056 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:13:50.056 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:13:50.056 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:13:50.056 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:14:00.030 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:14:00.080 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:14:00.080 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:14:00.081 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:14:00.081 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:14:02.857 Error: Mini hardware (2) thread seems to have ended unexpectedly
2025-08-22 19:14:10.006 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:14:10.057 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:14:10.057 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:14:10.057 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:14:10.057 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:14:16.861 Error: Mini hardware (2) thread seems to have ended unexpectedly
2025-08-22 19:14:20.031 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:14:20.082 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:14:20.082 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:14:20.082 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:14:20.082 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:14:30.008 BMW: Pushing 'onHeartbeatCallback' on to queue
2025-08-22 19:14:30.058 BMW: Processing 'onHeartbeatCallback' message
2025-08-22 19:14:30.058 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:14:30.058 BMW: Calling message handler 'onHeartbeat' on 'module' type object.
2025-08-22 19:14:30.058 BMW: Acquiring GIL for 'onHeartbeatCallback'
2025-08-22 19:14:30.864 Error: Mini hardware (2) thread seems to have ended unexpectedly
When i restart domoticz sometimes the MIni is working and BMW not and VS
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Help Required on BMW Plugin

Post by madpatrick »

Can this be of any help (source ChanGPT)

Problem Summary:
The Domoticz BMW/MINI plugin fails to load because it depends on the bimmer_connected library, which pulls in jwt, and then cryptography. The latest versions of the cryptography package use Rust/PyO3 bindings, which are not compatible with Python subinterpreters. Since Domoticz runs plugins inside Python subinterpreters by default, this causes the error:

ImportError: PyO3 modules do not yet support subinterpreters

Possible Solutions:

Use Python 3.9 or 3.10
These versions still use the older C-based cryptography backend, which works with Domoticz subinterpreters.

Downgrade cryptography
Install an older version that does not rely on Rust/PyO3

---------------

Downgrading to cryptography==38.0.4 looks better

Code: Select all

2025-08-22 19:39:02.669 Error: Mini: Error in login_my_bmw: asyncio.run() cannot be called from a running event loop
2025-08-22 19:39:02.674 Error: Mini: Error in login_my_bmw: asyncio.run() cannot be called from a running event loop
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
Filip
Posts: 117
Joined: Thursday 03 November 2016 10:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Help Required on BMW Plugin

Post by Filip »

Hi Patrick,

You are right wrt the version of cryptography that it needs to be downgraded to work with Domoticz. This has not specifically to do with the BMW/bimmer_connecter as you mention correctly.
Unfortunately I don't understand why you run into this problem only with a second instance of the BMW plugin.
I am using only one instance of the BMW plugin and had to downgrade cryptography for the reason you mentioned.

Would it be feasible to test the bimmer_connected with 2 accounts outside domoticz (2 terminal sessions, one for each account)? Just to be sure that the issue is not at the bimmer_connected library...

F
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Help Required on BMW Plugin

Post by madpatrick »

Filip wrote: Friday 22 August 2025 21:35 Hi Patrick,

You are right wrt the version of cryptography that it needs to be downgraded to work with Domoticz. This has not specifically to do with the BMW/bimmer_connecter as you mention correctly.
Unfortunately I don't understand why you run into this problem only with a second instance of the BMW plugin.
I am using only one instance of the BMW plugin and had to downgrade cryptography for the reason you mentioned.

F
The error message appeared a long time ago.
I think after an update of the plugin, but only when changing a parameter or stopping the plugin
Since it was not a big issue and the plugin worked i wasn't paying too much attention to it
Would it be feasible to test the bimmer_connected with 2 accounts outside domoticz (2 terminal sessions, one for each account)? Just to be sure that the issue is not at the bimmer_connected library...
How can i do this ?
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
Filip
Posts: 117
Joined: Thursday 03 November 2016 10:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Help Required on BMW Plugin

Post by Filip »

madpatrick wrote: Saturday 23 August 2025 9:06
Filip wrote: Friday 22 August 2025 21:35 Hi Patrick,

You are right wrt the version of cryptography that it needs to be downgraded to work with Domoticz. This has not specifically to do with the BMW/bimmer_connecter as you mention correctly.
Unfortunately I don't understand why you run into this problem only with a second instance of the BMW plugin.
I am using only one instance of the BMW plugin and had to downgrade cryptography for the reason you mentioned.

F
The error message appeared a long time ago.
I think after an update of the plugin, but only when changing a parameter or stopping the plugin
Since it was not a big issue and the plugin worked i wasn't paying too much attention to it
Would it be feasible to test the bimmer_connected with 2 accounts outside domoticz (2 terminal sessions, one for each account)? Just to be sure that the issue is not at the bimmer_connected library...
How can i do this ?
Hi Patrick,
You should open 2 terminals and in every terminal launch bimmer_connected on the command line. See the CLI documentation on https://bimmer-connected.readthedocs.io ... e/cli.html.
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Help Required on BMW Plugin

Post by madpatrick »

I've tried to connect on the command propmt and get this (strange) result

terminal 1

Code: Select all

bimmerconnected status -v VIN1 user1 password1 rest_of_world --captcha-token xxxxxxxxx

Code: Select all

MyBMWAPIError due to HTTPStatusError: Vehicle with specified VIN not found
Unable to get details for vehicle VIN1- (MyBMWAPIError) HTTPStatusError: Vehicle with specified VIN not found
Found 2 vehicles: iX1 xDrive30,Cooper E
VIN: VIN1
Mileage: 0 km
Vehicle data:
KeyError: 'isLscSupported'
terminal 2

Code: Select all

bimmerconnected status -v VIN2 user2 password2 rest_of_world --captcha-token xxxxxxxxx

Code: Select all

MyBMWAPIError due to HTTPStatusError: Vehicle with specified VIN not found
Unable to get details for vehicle VIN2- (MyBMWAPIError) HTTPStatusError: Vehicle with specified VIN not found
Found 2 vehicles: iX1 xDrive30,Cooper E
VIN: VIN2
Mileage: 659 km
Vehicle data:
KeyError: 'isLscSupported'
With both logins it sees 2 cars.
The cars are both only linked to a seperate account

Can it be that it is linked by my external IP?
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Help Required on BMW Plugin

Post by madpatrick »

i've found why it found 2 vehicle. MY wife is also connect to my car with a profile
After deleting this it found 1 car.

Only the strange part is the it finds a different car on my login
When i use the login of my wife it give all the information of the car
When i use the login of my self it gives : Found 1 vehicles: Cooper E (my wifes car)

if tested it on a test VM with my wifes car connect to domoticz
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
Filip
Posts: 117
Joined: Thursday 03 November 2016 10:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Help Required on BMW Plugin

Post by Filip »

Thanks Patrick,
OK, this is important: the goal of the test is to evaluate if the problem is in the bimmer_connected library that would not support 2 sessions in parallel or not. If you open only one terminal session and you use your login, do you have the information from your car of still your wife's car?
If this would give info about your car, there is probably already a problem with concurrency in the bimmer_connected (not saying that this leads us to the root cause of the problem in Domoticz)..
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Help Required on BMW Plugin

Post by madpatrick »

It did not gave any car information at all.
Only the message "1 car connected"

Currently some issue with the conenction, so can not test

Code: Select all

2025-09-01 19:46:22.094 Error: BMW: Too many errors received: devices are timed out! No updates will be done anymore and retry rate will be slowed down until next successful communication...
2025-09-01 19:46:22.732 BMW: BMW Status Update: error occurred in getting info from BMW (HTTPStatusError: { "statusCode": 403, "message": "Out of call volume quota. Quota will be replenished in 00:13:38." }).
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Help Required on BMW Plugin

Post by madpatrick »

BMW has changed there API protocol which breaks BImmer-connected and therefor the plugin
There is a work around for this ( see https://github.com/home-assistant/core/ ... 3249656034)

adjust the file /usr/local/lib/python3.11/dist-packages/bimmer_connected/const.py

Code: Select all

X_USER_AGENT = "android(pls_dont_block_us);{brand};{app_version};{region}"
And it give again updates.
Now waiting for how long it will last
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
User avatar
madpatrick
Posts: 758
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.2
Location: Netherlands
Contact:

Re: Help Required on BMW Plugin

Post by madpatrick »

I'm a bit lost.

I have 2 VM's with 2 Domoticz running (master/slave) and works good with both cars
in Master i've my car and in Domoticz i get the updates.
In the terminal i get

Code: Select all

MyBMWAuthError due to HTTPStatusError: invalid_request - The request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed
MyBMWAuthError due to HTTPStatusError: invalid_client - Client authentication failed (e.g., login failure, unknown client, no client authentication included or unsupported authentication method)
MyBMWAuthError: HTTPStatusError: invalid_client - Client authentication failed (e.g., login failure, unknown client, no client authentication included or unsupported authentication method)
In slave i've my wifes car

in terminal i get

Code: Select all

MyBMWAPIError due to HTTPStatusError: Vehicle with specified VIN not found
Unable to get details for vehicle XXXXXXXXXX- (MyBMWAPIError) HTTPStatus                                        Error: Vehicle with specified VIN not found
Found 2 vehicles: iX1 xDrive30,Cooper E
VIN: XXXXXXXXXXXXXXX
Mileage: 0 km
Vehicle data:
KeyError: 'isLscSupported'
Basically is my slave a copy of my master without the zwave USB and devices
In both terminal sessions i used exactly the same command
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2025.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
Filip
Posts: 117
Joined: Thursday 03 November 2016 10:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Help Required on BMW Plugin

Post by Filip »

Final solution in using BMW Cardata on https://github.com/FilipDem/Domoticz-BMW-plugin.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest