Mercedes Me Component

Hi @rmertz3282,

That looks VERY AWESOME !!! very nice done ! If it’s not too much trouble, I’d love to have a look at the config

Kr,

Bart

I use the decluttering card a lot but I think you can figure out what is happening.

              - type: 'custom:decluttering-card'
                template: car_template
                variables:
                  - entity: device_tracker.la221804_device_tracker
                  - person: person.ranman
                  - image: GLS450
                  - name: GLS
                  - filter: '*la221804*'
                  - fuel_level: sensor.la221804_fuel_level
                  - ignition: sensor.la221804_ignition_state

Then the template. Notice I’m using several other nested cards within the pop-up.

# lovelace_gen

  car_template:
    card:
      type: 'custom:button-card'
      entity: '[[entity]]'
      entity_picture: '/local/images/[[image]].png'
      show_entity_picture: true
      name: '[[name]]'
      size: 100%
      template:
        - picture_button
        - car_button
      styles:
        card:
          - '--paper-card-background-color': 'rgba(40, 40, 40)'
          - box-shadow: >
              [[[ if (states['[[ignition]]'].state == '4') return "0px 0px 10px
              3px crimson"; return "none"; ]]]
      tap_action:
        action: fire-dom-event
        browser_mod:
          command: popup
          title:  Status
          card:
            type: 'custom:vertical-stack-in-card'
            cards:
              - type: 'custom:auto-entities'
                card:
                  type: glance
                  show_name: false
                  state_color: true
                filter:
                  include:
                    - entity_id: '[[filter]]'
                  exclude:
                    - entity_id: '*device*'
                    - entity_id: '*closed*'
                    - entity_id: '*starter*'
                sort:
                  method: name
              - type: map
                entities:
                  - entity: '[[entity]]'
                  - entity: '[[person]]'
                aspect_ratio: '16:9'
                default_zoom: 12.5
                hours_to_show: 24
      custom_fields:
        fuel:
          card:
            type: 'custom:flex-horseshoe-card'
            entities:
              - entity: '[[fuel_level]]'
                attribute: temperature
                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: 75%
              left: 0%
              width: 7em
              height: 8em
              transform: none
              '--ha-card-background': transparent

And the car button template


# lovelace_gen

  car_button:
    aspect_ratio: 1/1
    state:
      - value: "on"
        styles:
          card:
            - "--paper-card-background-color": "rgba(40, 40, 40)"
            - box-shadow: 0px 0px 10px 3px var(--button-card-light-color)
          name:
            - color: white
          state:
            - color: white
          label:
            - color: white
      - value: "off"
        styles:
          label:
            - color: "rgba(0, 0, 0, 0.0)"
    styles:
      custom_fields:
        fuel:
          - bottom: 10%
          - right: 0%
          - height: 45px
          - width: 52%
          - position: absolute
      grid:
        - grid-template-areas: '"i l" "n n" "s s" "fuel fuel"'
        - grid-template-columns: 1fr
        - grid-template-rows: 1fr auto auto min-content

1 Like

very nice Robert,

Do you also have an idea how to change the color of the icon, depending wether it’s locked = green and unlocked = red ?

Thx in advance,

Bart

I think you’ll have to do that from Lovelace (and quite possibly only with something like lovelace_gen), I don’t think it’s possible to set icon color from sensor definitions.

Hi all! I have an A 250 e with pre-entry climate control functions, but I can’t find the pre-entry switches in my HA entities at all. Does this function have some country/vehicle-specific restrictions I’m not aware of?

Hi @SamiJalopino ,

welcome and thanks for using this custom component.

There are two types of preconditioning: Aux-Heating and Pre-Conditioning

Depending on your car config you can call HA-Services with a button (or automation) for example:

Pre-Conditioning (for e-cars)

type: button
tap_action:
  action: call-service
  service: mbapi2020.preheat_start
  service_data:
    vin: VINOFYOURCAR
  target: {}

Pre-Heating (for cars with a secondary aux heating engine)

type: button
tap_action:
  action: call-service
  service: mbapi2020.auxheat_start
  service_data:
    vin: VINOFYOURCAR
  target: {}

See the docs for some more details and options.

BR
Rene

Excellent! Thanks Rene, I’ll give it a go.

Hi all,

first of all happy new year and thank you to the active and inactive users of this component. The latest stats showing that every day a new user is joining the club (btw: thanks for sharing the HA analytics/usage data).

Around 4 years ago, I got my first MB car and I tried to integrate the car data into Home Assistant. Over the time, I learned some basic python, MB changed their app landscape a lot (to the better of course) and I tried to keep the speed of all the HA changes.

As some of you know, this component does not use the official MB API’s. Main reasons are that the inofficial APIs deliver much more data and the updates come in near to realtime.

Nevertheless, it should be clear that the MB-Dev team can close the door whenever they want. And as I know, that some MB-devs reading this thread: Thanks to the MB-Dev team, for the great development in the last years and thanks for not shutting down the possibility to use my own data in the application that I like.

Let me give you some insights what is planned for the next months (as long as MB is on the friendly side):

  1. Adding some new services to control the interior esp. interior lighting. This needs some refactoring of the component load process, the MB-API is not the fastest here and a reauth is needed and I try to find out a way to do this without big interruptions.
  2. I want to learn more about Lovelace and therefore I plan to deliver the component with some preconfigured UI components. (Thanks to all the contributors in the thread here - I learned a lot)
  3. Fix the HA-units vs. MB-units problem - my plan is to add an option where you can swith between HA-unit sytem and MB-App-unit sytem.

What else do you want to see?

Thanks again - you’re active involvement here gives me the motivation to move on.

BR
Rene

PS: If you like the integration give it a star on the Github-repo…

4 Likes

Hi Rene,
In the meantime I pretty much tried everything even completely re-installed HA and got the to same issue. Do you have any other options to try ? Thanks!

This error originated from a custom integration.

Logger: custom_components.mbapi2020.oauth
Source: custom_components/mbapi2020/oauth.py:246
Integration: MercedesME 2020 (documentation, issues)
First occurred: 1:21:00 PM (1 occurrences)
Last logged: 1:21:00 PM

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

Hello, I have been having issues with this integration and can’t seem to find the cause.

I have tried to install it both ways (Copying to my config folder, and via HACS)

I authenticate and it pull my device model and year, but I do not see any entities.

The SUV is MY22
Firmware: Star2.3

Logger: custom_components.mbapi2020.client
Source: custom_components/mbapi2020/client.py:556
Integration: MercedesME 2020 (documentation, issues)
First occurred: 11:29:01 PM (5 occurrences)
Last logged: 11:45:30 PM

  • Can’t start engine for car . VIN unknown or feature not availabe for this car

Thanks in advance!

Hi @janz ,

Are you based in Europe or Noram? Does the feature work in the IOS/Android app? MY22 means model year 22?

can you enable “DEBUG ONLY: Enable save server messages to the messages folder” in the options of the integration. Restart your HA, wait 3minutes and send me the files out of the custom_integrations/mbapi2020/messages folder?

BR
Rene

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