GithubHelp home page GithubHelp logo

renenulschde / mbapi2020 Goto Github PK

View Code? Open in Web Editor NEW
133.0 8.0 21.0 548 KB

Custom Component to integrate MercedesME devices into Home-Assistant

License: Other

Python 100.00%
car home-assistant home-assistant-component sensor lock switch

mbapi2020's Introduction

mercedesme2020

HassFest tests Validate with HACS

MercedesME platform as a Custom Component for Home Assistant.

IMPORTANT:

  • Please login once in the MercedesME IOS or Android app before you install this component. (For North America, the app name is Mercedes Me Connect)

  • Tested Countries: AT, AU, BE, CA, CH, CN, DE, DK, ES, FI, FR, IN, IT, IR, NL, NO, NZ, PT, SE, TH, UK, US

  • North America: For Cars 2019 or newer only

  • Thailand, India: Please use region "Europe".

  • China: support of China is in early stage

Installation

  • First: This is not a Home Assistant Add-On. It's a custom component.
  • There are two ways to install. First you can download the folder custom_component and copy it into your Home-Assistant config folder. Second option is to install HACS (Home Assistant Custom Component Store) and select "MercedesME 2020" from the Integrations catalog.
  • How to install a custom component?
  • How to install HACS?
  • Restart HA after the installation
  • Make sure that you refresh your browser window too
  • Use the "Add Integration" in Home Assistant, Settings, Devices & Services and select "MercedesME 2020".
  • Use your MB-login email address. Your will receive a 6-digit code via email (valid for 15min).

Optional configuration values

See Options dialog in the Integration under Home-Assistant/Configuration/Integration.

Excluded Cars: comma-separated list of VINs.
PIN: Security PIN to execute special services. Please use your MB mobile app to setup
Disable Capability Check: By default the component checks the capabilities of a car. Active this option to disable the capability check. (For North America)
Debug Save Messages: Enable this option to save all relevant received message into the messages folder of the component

Available components

Depends on your own car or purchased Mercedes Benz licenses.

Binary Sensors

  • warningwashwater

  • warningcoolantlevellow

  • warningbrakefluid

  • warningenginelight

    attributes: 
    warningbrakefluid, warningwashwater, warningcoolantlevellow, warninglowbattery
    
  • parkbrakestatus

    attributes: 
    preWarningBrakeLiningWear
    
  • tirewarninglamp

    attributes: 
    tirepressureRearLeft, tirepressureRearRight, tirepressureFrontRight, tirepressureFrontLeft, tireMarkerFrontRight, tireMarkerFrontLeft,tireMarkerRearLeft, tireMarkerRearRight, tirewarningsrdk, tirewarningsprw, tireTemperatureRearLeft, tireTemperatureFrontRight,
    tireTemperatureRearRight, tireTemperatureFrontLeft
    
  • windowsClosed

    attributes: 
    windowstatusrearleft, windowstatusrearright, windowstatusfrontright, windowstatusfrontleft
    
  • remoteStartActive

    attributes: 
    remoteStartTemperature
    
  • engineState

Device Tracker

attributes:
positionHeading

Locks

  • lock

    PIN setup in MB App is required. If the pin is not set in the integration options then the lock asks for the PIN.

Sensors

  • lock

    attributes: 
    decklidstatus, doorStatusOverall, doorLockStatusOverall, doorlockstatusgas, doorlockstatusvehicle, doorlockstatusfrontleft,doorlockstatusfrontright, doorlockstatusrearright, doorlockstatusrearleft, doorlockstatusdecklid, doorstatusrearleft, doorstatusfrontright, doorstatusrearright, doorstatusfrontleft, rooftopstatus, sunroofstatus, engineHoodStatus
    

    Internal value: doorlockstatusvehicle

    Values: 0: vehicle unlocked 1: vehicle internal locked 2: vehicle external locked 3: vehicle selective unlocked

  • Fuel Level (%)

    attributes: 
    tankLevelAdBlue
    
  • Geofencing Violation

    attributes: 
    Last_event_zone
    

    Values: ENTER LEAVE

  • odometer

    attributes: 
    distanceReset, distanceStart, averageSpeedReset, averageSpeedStart, distanceZEReset, drivenTimeZEReset, drivenTimeReset, drivenTimeStart, ecoscoretotal, ecoscorefreewhl, ecoscorebonusrange, ecoscoreconst, ecoscoreaccel, gasconsumptionstart, gasconsumptionreset, gasTankRange, gasTankLevel, liquidconsumptionstart, liquidconsumptionreset, liquidRangeSkipIndication, rangeliquid, serviceintervaldays, tanklevelpercent, tankReserveLamp, batteryState, tankLevelAdBlue
    
  • Range Electric

    attributes: 
    rangeelectric, chargingstatus, chargingPower, distanceElectricalReset, distanceElectricalStart, ecoElectricBatteryTemperature,
    electricconsumptionstart, electricconsumptionreset, endofchargetime, precondActive, precondNow, maxrange, selectedChargeProgram, soc
    
  • Starter Battery State

    Internal Name: starterBatteryState
    
    Values     Description_short     Description_long
    "0"        "green"               "Vehicle ok"
    "1"        "yellow"              "Battery partly charged"
    "2"        "red"                 "Vehicle not available"
    "3"        "serviceDisabled"     "Remote service disabled"
    "4"        "vehicleNotAvalable"  "Vehicle no longer available"
    
  • State of Charge (soc)

    Internal Name: soc
    
    State of charge (SoC) is the level of charge of an electric battery relative to its capacity. The units of SoC are percentage points (0% = empty; 100% = full). 
    
    attributes: 
    maxSocLowerLimit, maxSoc, chargingPower
    
    
  • Ignition state

    Internal Name: ignitionstate
    
    Values     Description_short     Description_long
    "0"        "lock"                "Ignition lock"
    "1"        "off"                 "Ignition off"
    "2"        "accessory"           "Ignition accessory"
    "4"        "on"                  "Ignition on"
    "5"        "start"               "Ignition start"
    
  • Aux Heat Status

    Internal Name: auxheatstatus
    
    Values    Description
    "0"       inactive
    "1"       normal heating
    "2"       normal ventilation
    "3"       manual heating
    "4"       post heating
    "5"       post ventilation
    "6"       auto heating
    
    attributes:
    auxheattime1, auxheattime2, auxheattime3, auxheattimeselection, auxheatActive, auxheatwarnings, auxheattime2: '00:00'
    
    
  • Departure Time

    Internal Name: departuretime
    
    Planned departure time to initiate preclimate functions
    
    attributes:
    departureTimeWeekday
    
    

