Mercedes Me Component

Hello @ReneNulschDE, you have done some amazing work here by the looks of it.
This year I have decided to try and learn to code and I jumped in the deep end with HA, so I am very new to this. have you by any chance created a single Guide on how to have ha work with a Mercedes? There are 5 years of messages here, and I have looked back a while and have not seen a single-point guide. you mentioned above you are looking for Beta testers, I am happy to do some testing for you, but as I mentioned I am very new to coding. do you have a GitHub with installation and set-up instructions by any chance? TIA

Hi Justin, welcome to the club. The general starting point is GitHub - ReneNulschDE/mbapi2020: Custom Component to integrate MercedesME devices into Home-Assistant

1 Like

Hi Dave,

As Rene said you only need to select APAC in the on boarding. Please note that I had to upgrade to the latest version of mbapi2020 as there was some APAC headers that were changed. Additionally I also had to upgrade to the latest version of HA (I was previously on core 2022.6.3) because there was some changes in the constants file that were not recognized.
All the entities are working again after this.

Rene,
Great code. Thankyou to you and Peter for the quick response. I was using it with my Mercedes adaptor in my old car. I now have an E350e and have installed your latest beta. I am on the latest HA i.e. Home Assistant 2023.1.0, Supervisor 2022.12.1, Operating System 9.4 & Frontend 20230104.0 - latest. I chose Asia Pacific and used AU and en-AU in the setup. I am in Canberra Australia.

PS: Dont discount the possibility that the problem is with Mercedes as the Mercedes Me app has connection problems with the car e.g. when locking the door it tells me there is an internet connection problem, however other functions work fine. The Mercedes Me web application works fine also.

The log shows this error:

2023-01-06 15:35:12.458 INFO (MainThread) [custom_components.mbapi2020.client] WSL not detected - running in rlock mode
2023-01-06 15:35:12.458 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2023-01-06 15:35:12.459 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2023-01-06 15:35:18.716 DEBUG (MainThread) [custom_components.mbapi2020] VIN not found in masterdata. Used FIN W1K2130532B094312 instead.
2023-01-06 15:35:18.716 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2023-01-06 15:35:21.988 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2023-01-06 15:35:23.921 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2023-01-06 15:35:24.964 DEBUG (MainThread) [custom_components.mbapi2020] RCP supported for car W1K2130532B094312: False
2023-01-06 15:35:24.964 DEBUG (MainThread) [custom_components.mbapi2020] Init - car added - W1K2130532B094312
2023-01-06 15:35:24.964 DEBUG (MainThread) [custom_components.mbapi2020.client] start update_poll_states
2023-01-06 15:35:24.964 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2023-01-06 15:35:26.041 DEBUG (MainThread) [custom_components.mbapi2020.oauth] Start async_get_cached_token()
2023-01-06 15:35:26.042 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.amap-prod.mobilesdk.mercedes-benz.com/ws
2023-01-06 15:35:26.602 ERROR (MainThread) [custom_components.mbapi2020.websocket] Could not connect to wss://websocket.amap-prod.mobilesdk.mercedes-benz.com/ws, retry in 10 seconds...
2023-01-06 15:35:33.412 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.solar_radiation (<class 'custom_components.ecowitt.sensor.EcowittSensor'>) is using native unit of measurement 'W/m^2' which is not a valid unit for the device class ('illuminance') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
2023-01-06 15:35:36.605 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.amap-prod.mobilesdk.mercedes-benz.com/ws
2023-01-06 15:35:36.776 ERROR (MainThread) [custom_components.mbapi2020.websocket] Could not connect to wss://websocket.amap-prod.mobilesdk.mercedes-benz.com/ws, retry in 10 seconds...
2023-01-06 15:35:46.778 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.amap-prod.mobilesdk.mercedes-benz.com/ws
2023-01-06 15:35:47.050 ERROR (MainThread) [custom_components.mbapi2020.websocket] Could not connect to wss://websocket.amap-prod.mobilesdk.mercedes-benz.com/ws, retry in 10 seconds...
2023-01-06 15:35:54.053 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0x9C24:3:0x0008]: async_initialize: all attempts have failed: [DeliveryError('Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>'), DeliveryError('Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>'), DeliveryError('Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>'), DeliveryError('Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>')]
2023-01-06 15:35:57.052 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.amap-prod.mobilesdk.mercedes-benz.com/ws
2023-01-06 15:35:57.143 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0x9C24:3:0x0006]: async_initialize: all attempts have failed: [DeliveryError('Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>'), DeliveryError('Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>'), DeliveryError('Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>'), DeliveryError('Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>')]
2023-01-06 15:35:57.250 ERROR (MainThread) [custom_components.mbapi2020.websocket] Could not connect to wss://websocket.amap-prod.mobilesdk.mercedes-benz.com/ws, retry in 10 seconds...
2023-01-06 15:36:07.252 INFO (MainThread) [custom_components.mbapi2020.websocket] Connecting to wss://websocket.amap-prod.mobilesdk.mercedes-benz.com/ws
2023-01-06 15:36:07.424 ERROR (MainThread) [custom_components.mbapi2020.websocket] Could not connect to wss://websocket.amap-prod.mobilesdk.mercedes-benz.com/ws, retry in 10 seconds...

