Mercedes Me Component

Hi Tom (@TGILLY)

did you deleted the .mercedesme-token-cache file in your HA-config folder before adding the integration again?

Please explain in detail your environment and the steps that you made. Enable the debug mode and share the logs (via private message if you prefer)

BR
Rene

1 Like

Hi rmertz3282,

I’ve been trying, for days now, to include this horseshoe tinghy in my Car pop-screen. Unfortunately, I’m always getting an error : invalid configuration and I can’t find the issues. I nested the card into a picture-elements card, but still resulting in errors:


This is how it looks, but I’m missing my beautifull radiant card :slight_smile:

The code for this (partial) is following:

´´´

dwains_dashboard

More-page add-on: mercedes

Created by Jeroen Klompen

Version: 1.1.1

type: custom:dwains-flexbox-card

items_classes: ‘col-xs-12 col-sm-6 col-md-6 col-lg-6’

padding: true

cards:

type: vertical-stack
cards:
- type: picture-elements
image: /local/images/mercedes/car.png
style: |
ha-card {
padding: 5px;
border-radius: 5px;
background-color: var(–dwains-theme-primary);
}
elements:
- type: ‘custom:flex-horseshoe-card’
entities:
- entity: sensor.2_amu_833_fuel_level
decimals: 1
unit: ‘%’
area: Fuel
show:
horseshoe_style: colorstopgradient
layout:
states:
- id: 0
entity_index: 0
xpos: 50
ypos: 60
styles:
- font-size: 4em;
areas:
- id: 0
entity_index: 0
xpos: 50
ypos: 35
styles:
- font-size: 3em;
- opacity: 0.8;
horseshoe_scale:
min: 0
max: 100
color_stops:
‘25’: red
‘40’: yellow
‘60’: green
style:
top: 70%
left: 0%
width: 7em
height: 8em
transform: none
‘–ha-card-background’: transparent

- type: horizontal-stack
  cards:
    - type: picture-elements
      style: |
        ha-card {
          padding: 5px;
          border-radius: 5px;
          background-color: var(--dwains-theme-primary);
        }
      elements:
          - entity: sensor.2_amu_833_fuel_level
            prefix: ''
            style:
              transform: 'translate(-50%, -50%) scale(1.3, 1.3)'
              color: lightgrey
              left: 15%
              top: 17%
            type: state-label
          - entity: sensor.2_amu_833_odometer
            prefix: ' '
            style:
              transform: 'translate(-50%, -50%) scale(1.3, 1.3)'
              color: lightgrey
              left: 39%
              top: 17%
            type: state-label
          - entity: sensor.car_window_sunroof
            style:
              transform: 'translate(-50%, -50%) scale(0.7, 0.7)'
              '--paper-item-icon-color': null
              left: 57%
              top: 17.5%

´´´
You think you can help me out ?

Thanks in advance !!!

Kind regards,

Bart

I was able to get it working. I realized after it is setup if I turn on the vehicle it will sync with homeassitant.

I am in the US and yes the model year is 22

However I get all the notification events, but when I try to trigger and action for example lock the car I get this error message

This error originated from a custom integration.

Logger: custom_components.mbapi2020.client
Source: custom_components/mbapi2020/client.py:467
Integration: MercedesME 2020 (documentation, issues)
First occurred: 5:25:18 PM (7 occurrences)
Last logged: 6:30:48 PM

Can’t lock car . VIN unknown or feature not availabe for this car.
Can’t lock car . VIN unknown or feature not availabe for this car.

Please disable the feature check in the options of the integration. This is needed for the US region. Restart HA. Then it should work.

BR
Rene

hello since yesterday the Mercedes 2000 integration no longer works, does it happen to you too?
I enter the data but I have no result, can you help me solve it? Tanks

Could you a little bit more specific? What does not work? My cars getting updated currently.

Hi All,

I would like to know if we can extract the amount of KWh that the car has been charged with per session/day/…
Problem is that I can measure the power from my charger, ONLY, if I disconnect from the mgmt platform and connect to HA.

Any ideas .?

Kr,

Bart

I also received this error message when installing thew component for the first time. Any progress? 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: 4:17:08 PM (1 occurrences)
Last logged: 4:17:08 PM

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 1000, 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’)

Hi,

I see this error now too (worked this morning). Looks like MB has some problems or made some changes to the API. Let me try to find the reason.

BR

Same to me. Just received this error about a couple of hours ago. I have everything up and running for almost a year already. It looks like that API path is no longer a thing.

Steve

yeah, MB changed the API a little bit. Give me some hours. Found a way already. just have to type some code and make some tests.

I have created a new release 0.6.0 to address this error.

unfortunatly, the release contains tons of other changes and it could be that some other problems are in the code even that I run this version on my systems since 4 weeks.

click on update information if Hacs does not show the update:
image

Known Problems:

  • LiquidRangeCritical is not reported by the MB API currently. The sensor will show unavailable or is not present when you have a fresh installation
1 Like

Hi Ronin,
That was a breath taking configuration. Is there any chance to share the configuration to a guy in Norway :slight_smile:

Hi @ReneNulschDE ,

Thanks for the prompt action on fixing this problem. I’ve just tried updating to the latest version and as you predicted there’s another problem.

File "/home/homeassistant/.homeassistant/custom_components/mbapi2020/__init__.py", line 23, in <module>
    from .const import (
  File "/home/homeassistant/.homeassistant/custom_components/mbapi2020/const.py", line 7, in <module>
    from homeassistant.const import (
ImportError: cannot import name 'Platform' from 'homeassistant.const' (/home/homeassistant/.local/lib/python3.8/site-packages/homeassistant/const.py)

This is the stacktrace I receive in the logs. I actually have a look at the homeassistant.const file and indeed there isn’t any constant called Platform defined there to import. My Hassio version is core-2021.11.3.

EDIT: The Platform class const is only added from 2021.12.9. That explains why it’s missing from mine. Is there any alternative that I could do without having to upgrade my Hass version? The main reason why I cant do it now is that 2021.12.x requires python 3.9 while I’m on RaspOS so can’t yet find a way to have the desired version installed.

Looking forward to your suggestion here, mate.

Cheers

Kk. I found a workaround which is to not import those constants from const.py but just paste the constants there manually.

It’s all up and running now.

I have just installed the new version of mbapi2020 on core-2021.12.7 and it works right out of the gate.

Thank you for all your work on this great project.

1 Like

I’m collecting all charging sessions to a google sheet from HA, with automations for charge stop and charge start. quite easy to setup

Would you mind sharing ? I’m trying to incorporate that into my energy dashboard :slight_smile:

I seem to be getting a problem that has borked this integration:

2022-01-19 09:45:48 ERROR (MainThread) [homeassistant.config_entries] 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')
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'

Hi Richard, please update to the latest version. See the messages from last Friday. MB has changed the API and the new version is available since Friday too.

BR
Rene