Diagnostic Sensors

Diagnostic sensors are hidden by default, check the devices page to see the current values

  • Car

    attributes: 
    full_update_messages_received, partital_update_messages_received, last_message_received, last_command_type, last_command_state, last_command_error_code, last_command_error_message
    
  • RCP_Features

    Sensor shows true if extended configuration like interior lighting is available. This feature requires a reauthentication in case you used a version <0.6 before (We need some more permissions...). Shows False in case reauthentication has not happened or the feature is not available for your car.

    attributes: 
    rcp_supported_settings (List of all remote configuration options, I'll implement them step by step as services or buttons)
    

Services

Some services require that the security PIN is created in your mobile Android/IOS app. Please store the pin to the options-dialog of the integration

  • refresh_access_token: Refresh the API access token

  • auxheat_start: Start the auxiliary heating of a car defined by a vin.

  • auxheat_stop: Stop the auxiliary heating of a car defined by a vin.

  • battery_max_soc_configure: Configure the maximum value for the state of charge of the HV battery of a car defined by a vin.

  • doors_unlock: Unlock a car defined by a vin. PIN required.

  • doors_lock: Lock a car defined by a vin.

  • engine_start: Start the engine of a car defined by a vin. PIN required.

  • engine_stop: Stop the engine of a car defined by a vin.

  • preheat_start: Start the preheating of a zero emission car defined by a vin.

  • preheat_start_departure_time: Start the preheating of a zero emission car defined by a vin and the departure time in minutes since midnight

  • preheat_stop: Stop the preheating of a zero emission car defined by a vin.

  • send_route: Send a route to a car defined by a vin.

  • sigpos_start: Start light signaling of a car defined by a vin.

  • sunroof_open: Open the sunroof of a car defined by a vin. PIN required.

  • sunroof_close: Close the sunroof of a car defined by a vin.

  • windows_open: Open the windows of a car defined by a vin. PIN required.

  • windows_close: Close the windows of a car defined by a vin.

Switches

  • AuxHeat - Start/Stop the auxiliary heating of the car

Logging

Set the logging to debug with the following settings in case of problems.

logger:
  default: warn
  logs:
    custom_components.mbapi2020: debug

Open Items

  • Add missing Sensors (Theft)

Backup and Restore

  • In case of problems after a restore of Home Assistant, please delete the file .mercedesme-token-cache in your HA-config folder and restart HA

Useful links

Attributes

  • Charging Status

    0=CHARGING
    1=CHARGING_ENDS
    2=CHARGE_BREAK
    3=UNPLUGGED
    4=FAILURE
    5=SLOW
    6=FAST
    7=DISCHARGING
    8=NO_CHARGING
    9=SLOW_CHARGING_AFTER_REACHING_TRIP_TARGET
    10=CHARGING_AFTER_REACHING_TRIP_TARGET
    11=FAST_CHARGING_AFTER_REACHING_TRIP_TARGET
    12=UNKNOWN
    
  • interiorProtectionStatus

    0=NOT_ACTIVE_SELECTED
    1=NOT_ACTIVE_UNSELECTED
    2=ACTIVE
    -1=UNKNOWN  
    
  • interiorMonitoringState

    0=INM_IDLE
    1=INM_WAKE_UP
    2=INM_RECORDING
    3=INM_PICTURE_TAKEN
    4=INM_ANNOUNCE
    5=INM_UPLOADING
    6=INM_COMPLETED
    101=INM_CAMERA_BROKEN
    103=INM_MEMORY_FULL
    105=INM_PRIVACY_MODE_ACTIVE
    106=INM_PICTURE_TAKING_DISABLED
    108=INM_ACTIVE_BURSTMODE
    108=INM_PICTURE_TAKING_INTERRUPTED
    -1=UNKNOWN
    
  • exteriorMonitoringState

    0=EXM_IDLE
    1=EXM_WAKE_UP
    2=EXM_REQUEST_SUBMITTED
    3=EXM_RECORDING
    4=EXM_ANNOUNCE
    5=EXM_UPLOADING
    6=EXM_COMPLETED
    101=EXM_AE_REQUEST_DENIED
    106=EXM_AE_INCAPABLE
    108=EXM_AE_OVERRULED
    110=EXM_AE_PLAY_PROTECTION_ACTIVE
    111=EXM_AE_PRECONDITION_MISSING
    -1=UNKNOWN
    
  • parkEventLevel

    0=LOW
    1=MEDIUM
    2=HIGH
    -1=UNKNOWN
    
  • parkEventType

    0=IDLE
    1=FRONT_LEFT
    2=FRONT_MIDDLE
    3=FRONT_RIGHT
    4=RIGHT
    5=REAR_RIGHT
    6=REAR_MIDDLE
    7=REAR_LEFT
    8=LEFT
    9=DIRECTION_UNKNOWN
    -1=UNKNOWN
    
  • theftAlarmActive

    ?
    
  • theftWarningReasonState

    0=NO_ALARM
    16=BASIS_ALARM
    17=DOOR_FRONT_LEFT
    18=DOOR_FRONT_RIGHT
    19=DOOR_REAR_LEFT
    20=DOOR_REAR_RIGHT
    21=HOOD
    22=DECKLID
    23=COMMON_ALM_IN
    24=PANIC
    25=GLOVEBOX
    26=CENTERBOX
    27=REARBOX
    32=SENSOR_VTA
    33=ITS
    34=ITS_SLV
    35=TPS
    36=SIREN
    37=HOLD_COM
    38=REMOTE
    42=EXT_ITS_1
    43=EXT_ITS_2
    44=EXT_ITS_3
    45=EXT_ITS_4
    
  • towProtectionSensorStatus

    0=NOT_ACTIVE_SELECTED
    1=NOT_ACTIVE_UNSELECTED
    2=ACTIVE
    3=PROCESSING
    4=UNKNOWN
    

mbapi2020's People

Contributors

appit-online avatar danielrheinbay avatar fredericma avatar geert36 avatar gnep88 avatar renenulschde avatar rmertz3282 avatar spacegaier avatar thomas55555 avatar thomasdelaet avatar weidi avatar xraver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mbapi2020's Issues

Service call not working

Hi,

Thanks for the nice HA Integration.

I'm struggeling a bit with caling services. When caling services like Roof Open, Unlock they don't work (locking the car works). I have configured the integration with VIN and PIN. When i.e. caling service "MercedesME 2020: sunroof_open", it does not open de sun roof.

image

Message:

JSON:
{ "apptwin_command_status_updates_by_vin": { "updates_by_vin": { "Wxxxxxxxxxx": { "vin": "W1xxxxxxxxxxxxxxxx", "updates_by_pid": { "58xxxx3": { "process_id": "58xxxx3", "request_id": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx", "timestamp_in_ms": "-1", "type": "ROOFOPEN", "state": "INITIATION" } } } } } }

Message:

'utf-8' codec can't decode byte 0x8a in position 0: invalid start byte

What can that be?

Error setting up entry mbapi2020 for mbapi2020

Updated Home Assistant to version 2021.12.10 and the integration no longer wrorks.

grabs from log:

Traceback (most recent call last):
  File "/config/custom_components/mbapi2020/api.py", line 73, in _request
    resp.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('https://bff-prod.risingstars.daimler.com/v1/vehicle/self/masterdata')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/mbapi2020/__init__.py", line 118, in async_setup_entry
    masterdata = await mercedes.client.api.get_user_info()
  File "/config/custom_components/mbapi2020/api.py", line 83, in get_user_info
    return await self._request("get", "/v1/vehicle/self/masterdata")
  File "/config/custom_components/mbapi2020/api.py", line 76, in _request
    raise RequestError(f"Error requesting data from {url}: {err}")
custom_components.mbapi2020.errors.RequestError: Error requesting data from https://bff-prod.risingstars.daimler.com/v1/vehicle/self/masterdata: 404, message='Not Found', url=URL('https://bff-prod.risingstars.daimler.com/v1/vehicle/self/masterdata')

2022-01-19 12:17:01 ERROR (MainThread) [homeassistant.components.system_health] Error fetching info
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/system_health/__init__.py", line 68, in get_integration_info
data = await registration.info_callback(hass)
File "/config/custom_components/mbapi2020/system_health.py", line 21, in system_health_info
client = hass.data[DOMAIN]
KeyError: 'mbapi2020'

Question - Not showing in integrations

Hi,

Just a question over an issue. I installed through HACS and it asked for a reboot. Done 2 reboots now and still can't find Mercedes Me under my main integrations?

Installed other ones since from HACS and all good? Any ideas?

Thanks

switch for auxheat missing

Rationale

The previous version of mbapipy used to have a switch for auxheat, see https://github.com/ReneNulschDE/mbapipy/blob/master/custom_components/mercedesmeapi/switch.py
Having a switch entity to start / stop auxheat makes it easy to integrate auxheat in Lovelace.

As is

This new version has auxheat sensors (provided #12 is merged) and services to start and stop auxheat, but it doesn't have a switch (yet).

To be

Take the sensors and services and turn them into a switch entity. Could be done manually using a template switch, but it'd be much nicer if a switch came out of the box.

Integration crashing "after a while" - runs fine after HA restart

hi,

I'm on version 2020.12.0 and currently running version 5.8 on an RPI4 - version of mbapi2020 is 209f520

I have debug on so could provide more information if needed.

Logger: homeassistant
Source: custom_components/mbapi2020/websocket.py:96
First occurred: January 5, 2021, 11:19:47 PM (5 occurrences)
Last logged: 5:58:50 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/mbapi2020/client.py", line 169, in connect
await self.websocket.connect(on_data, on_connect, on_disconnect)
File "/config/custom_components/mbapi2020/websocket.py", line 96, in connect
res_raw = await s.receive_bytes()
File "/usr/local/lib/python3.8/site-packages/aiohttp/client_ws.py", line 284, in receive_bytes
raise TypeError(
TypeError: Received message 257:None is not bytes

Many thanks!
Jhh

Crashes after a few minutes

2021-01-02 12:28:23 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for mbapi2020 doing I/O at custom_components/mbapi2020/oauth.py, line 192: response = requests.post(

Units not correct

Units are showing 'km' on odometer readings but the readings are in miles.

There is no way to change the unit shown. The number shown in the odometer sensor is correct but should be in miles not kilometers.

All my entities are unavailable

I have 2 MercedesMe 2020 instances showing up in my integrations. One integration has 2 devices and 3 entities and the other has 2 devices and 19 entities. All the entities are unavailable (status in red)
MercedesMe 2020 HA Integration (p1)
MercedesMe 2020 HA Integration (p2)
MercedesMe 2020 HA Integration (p3)
MercedesMe 2020 HA Integration (p4)
MercedesMe 2020 HA Integration (p5)
MercedesMe 2020 HA Integration (p6)
.

State attribute precondActive is not updated

Hello Rene,
nice work that you are doing with your integration. Works pretty good.
I wanted to build a template switch for the preconditioning. The problem is, that I used the state attribute precondActive in the electric_range sensor as value_template. See the configuration:

switch:
  - platform: template
    switches:
      vorklimatisierung:
      value_template: "{{ is_state_attr('sensor.xxx_range_electric', 'precondActive', true) }}"
        turn_on:
          service: mbapi2020.preheat_start
          data:
            vin: W1K205xxxx
        turn_off:
          service: mbapi2020.preheat_stop
          data:
            vin: W1K205xxxx

But precondActive always stays on false even if the preconditioning is working. chargingactive for example gets updated, if I turn on the preconditioning an the car is plugged in.
Any idea, why this is not getting updated?
Are you planning to stay on the services for the commands or will you integrate switch and lock entities?

Missing entities for my V Class

Hello,
Congratulation on your work, this is very good to get data from Mercedes in HA
My major problem is that I only get 7 entities

image

The entities are those ones :

image

one time I had an odometer but was often marked as unavailable. (only got 2 or 3 times the odometer info)

Is this linked to limited features of my VClass and not covered by the API?

Thanks in advance

Vincent

token: 401 Error (Asia-Pacific)

Hello Rene,

I am living in Korea.
A problem occurred when input PIN number in to use the component you created.
MercedesME 2020 Version: 0.5.1b (using HACS)
Region: Asia-Pacific

step

  • install Component in HACS
  • install component
  • input email
  • received 6digit PIN number
  • input PIN number
  • occurred token: 401
    If you need more information for testing i can always help.

thx
----debug log----
2021-03-08 07:41:02 INFO (MainThread) [custom_components.mbapi2020.oauth] start request pin [email protected]
2021-03-08 07:41:18 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting data from https://keycloak.risingstars-amap.daimler.com/auth/realms/Daimler/protocol/openid-connect/token: 401, message='Unauthorized', url=URL('https://keycloak.risingstars-amap.daimler.com/auth/realms/Daimler/protocol/openid-connect/token')
2021-03-08 07:41:18 ERROR (MainThread) [custom_components.mbapi2020.config_flow] Request Token Error: {}
2021-03-08 07:41:18 ERROR (MainThread) [homeassistant.components.http.view] Unable to serialize to JSON: Object of type RequestError is not JSON serializable
{'type': 'form', 'flow_id': '44be1550391243098dfbd8576ec5c368', 'handler': 'mbapi2020', 'step_id': 'pin', 'data_schema': [{'type': 'string', 'name': 'password', 'required': True}], 'errors': RequestError("Error requesting data from https://keycloak.risingstars-amap.daimler.com/auth/realms/Daimler/protocol/openid-connect/token: 401, message='Unauthorized', url=URL('https://keycloak.risingstars-amap.daimler.com/auth/realms/Daimler/protocol/openid-connect/token')"), 'description_placeholders': None}

Problems authenticating

Hi.

I'm having problems authenticating after entering the 6-digit TAN-code.

The following error is logged in Home Assistant:

2021-05-06 22:01:26 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-05-06 22:01:26 ERROR (MainThread) [custom_components.mbapi2020] Authentication failed. Please reauthenticate.

I've tried setting up the integration multiple times, restarting HASS as well.

I've also logged out of the iOS app and logged in again without problems to make sure it wasn't a temporary problem om Mercedes' end.

Country is DK - Denmark.

Any ideas?

Edit: For good measure I tried completely uninstalling the integration, restarting HASS several times and adding the integration again (version 0.5.3) - Unfortunately with the same result.

Edit 2: Tried again with debugging logging - not getting any wiser though:

2021-05-06 22:35:32 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-05-06 22:35:32 DEBUG (MainThread) [custom_components.mbapi2020.config_flow] token received
2021-05-06 22:35:32 DEBUG (MainThread) [custom_components.mbapi2020.oauth] start: async_get_cached_token
2021-05-06 22:35:32 ERROR (MainThread) [custom_components.mbapi2020] Authentication failed. Please reauthenticate.

Home Assistant OS 5.9

Host System
Hostname
homeassistant
IP Address
Operating System
Home Assistant OS 5.9
Deployment
production

Hi Rene
I've just installed this and can't see a way to login/authenticate. I appreciate it's still early days. Is this only supported on a raspberry PI as I believe was your previous version? I'm running the latest version homeassistant in a vm (Home Assistant OS 5.9). Thanks.

Component only shows 3 enteties

Hi
The component has for some time only been showing 3 entities.
I have reinstalled the component, I still only see this:
image
image
image

Aux heat is not working on EQC

I assume Aux Heat is the same as turning on the AC to pre-heat (or pre-cool) the car to the set temperature. If not, I apologize for the misunderstanding. The switch is there on my EQC integration, but it's not doing anything. I can unlock the car, but not turn on the AC.

Smart EQ

Hey. Can give you Access to my car if it helps developing adapter for smart eq

After upgrade to HA 2022.6 warning appears in log

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:103
First occurred: 22:25:41
Last logged: 22:25:41

Detected integration that uses deprecated async_get_registry to access device registry, use async_get instead. Please report issue to the custom component author for mbapi2020 using this method at custom_components/mbapi2020/init.py, line 115: dev_reg = await hass.helpers.device_registry.async_get_registry()

Suggestion to improve readme

Nice work! Thanks for sharing this addon.

When installing I found the following statement in the readme confusing:

PIN: Security PIN to execute special services. Please use your MB mobile app to setup

My mobile app has the option of setting a pin, but this is a 4 digit pin and not the pin you want. I suggest that the readme explictly states the steps required to install the addon:

  1. Install the addon through HACS
  2. Add the addon as an integration under Configuration->Integrations
  3. Add the pin received by email after completing the username step. This pin is valid for 15min.

At least thats how it worked for me. Thanks!

Devicetracker permanently offline

Hi,

i installed this integration on my hassos running on a odroid device with a Star2.3 Mercedes since December 2021.

So far i was very happy with all the automations i run on it. Things like "Cold? Home? Workday? So start Aux Heater". This is so awsome :-). Or at least it was :-/.

Pretty exactly one month later the device_tracker is permanently shown as "unavailable". The rest of the integration parts still work perfectly. Just the device tracker.

Is there anything i can do to fix it, or is this a bug?

Thanks
Michael

400 - Pin Error

Hello Rene,

I am living in Germany.
A problem occurred when input mail and Region. After I sent it, it restarts at the same point.
MercedesME 2020 Version: 0.5.0 (using HACS)
Region: Europe.

steps i did:

install Component in HACS
install component
input email

----debug log----
Request Pin Error: Error requesting data from https://bff-prod.risingstars.daimler.com/v1/login: 400, message='Bad Request', url=URL('https://bff-prod.risingstars.daimler.com/v1/login')
21:18:51 – MercedesME 2020 (ERROR)
Error requesting data from https://bff-prod.risingstars.daimler.com/v1/login: 400, message='Bad Request', url=URL('https://bff-prod.risingstars.daimler.com/v1/login')
21:18:51 – MercedesME 2020 (ERROR)

Integration not found

After an update to the latest version 0.6.0, the integration no longer runs:

Logger: homeassistant.setup
Source: setup.py:153
First occurred: 11:12:13 (1 occurrences)
Last logged: 11:12:13

Setup failed for mbapi2020: Integration not found.

Integration Not appearing in HA after reinstall

I was having issues where HA was complaining it couldn't find the setup.py integration. I removed it from Intergateions and HACS then re-added it. It shows in HACs but not as an integration I can add?
Not too sure how to troubleshoot

Question - Mercedes me down?

Hi,
Since last week our car doesn't report any state anymore in home assistant. Also the mercedes me app doesn't show any data anymore.
When I log in to the website I see that a lot of services have state "wordt geactiveerd" (dutch for "pending activation" or "being activated").
I called mercedes me support and they say that there is a server downtime since April 15th. The strange thing is that they never communicated anything about this downtime and I also can nowhere find other people that are experiencing the same issue (twitter, google, mercedes forums).

That's why I'm reaching out to my fellow tech guys to check if they experience the same issue?

I see this in de logs of HA at startup:

2022-04-21 17:37:51 INFO (MainThread) [custom_components.mbapi2020.client] WSL not detected - running in rlock mode
2022-04-21 17:37:51 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2022-04-21 17:37:51 DEBUG (MainThread) [custom_components.mbapi2020.oauth] custom_components.mbapi2020.oauth token expired -> start refresh
2022-04-21 17:37:51 INFO (MainThread) [custom_components.mbapi2020.oauth] Start async_refresh_access_token() with refresh_token
2022-04-21 17:37:57 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start _save_token_info() to /config/.mercedesme-token-cache
2022-04-21 17:37:57 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2022-04-21 17:37:59 DEBUG (MainThread) [custom_components.mbapi2020.client] {}
2022-04-21 17:37:59 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] {}
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020] RCP supported for car W1K1770861V106876: False
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020] Init - car added - W1K1770861V106876
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2022-04-21 17:38:00 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket-prod.risingstars.daimler.com/ws
2022-04-21 17:38:00 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket-prod.risingstars.daimler.com/ws
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: debugMessage
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] debugMessage - Data: Registering User with ciamID: 00151a1ac93e80ad and App-UUID: f2dd900e-4fb9-49ab-a371-67ac8d14829f
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: debugMessage
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] debugMessage - Data: app twin actor was initialized
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] Start _process_assigned_vehicles
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_assigned_vehicles - W1K1770861V106876 - False - Counter({'f': 0, 'p': 0}) - 294
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: vepUpdates
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] Start _process_vep_updates
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] Full Update. W1K1770861V106876
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Odometer for W1K1770861V106876 called
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values W1K1770861V106876 has incomplete update set - attributes not found
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Tires for W1K1770861V106876 called
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values W1K1770861V106876 has incomplete update set - attributes not found
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Doors for W1K1770861V106876 called
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values W1K1770861V106876 has incomplete update set - attributes not found
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Location for W1K1770861V106876 called
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values W1K1770861V106876 has incomplete update set - attributes not found
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values BinarySensors for W1K1770861V106876 called
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values W1K1770861V106876 has incomplete update set - attributes not found
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Windows for W1K1770861V106876 called
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values W1K1770861V106876 has incomplete update set - attributes not found
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Electric for W1K1770861V106876 called
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values W1K1770861V106876 has incomplete update set - attributes not found
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Auxheat for W1K1770861V106876 called
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values W1K1770861V106876 has incomplete update set - attributes not found
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_vep_updates - W1K1770861V106876 - complete: True - Counter({'f': 1, 'p': 0})
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] vepUpdates Sequence: 0
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] Start _process_assigned_vehicles
2022-04-21 17:38:00 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_assigned_vehicles - W1K1770861V106876 - True - Counter({'f': 1, 'p': 0}) - 1
2022-04-21 17:38:00 INFO (MainThread) [custom_components.mbapi2020] Car Load complete - start sensor creation
2022-04-21 17:38:04 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2022-04-21 17:38:04 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2022-04-21 17:38:09 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2022-04-21 17:38:15 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2022-04-21 17:38:22 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request