VIN number is correct

Thanks David, the component simulates the MB-App. So let us first concentrate on the App. What works in the App and what not? Do you get the simple status updates like windows/doors or fuel-level or battery level?
As a second option you can enable the Option “DEBUG ONLY: Enable save server messages to the messages folder” in the option dialog in the options dialog of this component. Then restart HA, wait 2min. Disable the option again. You should find multiple files in the folder YOURHA-ConfigFolder/custom_components/mbapi2020/messages. Zip these messages and send it to me via email to (mbdev.dave_bryant (at) nulsch . de)

I have published a release v0.8.0 - contains breaking changes!

Primary objectives of this release:

  1. Fix the unit handling for ALL the people. Now the units from the MB app are used and no conversation based in HA settings is done anymore. Should be esp. interesting for the people in the UK and Down-under.
  2. Move the (first) attributes to sensors (based on the recommendation of the HA-creators)
  3. Code changes required for to the upcoming HA-release 2022-02 (eventually 2022-01, depending on late changes)

All breaking changes:

Units:

  • All units are based on the settings of the MB Me (Connect) App now.

Sensor SOC

  • added State Class measurement
  • removed attribute chargingpower (extra sensor now)

Sensor Odometer

  • removed attribute averageSpeedReset (extra sensor now)
  • removed attribute averageSpeedStart (extra sensor now)
  • removed attribute distanceReset (extra sensor now)
  • removed attribute distanceStart (extra sensor now)
  • removed attribute distanceZEReset (extra sensor now)
  • moved attribute drivenTimeZEReset to sensor distanceZEReset
  • moved attribute drivenTimeReset to sensor distanceReset
  • moved attribute drivenTimeZEReset to sensor distanceZEReset
  • removed attribute batteryState (extra sensor starterBatteryState now)
  • removed attribute ecoscoretotal (extra sensor ecoscoretotal now)
  • removed attribute ecoscorefreewhl (extra sensor ecoscorefreewhl now)
  • removed attribute ecoscorebonusrange (extra sensor ecoscorebonusrange now)
  • removed attribute ecoscoreconst (extra sensor ecoscoreconst now)
  • removed attribute ecoscoreaccel (extra sensor ecoscoreaccel now)
  • removed attribute ecoscorebonusrange (extra sensor ecoscorebonusrange now)
  • removed attribute liquidconsumptionstart (extra sensor liquidconsumptionstart now)
  • removed attribute liquidconsumptionreset (extra sensor liquidconsumptionreset now)
  • removed attribute rangeliquid (extra sensor rangeliquid now)
  • removed attribute tanklevelpercent (extra sensor tanklevelpercent exists already)

Sensor distanceZEReset

  • added attribute drivenTimeZEReset (from Odometer)

Sensor distanceStart

  • added attribute drivenTimeStart (from Odometer)

Sensor distanceReset

  • added attribute drivenTimeReset (from Odometer)

Sensor tanklevelpercent

  • added State Class measurement

New Features

  • Attributes windowstatusrearleftblind, windowstatusrearrightblind, windowstatusfrontrightblind, windowstatusfrontleftblind added to sensor windowStatusOverall (“Windows Closed”)

Non Breaking Changes (hopefully)

  • Changed underlaying websocket communication from Google Protobuf 3.2 to 4.21 - Prevent errors on fresh installations with a higher protobuf version then 3.19 (Should be backwards compatible until 3.19.1, this was the minimum version for some months already)
  • Code Cleanup
  • Better exception logging for websocket connection problems

Stats

  • added ~2k lines of code and removed 14k
  • tested with HA versions 2022.11.5 and 2022.12.9 and latest DEV (with my european profile)

