Do you update all the items manually after the initial setup?
The token update only works with your Client_ID and the refresh_token.
In my example i use String items to store these.
After step 7 I donāt get an āauthenticatedā screen on the link you BMW ID page but instead a ālogin successfulā > please continue in the vehicle. The text does not mention you need to sit inside the car for any step - or did I miss something? Iām currently not at home so thatās an issue for me.
Hey @Bredmich, this is really great work! It took me a few hours to get everything up and running, but Iām happy to have my BMW data back in my openhab server!
I changed the code a little bit, because Iām not using file based rules but rules within the main ui. Iām also not using telegram for notification but the openhab app, which is connected to my openhab server by the openhab cloud. If anyone is interested, I can also share my code, but I donāt want to get this thread more complicated.
Some hints for anyone who is using this tutorial:
You have the install the JSONPATH transformation for getting the thing channels working.
If you are using the great JS scripts from @Bredmich and skip the telegram and logviewer parts of the installation, you have to fill the following items with the right information, before you are able to use BMW_Token_Refresh.js and BMW_ID_Token_Update.js
Hi @kuczerek, I am interested in your modifications using the openHAB app instead of Signal. Somehow this solution stopped working for me so I am planning to start again. I am also using MainUI only for rules, things and items.
In order not to confuse this tutorial with a different solution perhaps DM me, I plan to make a new tutorial from a-z as this is still quite complicated for a lot of users.
@Bredmich Thank you for your work!
Quick question: if I just created a copy of your scripts and updated the associated variables, items letās say to carBMWB_Token_Access, etc. - do you think itād work with a second car on a separate ConnectedDrive account?
Trying the link you provided to set up the CarData, I cannot log in at this link, despite having a BMW connected drive account. Iām in the US and wondering if the link to geo specific? If I go to https://www.bmwusa.com/, I can log into my account with my usual uname/passwd.
From there, trying to find where I can do what you described:. I start here:
I found this info, where under the ā2. Technical registrationā ā ā2.1 Step 1: Generate your client IDā section it has a link to the world wide portals:
However when I follow this for the US, it takes me to the same site I was looking on previously.
Hi, the token setup is not working anymore. I get the following message. Any ideas?
2026-01-30 10:13:30.991 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - BMW API returned error
2026-01-30 10:13:30.991 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Error Code: invalid_request
2026-01-30 10:13:30.992 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Error Description: 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
2026-01-30 10:13:30.992 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Full JSON Response: {"error": "invalid_request", "error_description": "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"}
2026-01-30 10:13:31.139 [INFO ] [.openhab-js.BMW_MQTT_Password_Update] - Username unchanged: b9ba23df-43c6-366f-92a7-5565cd5259eb
2026-01-30 10:13:31.181 [ERROR] [ion.openhab-js.BMW_Token_Setup_Step1] - Incomplete response received. Missing required fields.
2026-01-30 10:13:31.181 [ERROR] [ion.openhab-js.BMW_Token_Setup_Step1] - Response: {"user_code":"TYr6smoD","device_code":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJodHRwczovL2Zvcmdlcm9jay1ibHVlLnByb2QtZ2NkbS5ldS1jZW50cmFsLTEuYXdzLmNsb3VkLmJtdzo0NDMvYW0vb2F1dGgyIiwibmJmIjoxNzY5NzY0NDExLCJ1c2VyX2NvZGUiOiJUWXI2c21vRCIsImlzcyI6Imh0dHBzOi8vZm9yZ2Vyb2NrLWJsdWUucHJvZC1nY2RtLmV1LWNlbnRyYWwtMS5hd3MuY2xvdWQuYm13OjQ0My9hbS9vYXV0aDIiLCJleHAiOjE3Njk3NjQ3MTEsImlhdCI6MTc2OTc2NDQxMSwianRpIjoiYWUyZGViY2ItNWM0MS00NjhmLThjYWQtZGY0YWRiNWUyMTJhIn0.NpjX1b7jTu2KCddAjFFH-Tm_dLEOIk4CNXVhe1XvTHk","interval":5,"verification_uri":"https://customer.bmwgroup.com/oneid/link","expires_in":300}
2026-01-30 10:13:31.182 [ERROR] [ion.openhab-js.BMW_Token_Setup_Step1] - BMW Token Setup Failed
Incomplete response received from BMW.
Response: `{"user_code":"TYr6smoD","device_code":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJodHRwczovL2Zvcmdlcm9jay1ibHVlLnByb2QtZ2NkbS5ldS1jZW50cmFsLTEuYXdzLmNsb3VkLmJtdzo0NDMvYW0vb2F1dGgyIiwibmJmIjoxNzY5NzY0NDExLCJ1c2VyX2NvZGUiOiJUWXI2c21vRCIsImlzcyI6Imh0dHBzOi8vZm9yZ2Vyb2NrLWJsdWUucHJvZC1nY2RtLmV1LWNlbnRyYWwtMS5hd3MuY2xvdWQuYm13OjQ0My9hbS9vYXV0aDIiLCJleHAiOjE3Njk3NjQ3MTEsImlhdCI6MTc2OTc2NDQxMSwianRpIjoiYWUyZGViY2ItNWM0MS00NjhmLThjYWQtZGY0YWRiNWUyMTJhIn0.NpjX1b7jTu2KCddAjFFH-Tm_dLEOIk4CNXVhe1XvTHk","interval":5,"verification_uri":"https://customer.bmwgroup.com/oneid/link","expires_in":300}`
2026-01-30 10:13:31.244 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to 'customer.streaming-cardata.bmwgroup.com' with clientid 17660ecc-e480-486d-b52b-8834dfd5735e
2026-01-30 10:13:44.505 [INFO ] [.reconnect.PeriodicReconnectStrategy] - Try to restore connection to 'customer.streaming-cardata.bmwgroup.com'. Next attempt in 60000ms
2026-01-30 10:13:44.507 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to 'customer.streaming-cardata.bmwgroup.com' with clientid 17660ecc-e480-486d-b52b-8834dfd5735e
2026-01-30 10:14:00.832 [INFO ] [hab-js.BMW_Token_Refresh_ExpireCheck] - current time: 30.01.2026 10:14:00, expiry of token: 24.01.2026 00:00:59
2026-01-30 10:14:00.832 [INFO ] [omation.openhab-js.BMW_Token_Refresh] - Token needs to be updated! -> Starting update
2026-01-30 10:14:00.832 [INFO ] [omation.openhab-js.BMW_Token_Refresh] - Starting token refresh...
2026-01-30 10:14:00.903 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - BMW API returned error
2026-01-30 10:14:00.903 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Error Code: invalid_request
2026-01-30 10:14:00.903 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Error Description: 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
2026-01-30 10:14:00.903 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Full JSON Response: {"error": "invalid_request", "error_description": "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"}
2026-01-30 10:14:00.904 [WARN ] [omation.openhab-js.BMW_Token_Refresh] - First attempt failed with BMW API error. Will retry in 30 seconds.
2026-01-30 10:14:00.904 [WARN ] [omation.openhab-js.BMW_Token_Refresh] - Scheduling retry in 30 seconds...
2026-01-30 18:22:30.702 [INFO ] [omation.openhab-js.BMW_Token_Refresh] - === RETRY ATTEMPT - Second try after initial failure ===
2026-01-30 18:22:30.703 [INFO ] [omation.openhab-js.BMW_Token_Refresh] - Starting token refresh...
2026-01-30 18:22:30.774 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - BMW API returned error
2026-01-30 18:22:30.775 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Error Code: invalid_request
2026-01-30 18:22:30.775 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Error Description: 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
2026-01-30 18:22:30.775 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Full JSON Response: {"error": "invalid_request", "error_description": "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"}
2026-01-30 18:23:00.638 [INFO ] [hab-js.BMW_Token_Refresh_ExpireCheck] - current time: 30.01.2026 18:23:00, expiry of token: 24.01.2026 00:00:59
2026-01-30 18:23:00.638 [INFO ] [omation.openhab-js.BMW_Token_Refresh] - Token needs to be updated! -> Starting update
2026-01-30 18:23:00.639 [INFO ] [omation.openhab-js.BMW_Token_Refresh] - Starting token refresh...
2026-01-30 18:23:00.708 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - BMW API returned error
2026-01-30 18:23:00.709 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Error Code: invalid_request
2026-01-30 18:23:00.709 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Error Description: 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
2026-01-30 18:23:00.709 [ERROR] [omation.openhab-js.BMW_Token_Refresh] - Full JSON Response: {"error": "invalid_request", "error_description": "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"}
2026-01-30 18:23:00.709 [WARN ] [omation.openhab-js.BMW_Token_Refresh] - First attempt failed with BMW API error. Will retry in 30 seconds.
2026-01-30 18:23:00.710 [WARN ] [omation.openhab-js.BMW_Token_Refresh] - Scheduling retry in 30 seconds...