Hereafter I only see this message repeating in the log:

2022-04-21 17:38:22 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request

Anybody else experiencing issues with Mercedes me?

How to remove a vehicle

Hi, I need to remove a vehicle that I sold. I can delete all the entities, but I cannot see how to delete the device (vehicle)
What is the process for this. thank you.

service(unlock door) VIN unknown or feature not availabe for this car.

Dear ReneNulschDE,

I am living in Korea.

A problem occurred when i request service in to use the component you created.

service: mbapi2020.doors_unlock
data:
vin: W1KZF8XXX

thx
--debug log--
Logger: custom_components.mbapi2020.client
Source: custom_components/mbapi2020/client.py:433
Integration: MercedesME 2020 (documentation, issues)
First occurred: 오후 6:40:08 (1 occurrences)
Last logged: 오후 6:40:08

Can't unlock car W1KZF8XXX. VIN unknown or feature not availabe for this car.

Entities not created if FIN and VIN do not match

I ran into an issue when setting this up where my car would be added, but there would be no entities. I managed to trace this down to my FIN and VIN being different, and the data not being loaded via the FIN. I am in the US, which I suspect is a factor in this.

The good news is that there is already a workaround for anyone who runs into this. By turning on debug logs in my HA configuration, the unrecognized FIN is reported. This FIN can be copied into the "VINs excluded" list in the integration options in HA. Restarting the integration and HA will let the car data load complete, and subsequently the entities will be created.

