GithubHelp home page GithubHelp logo

Comments (10)

ReneNulschDE avatar ReneNulschDE commented on June 4, 2024

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.

scaarup avatar scaarup commented on June 4, 2024

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:
image
Checking that out in the Integrations:
image

Hitting the Reconfigure, where I can type all the gibberish I want.:
image
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.

ReneNulschDE avatar ReneNulschDE commented on June 4, 2024

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.

scaarup avatar scaarup commented on June 4, 2024

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.

scaarup avatar scaarup commented on June 4, 2024

This is actually in the past, but integration is still working ...
"expires_at": 1632731383

from mbapi2020.

ReneNulschDE avatar ReneNulschDE commented on June 4, 2024

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.

scaarup avatar scaarup commented on June 4, 2024

Thanks! Appreciate it.

from mbapi2020.

ReneNulschDE avatar ReneNulschDE commented on June 4, 2024

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.

diazwatson avatar diazwatson commented on June 4, 2024

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.

ReneNulschDE avatar ReneNulschDE commented on June 4, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.