Potential problems

  • Your template sensors needs to be adopted in case you use the above mentioned attributes
  • some statistics needs to be fixed (see yourHA-URL/developer-tools/statistics)
  • readme not updated yet
2 Likes

Hi
how can i remove the icons of some entities manually?
for example the Entity “State of charge” and “range electric” have this “icon: mdi:ev-station” but with the device class it gets the right icon automatically.
if i remove this icon by hand i pops up again after a reboot.


Hi,

the icon is defined here currently.

Let me test this and check if I can remove this in one of the next releases.

BR
Rene

ok thanks.
there are some more values where it would be better to have the device_class defined and not the icon.

feel free to share your details or a pull request on github. Thx

Engine Management Status shows "Problem"

Firstly, thank you all concerned for the design, coding and testing of this excellent integration. Having bought our first ever Mercedes Benz I was initially disappointed when I could not find an integration for it as I had never used custom integrations. I have a few years of experience with HA as I have been using it mainly to monitor a ground source heat pump.

I use the Lovelace GUI to implement a few relevant cards, one of which includes the Engine Management Status. The status switched from “Off” to “On” - hence a problem - at 29th December at 11:55 and has indicated a problem ever since. The car’s display does not show a problem neither does the Android app.

Any ideas on how to reset this?

I have attempted to use Dwain’s Dashboard to implement a more aesthetically pleasing page for the Merc but failed so far. I may just use templates to access the attributes of the entities. I note that some - like the Adblue level - does not get displayed even though a check on the code shows it is in the version I am running. I suspect that is dependent on the specific car model though.

Thanks again for all the work and the collaboration. Although I do not use HA anywhere near the examples I see, I am extremely grateful.

Hi Renè,

I just would like to thank you for this awesome work. It works for me like a charme.

So thank you very much for this. I directly included my new E Coupe I got in the facility in Bremen just before Christmas. That’s AWESOME! :slight_smile:

Can anyone tell me what is the meaning of the following?

“Diagnose
sensor.xyzcensored_car
and
sensor.xyzcensored_car_rcp_features”

I have no idea what that means. Also the github page does not give more infos about that. for the _car sensor numbers are changing all the time, but what they mean… no clue…

Hi,

thanks for the flowers.

Car Sensor: I looked for a way to have some attributes to monitor the Command/Services execution. The sensor shows the number of full updates received (is useless for a normal user). However you see some attributes where you can monitor if a command like Windows_Open was executed correctly

RCP_Features: Here I started the development to support the change of the interior settings of the car like lights, sounds, … - whenever this shows true, then your car and your account are supporting the changes. Now, I just need some time to implement all the RCP=RemoteCommandProtocol functions. The interest in this thread for such functionality was quite low - and my “dev”-version is not good enough to share, but I “like” that the interior lightning gives me indicator of unread emails in my corp account.

hope this helps
BR
Rene

1 Like

That was a super fast reply :slight_smile:

If the DEV version does not break anything and you would like someone else to test it let me know

I really like this project! I was trying to search if it’s possible to send an address over the api but couldn’t find anything. Is it?

Thanks for developing!

Hello

Nice work!

I would have reused your yaml shared code, but I guess you forgot the picture_button template whose you declare in your sample.

Could you enrich your post ?

Thank you in advance

Hi Jan,

please check the thread entry:

BR
Rene

1 Like

Sure thing.

picture_button:
  aspect_ratio: 1/1
  show_state: true
  size: 70%
  styles:
    card:
      - border-radius: 15px
    custom_fields:
      s2:
        - justify-self: start
        - margin-left: 10%
        - padding-bottom: 5%
        - font-size: 10pt
    label:
      - justify-self: start
    name:
      - justify-self: start
      - margin-left: 10%
      - font-weight: bold
    state:
      - justify-self: start
      - margin-left: 10%
      - font-size: 10pt

Thanks a lot for this integration. Just discovered it and installation and some dashboard was super easy. Now I finally can activate the aux heating via HA, hooray!

One thing, that was my main reason to even look up potential HA integration for my Mercedes, is about the status of the trunk. The standard Mercedes key likes to open the trunk when it got somehow pressed in my pockets without my knowledge.

I can see a lock sensor (come sback with “2” currently - what does that mean?) and window sensors.

Any idea how to retrieve the status of the trunk to get me alarmed when it’s open? It’s a shame that the original iPhone app can’t do that.

Thanks so much!

I recognize this :slight_smile:

It is an atrribute called decklid i think

2 Likes