I am wondering if there is a way to update the logic so this will just work without a new user needing to turn on debug logging to figure out that they need to add the FIN to the exclusion list.

As I looked into this, I noticed that async_setup_entry() in __init__.py uses the FIN for everything in this block, which adds a first car to the list of cars using the FIN. Later, a "second" car is added by the vin in Client._process_assigned_vehicles() in client.py, but this is really the same car. The FIN seems to never be able to complete entry setup, so this block at the end of Client._process_assigned_vehicle() always sets load_complete to False if at least 1 car does not complete, and therefore never executes the callback _on_dataload_complete() that points to MercedesMeContext.on_dataload_complete() in order to create the entities.

Here is my HA log with the logger set for debug and filtered to only show items from mbapi2020. I've redacted anything that might have been personal information. Critically, I noted which items were the <FIN> and which were the <VIN> for the single vehicle I have and confirmed via the debug json output of masterdata in async_setup_entry() in __init__.py.:

2022-01-22 17:57:15 INFO (MainThread) [custom_components.mbapi2020.oauth] Start request PIN <email>
2022-01-22 17:57:33 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start _save_token_info() to /config/.mercedesme-token-cache
2022-01-22 17:57:33 DEBUG (MainThread) [custom_components.mbapi2020.config_flow] Token received
2022-01-22 17:57:33 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2022-01-22 17:57:33 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2022-01-22 17:57:34 DEBUG (MainThread) [custom_components.mbapi2020.client] {}
2022-01-22 17:57:34 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2022-01-22 17:57:34 DEBUG (MainThread) [custom_components.mbapi2020.client] {}
2022-01-22 17:57:34 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020] RCP supported for car <FIN>: False
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020] Init - car added - <FIN>
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020] Remove check: <device_entry.id>, <FIN>
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2022-01-22 17:57:35 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket-prod.risingstars-amap.daimler.com/ws
2022-01-22 17:57:35 INFO (MainThread) [custom_components.mbapi2020.websocket] Connected to mercedes websocket at wss://websocket-prod.risingstars-amap.daimler.com/ws
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: debugMessage
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020.client] debugMessage - Data: Registering User with ciamID: <ciamID> and App-UUID: <app uuid>
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: debugMessage
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020.client] debugMessage - Data: app twin actor was initialized
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020.client] Start _process_assigned_vehicles
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_assigned_vehicles - <FIN> - False - Counter({'f': 0, 'p': 0}) - 388
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_assigned_vehicles - <VIN> - False - Counter({'f': 0, 'p': 0}) - 1642892255842
2022-01-22 17:57:35 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: vepUpdates
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] Start _process_vep_updates
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] Full Update. <VIN>
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Odometer for <VIN> called
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Tires for <VIN> called
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Doors for <VIN> called
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Location for <VIN> called
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values BinarySensors for <VIN> called
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Windows for <VIN> called
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Electric for <VIN> called
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Auxheat for <VIN> called
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_vep_updates - <FIN> - complete: False - Counter({'f': 0, 'p': 0})
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_vep_updates - <VIN> - complete: True - Counter({'f': 1, 'p': 0})
2022-01-22 17:57:36 DEBUG (MainThread) [custom_components.mbapi2020.client] vepUpdates Sequence: 0
2022-01-22 17:57:39 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2022-01-22 17:57:39 DEBUG (MainThread) [custom_components.mbapi2020.client] Start _process_assigned_vehicles
2022-01-22 17:57:39 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_assigned_vehicles - <FIN> - False - Counter({'f': 0, 'p': 0}) - 4390
2022-01-22 17:57:39 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_assigned_vehicles - <VIN> - True - Counter({'f': 1, 'p': 0}) - 3825
2022-01-22 17:57:39 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request

