Comments (10)
Hi @scaarup ,
could you share some details about your environment. What is the configured timezone? Could you enable the debug-logging and check for some errors?
from mbapi2020.
Hi @scaarup ,
could you share some details about your environment. What is the configured timezone? Could you enable the debug-logging and check for some errors?
Sure thing. So just enabled debugging and restarted HA:
I am getting this notification in the UI:
Checking that out in the Integrations:
Hitting the Reconfigure, where I can type all the gibberish I want.:
If I enter my correct email, I actually get an email with a PIN. But I can enter whatever PIN I like.
Integration now works again.
I am running:
OS Version: Home Assistant OS 6.4
Home Assistant Core: 2021.9.7
My timezone is set to "Europe/Copenhagen".
Logs from restart:
2021-09-27 08:23:37 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration mbapi2020 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-09-27 08:24:11 INFO (MainThread) [homeassistant.setup] Setting up mbapi2020
2021-09-27 08:24:11 INFO (MainThread) [homeassistant.setup] Setup of domain mbapi2020 took 0.0 seconds
2021-09-27 08:24:27 DEBUG (MainThread) [custom_components.mbapi2020.oauth] start: async_get_cached_token
2021-09-27 08:24:27 DEBUG (MainThread) [custom_components.mbapi2020.oauth] custom_components.mbapi2020.oauth - token expired - start refresh
2021-09-27 08:24:27 INFO (MainThread) [custom_components.mbapi2020.oauth] start async refresh_access_token with refresh_token
2021-09-27 08:25:22 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting data from https://id.mercedes-benz.com/as/token.oauth2: Cannot connect to host id.mercedes-benz.com:443 ssl:default [Connect call failed ('141.113.50.67', 443)]
2021-09-27 08:25:22 ERROR (MainThread) [custom_components.mbapi2020] Authentication failed. Please reauthenticate.
2021-09-27 08:29:41 INFO (MainThread) [custom_components.mbapi2020.oauth] start request pin sgdsdg
2021-09-27 08:29:42 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting data from https://bff-prod.risingstars-amap.daimler.com/v1/login: 400, message='Bad Request', url=URL('https://bff-prod.risingstars-amap.daimler.com/v1/login')
2021-09-27 08:29:44 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting data from https://id.mercedes-benz.com/as/token.oauth2: 400, message='Bad Request', url=URL('https://id.mercedes-benz.com/as/token.oauth2')
2021-09-27 08:29:44 DEBUG (MainThread) [custom_components.mbapi2020.config_flow] token received
2021-09-27 08:29:44 DEBUG (MainThread) [custom_components.mbapi2020.oauth] start: async_get_cached_token
2021-09-27 08:29:44 DEBUG (MainThread) [custom_components.mbapi2020.oauth] custom_components.mbapi2020.oauth - token expired - start refresh
2021-09-27 08:29:44 INFO (MainThread) [custom_components.mbapi2020.oauth] start async refresh_access_token with refresh_token
2021-09-27 08:29:44 DEBUG (MainThread) [custom_components.mbapi2020.oauth] start: _save_token_info to /config/.mercedesme-token-cache
2021-09-27 08:29:44 DEBUG (MainThread) [custom_components.mbapi2020.oauth] start: async_get_cached_token
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] {'country_code': 'EN', 'locale': 'en-GB', 'cap_check_disabled': False, 'save_files': False, 'pin': '5044', 'excluded_cars': 'WDD2132041A161308'}
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.oauth] start: async_get_cached_token
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] {'country_code': 'EN', 'locale': 'en-GB', 'cap_check_disabled': False, 'save_files': False, 'pin': '5044', 'excluded_cars': 'WDD2132041A161308'}
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020] Init - car added - WDD2132041A161309
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.oauth] start: async_get_cached_token
2021-09-27 08:29:45 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket-prod.risingstars.daimler.com/ws
2021-09-27 08:29:45 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket-prod.risingstars.daimler.com/ws
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: debugMessage
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] debugMessage - Data: Registering User with ciamID: 0015060635ff5a96 and App-UUID: 7002ca16-b027-4481-bf4b-6273941bfd63
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: debugMessage
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] debugMessage - Data: app twin actor was initialized
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] Start _process_assigned_vehicles
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_assigned_vehicles - WDD2132041A161309 - False - Counter({'f': 0, 'p': 0}) - 170
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: vepUpdates
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] Start _process_vep_updates
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] Full Update. WDD2132041A161309
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Odometer for WDD2132041A161309 called
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Tires for WDD2132041A161309 called
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Doors for WDD2132041A161309 called
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Location for WDD2132041A161309 called
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Binary_Sensors for WDD2132041A161309 called
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Windows for WDD2132041A161309 called
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Electric for WDD2132041A161309 called
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Auxheat for WDD2132041A161309 called
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_vep_updates - WDD2132041A161309 - complete: True - Counter({'f': 1, 'p': 0})
2021-09-27 08:29:45 DEBUG (MainThread) [custom_components.mbapi2020.client] vepUpdates Sequence: 0
2021-09-27 08:29:49 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:29:49 DEBUG (MainThread) [custom_components.mbapi2020.client] Start _process_assigned_vehicles
2021-09-27 08:29:49 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_assigned_vehicles - WDD2132041A161309 - True - Counter({'f': 1, 'p': 0}) - 3839
2021-09-27 08:29:49 INFO (MainThread) [custom_components.mbapi2020] Car Load complete - start sensor creation
2021-09-27 08:29:49 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:29:49 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.mbapi2020
2021-09-27 08:29:49 INFO (MainThread) [homeassistant.components.lock] Setting up lock.mbapi2020
2021-09-27 08:29:49 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.mbapi2020
2021-09-27 08:29:49 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.mbapi2020
2021-09-27 08:29:49 INFO (MainThread) [homeassistant.components.switch] Setting up switch.mbapi2020
2021-09-27 08:29:54 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:29:54 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:30:00 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:30:00 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:30:06 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:30:06 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:30:15 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:30:15 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:30:25 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:30:25 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:30:37 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:30:37 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:30:51 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:30:51 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:31:06 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:31:06 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:31:21 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:31:21 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:31:36 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:31:36 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:31:51 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:31:51 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:32:06 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:32:06 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:32:21 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:32:21 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:32:36 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:32:36 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-09-27 08:32:51 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-09-27 08:32:51 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
Logs indicate, that my auth has expired:
2021-09-27 08:24:27 DEBUG (MainThread) [custom_components.mbapi2020.oauth] custom_components.mbapi2020.oauth - token expired - start refresh
from mbapi2020.
thanks for the details. Looks like a strange timing problem. The component can't connect to the id.mer... endpoint at "08:24:27" --> see error at "08:25:22"
Do you have any firewall, dns-resolver or adblocker in your HA-OS setup?
The rest is clear. you enter a wrong id. this results in an API error and the refresh-token in the .mercedesme-token file is still valid. So I try to get a new access-token with a still valid refresh token and thatswhy its working.
I can add a option to disable the first auth-reconfigure-check.
from mbapi2020.
But before any connection errors, my token is declared expired:
2021-09-27 08:24:11 INFO (MainThread) [homeassistant.setup] Setting up mbapi2020
2021-09-27 08:24:11 INFO (MainThread) [homeassistant.setup] Setup of domain mbapi2020 took 0.0 seconds
2021-09-27 08:24:27 DEBUG (MainThread) [custom_components.mbapi2020.oauth] start: async_get_cached_token
2021-09-27 08:24:27 DEBUG (MainThread) [custom_components.mbapi2020.oauth] custom_components.mbapi2020.oauth - token expired - start refresh
But no, there's no adblocking or anything. HA is using 9.9.9.9 for DNS. So I can't really explain the connection issue ...
from mbapi2020.
This is actually in the past, but integration is still working ...
"expires_at": 1632731383
from mbapi2020.
yeah, thats normal - the access token expires after 30min and the component handles this with the refresh token. - Let me try to check this out over the weekend - there are a few other people who are using the component and I have never seen this before - As I said, I expect that this is a timing problem - let me setup a HA_OS environment - I'm running on core only...
from mbapi2020.
Thanks! Appreciate it.
from mbapi2020.
with the next release (v0.6.0), the component will handle these network not available errors at startup in a better way. Fixed in the master branch already.
from mbapi2020.
I also have this issue and got used to enter my pin all the time until one day I entered something wrong or cancelled the notification and the integration remained with the authentication error showing by failed to setup message. I believe that if I delete and re add the integration everything should work fine.
from mbapi2020.
Hi @diazwatson , could you check out the latest code in the master branch? This handles the "Network not available" in a better way and retries the creation of the component multiple times.
from mbapi2020.
Related Issues (20)
- authentication is failing since update to 0.13.0 HOT 2
- Detected blocking call to open inside the event loop HOT 2
- Calling the configure max soc service switches the charging program to standard HOT 11
- "Task exception was never retrieved" on HA 2024.5.5 HOT 4
- Not able to set up the integration HOT 11
- Error requesting: https://bff.emea-prod.mobilesdk.mercedes-benz.com/v2/vehicles - 418 - 0 - HOT 1
- Service window_open - missing field PIN HOT 1
- Missing entities HOT 3
- Webapi change HOT 3
- async_forward_entry_setup after the entry for integration
- "Endofchargetime" Sensor
- Create sensor tirewarningsrdk
- Geographic violation issue HOT 7
- W206 - AMG C43 (2024) HOT 5
- Device Tracker HOT 2
- coordinates of tracker are incorrect HOT 3
- MercedesMe 2020 App not loading in HA HOT 2
- Run this component as standalone service? HOT 1
- Location being shown as Away / never at home HOT 3
- Charging power state is 'unknown' when not charging HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mbapi2020.