I am unsure what the best way to address this would be, but I hope this is helpful. I can test any changes or get any more data needed, especially if a US tester is required.

Very cool project. Danke!

Km not Miles

Hi, Is this an issue with home assistant or the integration ?

Km Shows when it should be miles.

image

image

The car records Km as you can see above and the unit conversation is correct to miles but displays Km not Miles

Thanks

Error with the websocket connection

I am in Dallas TX / US region
Using Mercedes ME / mbrace application
Vehicle: 2017 GLS450

After I have installed the custom repo under HACS - and installed the integration under Configuration > Integrations - this is what I see:

image

Below is the log error:


Logger: custom_components.mbapi2020.client
Source: custom_components/mbapi2020/client.py:175
Integration: MercedesME 2020 (documentation, issues)
First occurred: 10:37:27 AM (1 occurrences)
Last logged: 10:37:27 AM

Error with the websocket connection: Received message 257:None is not bytes


Thank you for your support

Error importing platform

`Logger: homeassistant.config_entries
Source: config_entries.py:711
First occurred: 08:03:30 (1 occurrences)
Last logged: 08:03:30

Error occurred loading configuration flow for integration mbapi2020: cannot import name 'Platform' from 'homeassistant.const' (/srv/homeassistant/lib/python3.9/site-packages/homeassistant/const.py)`

I've had this error for a while and haven't been able to figure it out. The integration is on v0.6.3

Charging power Updates only after restart.

Hi there,

unfortunately, the charging power entity is updating much slower (hours) than the others. Mostly, I need to restart the Integration in order to get the current value.

Since I'm using Riemann sum integral to estimate Power usage, it would be great, If the charging power updated as reliably as the other entities.

Thanks for the great work!

Error setting up entry mbapi2020 for mbapi2020

Newbie on HA so excuse in case of unnnecessary issue rasing.

The plugin worked fine for me but cannot connect to the service since midday today. Have attached the log below.

Thanks for looking into it.

Cheers
Armin

image

Door lock fails, VIN not associated with user

New setup mbapi2020 is generally working: receiving door, window, ignition, etc sensor updates. Located in US. Integrating with a VS30 Sprinter.

When attempting to lock, command fails. Debug message log below, but message is "VIN does not belong to user". VIN is correct in all sensor updates.

Resolved issue by changing init.py, lines 164,165

was:

  • current_car.finorvin = car.get('fin')
  • current_car.licenseplate = car.get('licensePlate', car.get('fin'))

now:

  • current_car.finorvin = car.get('vin')
  • current_car.licenseplate = car.get('licensePlate', car.get('vin'))

It appears that integration was sending FIN instead of VIN when commanding doors locked. Mercedes was expecting VIN. I know very little on the subject, but looks like FIN and VIN aren't equivalent in US. I'm not sure what else the lines above break, but this appears to be stable for me in the US.

Debug log message:

{
"apptwin_command_status_updates_by_vin": {
"sequence_number": 2,
"updates_by_vin": {
""#####",": {
"vin": "#####",
"updates_by_pid": {
"-#####": {
"process_id": "-#####",
"request_id": "#####",
"timestamp_in_ms": "#####",
"errors": [
{
"code": "RIS_FORBIDDEN_VIN",
"message": "VIN does not belong to user"
}
],
"type": "DOORSLOCK",
"state": "FAILED"
}
}
}
}
}
}

Cannot request PIN

Hi, I'm in Belgium and I am trying to connect HA to Mercedes ME. I installed this component using HACS on a Raspberry Pi 4. Everything seems to be installed correctly but when I try to connect nothing happens and I am stuck on the inputs for the email and the server.
I have these logs:

Logger: custom_components.mbapi2020.oauth
Source: custom_components/mbapi2020/oauth.py:229
Integration: MercedesME 2020 (documentation, issues)
First occurred: 20:03:18 (9 occurrences)
Last logged: 20:11:35

Error requesting data from https://bff-prod.risingstars.daimler.com/v1/login: 400, message='Bad Request', url=URL('https://bff-prod.risingstars.daimler.com/v1/login')
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')

I tried using different servers and even a phone number but I always have the same errors.

Thanks in advance for your help
Tim

Error setting up entry mbapi2020 for mbapi2020 1

Hello,

first of all thank you for your work.
while trying to add the integration I got the following error

Error setting up entry mbapi2020 for mbapi2020
15:49:37 – (ERROR) MercedesME 2020 (custom integration)

This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/mbapi2020/api.py:76
Integration: MercedesME 2020 (documentation, issues)
First occurred: 15:49:37 (1 occurrences)
Last logged: 15:49:37

Error setting up entry mbapi2020 for mbapi2020
Traceback (most recent call last):
  File "/config/custom_components/mbapi2020/api.py", line 73, in _request
    resp.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('https://bff-prod.risingstars.daimler.com/v1/vehicle/self/masterdata')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/mbapi2020/__init__.py", line 118, in async_setup_entry
    masterdata = await mercedes.client.api.get_user_info()
  File "/config/custom_components/mbapi2020/api.py", line 83, in get_user_info
    return await self._request("get", "/v1/vehicle/self/masterdata")
  File "/config/custom_components/mbapi2020/api.py", line 76, in _request
    raise RequestError(f"Error requesting data from {url}: {err}")
custom_components.mbapi2020.errors.RequestError: Error requesting data from https://bff-prod.risingstars.daimler.com/v1/vehicle/self/masterdata: 404, message='Not Found', url=URL('https://bff-prod.risingstars.daimler.com/v1/vehicle/self/masterdata')

I have already try :

  • Android app is OK
  • delete and readd integration
  • deleted the .mercedesme-token-cache file in your HA-config folder
  • try to check the "debug" option. but I don't think the integration even start... I can't see a message folder in ls config/custom_components/mbapi2020/

instalation was done via HACS
version
v0.5.14

running on :
Supervised
Home Assistant 2021.12.7

Let me know if I can help and provide more info

Error Requesting Data, Please reauthenticate

I just tried to set up the MBAPI for my 2019 CLA Shooting brake.
Installing and receiving the TAN-Code all worked perfectly fine, I got the message that the MBAPI was successfully set up.
But then the message appeared to reauthenticate. Am I doing something wrong?

afbeelding

afbeelding

afbeelding

Latest reads from the log:
2021-05-18 18:44:58 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-05-18 18:44:58 ERROR (MainThread) [custom_components.mbapi2020] Authentication failed. Please reauthenticate. 2021-05-18 18:46:00 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-05-18 18:46:00 ERROR (MainThread) [custom_components.mbapi2020] Authentication failed. Please reauthenticate. 2021-05-18 18:52:56 ERROR (MainThread) [homeassistant.components.system_health] Error fetching info Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/system_health/__init__.py", line 69, in get_integration_info data = await registration.info_callback(hass) File "/config/custom_components/mbapi2020/system_health.py", line 21, in system_health_info client = hass.data[DOMAIN] KeyError: 'mbapi2020'

Unnecessary reauthentication

Hello.

Thanks for an awesome custom component!

Every third time I restart HA, the mbapi component is no longer working, since I need to reauthenticate. I can write all sorts of nonsense in username and PIN - I can also select any region I wish. After clicking submit, I get a message saying "successful". The component is also working as it should, so I really think it is a bug.

Binary Sensor doesn't get updated (windows_closed)

Not sure if I'm the only one, but in my homeassistant instance the binary_sensor.xxxx_windows_closed doesn't get updated, the interesting part is that its attributes do get updated:

So in other words binary_sensor.xxxx_windows_closed shows the value of on while its attributes are:

  • windowstatusrearright: 1
  • windowstatusfrontright: 1
  • windowstatusrearleft: 1
  • windowstatusfrontleft: 1

I can provide more info if you need, I'm just not sure what else is useful right now.

Use string state instead of numerical

Could you change the numerical states to string, so for example, instead of Ignition state being 1, 2 ,3, ... , it would be the equivalent in Description_short .

404 - https://bff-prod.risingstars.daimler.com/v1/vehicle/self/masterdata

Hello,

updated yesterday the plugin for the homeassistant, and I'm getting:


Error setting up entry mbapi2020 for mbapi2020

Traceback (most recent call last):
File "/config/custom_components/mbapi2020/api.py", line 73, in _request
resp.raise_for_status()
File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('https://bff-prod.risingstars.daimler.com/v1/vehicle/self/masterdata')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/mbapi2020/init.py", line 118, in async_setup_entry
masterdata = await mercedes.client.api.get_user_info()
File "/config/custom_components/mbapi2020/api.py", line 83, in get_user_info
return await self._request("get", "/v1/vehicle/self/masterdata")
File "/config/custom_components/mbapi2020/api.py", line 76, in _request
raise RequestError(f"Error requesting data from {url}: {err}")
custom_components.mbapi2020.errors.RequestError: Error requesting data from https://bff-prod.risingstars.daimler.com/v1/vehicle/self/masterdata: 404, message='Not Found', url=URL('https://bff-prod.risingstars.daimler.com/v1/vehicle/self/masterdata')


Please help!

Thanks

Preheat_start failures

I have a 2015 merc b class electric.
It is fully supported in the mercedes me app. I have generated a pin and put that in the options.
When attempting to start preconditioning i see the following in the logs.

2021-01-19 19:33:53 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-01-19 19:33:53 DEBUG (MainThread) [custom_components.mbapi2020.client] assigned_vehicles
2021-01-19 19:34:08 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-01-19 19:34:08 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-01-19 19:34:08 DEBUG (MainThread) [custom_components.mbapi2020.client] assigned_vehicles
2021-01-19 19:34:20 INFO (MainThread) [custom_components.mbapi2020.client] Start preheat_start for vin WDD2428902J008167
2021-01-19 19:34:20 INFO (MainThread) [custom_components.mbapi2020.client] End preheat_start for vin WDD2428902J008167
2021-01-19 19:34:20 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_command_status_updates_by_vin
2021-01-19 19:34:20 DEBUG (MainThread) [custom_components.mbapi2020.client] apptwin_command_status_updates_by_vin - Data: {
  "apptwin_command_status_updates_by_vin": {
    "updates_by_vin": {
      "WDD24xxxxx": {
        "vin": "WDD2428xxxxxx",
        "updates_by_pid": {
          "54148417": {
            "process_id": "54148417",
            "request_id": "67233e72-27c4-4bee-9a9a-49d9423ac732",
            "timestamp_in_ms": "-1",
            "type": "PRECONDSTART",
            "state": "INITIATION"
          }
        }
      }
    }
  }
}
2021-01-19 19:34:20 DEBUG (MainThread) [custom_components.mbapi2020.client] apptwin_command_status_updates_by_vin: 0
2021-01-19 19:34:22 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_command_status_updates_by_vin
2021-01-19 19:34:22 DEBUG (MainThread) [custom_components.mbapi2020.client] apptwin_command_status_updates_by_vin - Data: {
  "apptwin_command_status_updates_by_vin": {
    "sequence_number": 1,
    "updates_by_vin": {
      "WDD2428xxxxxx": {
        "vin": "WDD242xxxxx",
        "updates_by_pid": {
          "54148417": {
            "process_id": "54148417",
            "request_id": "67233e72-27c4-4bee-9a9a-49d9423ac732",
            "timestamp_in_ms": "1611084860000",
            "errors": [
              {
                "code": "CMD_FAILED",
                "message": "Command failed. Normally, there should be additional business errors detailing what exactly went wrong"
              }
            ],
            "type": "PRECONDSTART",
            "state": "FAILED"
          }
        }
      }
    }
  }
}
2021-01-19 19:34:22 DEBUG (MainThread) [custom_components.mbapi2020.client] apptwin_command_status_updates_by_vin: 1
  "apptwin_command_status_updates_by_vin": {
    "sequence_number": 2,
    "updates_by_vin": {
      "WDD242890xxxxxxx": {
        "vin": "WDD24289xxxxxxxxx",
        "updates_by_pid": {
          "54148417": {
            "process_id": "54148417",
            "request_id": "67233e72-27c4-4bee-9a9a-49d9423ac732",
            "timestamp_in_ms": "1611084860000",
            "errors": [
              {
                "code": "CMD_FAILED",
                "message": "Command failed. Normally, there should be additional business errors detailing what exactly went wrong"
              }
            ],
            "type": "PRECONDSTART",
            "state": "FAILED"
          }
        }
      }
    }
  }
}
2021-01-19 19:34:22 DEBUG (MainThread) [custom_components.mbapi2020.client] apptwin_command_status_updates_by_vin: 2
2021-01-19 19:34:23 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-01-19 19:34:23 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-01-19 19:34:23 DEBUG (MainThread) [custom_components.mbapi2020.client] assigned_vehicles
2021-01-19 19:34:38 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-01-19 19:34:38 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-01-19 19:34:38 DEBUG (MainThread) [custom_components.mbapi2020.client] assigned_vehicles
2021-01-19 19:34:53 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: apptwin_pending_command_request
2021-01-19 19:34:53 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: assigned_vehicles
2021-01-19 19:34:53 DEBUG (MainThread) [custom_components.mbapi2020.client] assigned_vehicles````

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.