Mercedes Me Component

It was some months ago. I just tried some things now and you are (no surprise) right that maxrange will expose without units. I must have misremembered - sorry.

However, if you use sensor.xxxx_range_electric main entity without attribute, it gives the range (in miles in my case) but with the fixed suffix of ‘km’. It must have been this that threw me off as I was using a card that wouldn’t allow attributes, leading me to create a template instead. I honestly don’t remember which card type it was.
image

  - entity: sensor.rangeinmiles
    name: Miles range
    icon: mdi:ev-station
    title: EQC
  - type: attribute
    entity: sensor.wd70kwf_range_electric
    attribute: maxrange
    name: Range at 100%
  - entity: sensor.wd70kwf_range_electric

Thx, but this means that your HA instance is set to Metric, right. It would change when you modify the unit system to imperial (plus HA restart).

Thanks - understood. Unfortunately, I’m in the oddball country that uses metric for most things except miles (but only for driving) and pints (only for beer). :laughing:

Oh well, I’ll stick with my template solution which is working fine anyway. Appreciate your help as ever.

You can overwrite the unit_of_measurement via customization. See the second last post here: Km not Miles · Issue #26 · ReneNulschDE/mbapi2020 · GitHub

or here:

1 Like

Hi. I did try searching for this, but I can’t find an answer. In the Mercedes Me app, I can find the location of my car. I can also get the location using the Alexa skill. Can I get the location in HA somehow?
Thanks

It’s on the map (as long as the car is not in one of your zones). You should have an entitiy device_tracker.XXX_device_tracker (XXX=your license plate or fin/vin)

try this map card configuration (replace XXX):

type: map
entities:
  - entity: device_tracker.XXX_device_tracker
hours_to_show: 96
default_zoom: 12

this shows the travel of your car in the last 96h:
image

or use an automation to close the sunroof when you enter the home zone (I hate to wait for the sunroof closing when I would like to leave the car), or, or, or

alias: Close SunRoof when entering home zone
description: ''
trigger:
  - platform: device
    device_id: XXXXXXXX
    domain: device_tracker
    entity_id: device_tracker.XXXXXX_device_tracker
    type: enters
    zone: zone.home
condition: []
action:
  - service: mbapi2020.sunroof_close
    data:
      vin: W1NXXXXXXXXX
mode: single
1 Like

Thanks - it wasn’t there, but that may be because I just renewed my mercedes services. Now, the serviceintervaldays is missing from the odometer device - it was there previously, but not now (and is still showing in the Mercedes Me app).

serviceintervaldays is one of the attributes that are missing sometimes. Just try to restart your HA in 24h, very often it will get reported again. I have never found the reason but I assume that sometimes the API does not deliver the value. Same for starterbatterystate…

1 Like

I noticed today that the integrated stopped working 2 days ago. I did an update of the component and tried to authenticate again with the latest version but I’m stuck with these errors. Anything I’m missing ?

Authentication failed. Please reauthenticate.
3:06:08 PM – (ERROR) MercedesME 2020 (custom integration)
Refresh Token is missing - reauth required
3:06:08 PM – (WARNING) MercedesME 2020 (custom integration)
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’)
3:06:08 PM – (ERROR) MercedesME 2020 (custom integration)

New Install…

Last night I installed the Integration… happy so far except it only shows 3 entitles. Is there a trick to get more ?

Regards,
Richard

b

Did you try restarting HA? You should get most of the features available in the MM app as entities and attributes.

Thanks…

Restarted HA … and then rebooted the server to the same result…

From the debug log…

2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.websocket] Got notification: vepUpdates
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] Start _process_vep_updates
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] Full Update. XXXXXXXXXXXXXXXXX
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Odometer for XXXXXXXXXXXXXXXXX called
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values XXXXXXXXXXXXXXXXX has incomplete update set - attributes not found
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Tires for XXXXXXXXXXXXXXXXX called
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values XXXXXXXXXXXXXXXXX has incomplete update set - attributes not found
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Doors for XXXXXXXXXXXXXXXXX called
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values XXXXXXXXXXXXXXXXX has incomplete update set - attributes not found
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Location for XXXXXXXXXXXXXXXXX called
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values XXXXXXXXXXXXXXXXX has incomplete update set - attributes not found
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Binary_Sensors for XXXXXXXXXXXXXXXXX called
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values XXXXXXXXXXXXXXXXX has incomplete update set - attributes not found
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Windows for XXXXXXXXXXXXXXXXX called
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values XXXXXXXXXXXXXXXXX has incomplete update set - attributes not found
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Electric for XXXXXXXXXXXXXXXXX called
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values XXXXXXXXXXXXXXXXX has incomplete update set - attributes not found
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values Auxheat for XXXXXXXXXXXXXXXXX called
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] get_car_values XXXXXXXXXXXXXXXXX has incomplete update set - attributes not found
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] _process_vep_updates - XXXXXXXXXXXXXXXXX - complete: True - Counter({'f': 1, 'p': 0})
2021-12-11 10:43:22 DEBUG (MainThread) [custom_components.mbapi2020.client] vepUpdates Sequence: 0

@ReneNulschDE Pretty much - and this is helping overcome the weird situation the UK is in - sometimes imperial, but mostly metric, but sometimes not so much. :man_facepalming:

HA is showing temperature for me in Degres C, but we drive using miles. So it’d be great if whatever the units of measurement that come back from the Merc API show up as the default. :slight_smile:

Appreciate I’m being fussy - and trying to overcome something stupid, but I assume I’m not the only one (Fellow UK residents? Canadians??)

I use a Template to convert… BMW has the same thing…

template:
   sensors:      
     miles_to_empty_320i:
       friendly_name: 'Miles to Empty'
       value_template: '{{ (( states.sensor["320i_remaining_range_fuel"].state | float * 0.621371)) | round(2) }}'
       unit_of_measurement: 'm'
       icon_template: mdi:map-marker-distance   

Hi @TGILLY ,

please make sure that you run the latest code. min version 0.5.14.

In case of problems in the reauth-process, please do the follwoing:

  • Delete the component on the the integration page
  • Delete the file .mercedesme-token-cache in your HA-config folder
  • Restart HA
  • Add the integration again

Sorry, but MB changed the handling of the refresh token…

1 Like

Hi @RichardPar ,

Could you give us some more insights about your car? (Region, Year) Does it work in the MB-App? The Firmware says “NoStar” - never have seen this before. Do you use the Mercedes Me Bluetooth Adapter in your car?

Thanks Rene, tried it but it did not help unfortunately. Not sure where this came from. Will have to check further if nothing else is blocking it as I do not see it writing the .mercedesme-token-cache file any more

Thanks for the hint… turns out the Adapter is faulty :frowning: that removes one car until that is fixed. Next is my EQC - that has alot of data, but seems mismatched between Miles and KM

For my other car… EQC. I cant get the Aux or Pre-heater to work. Another quirk is that the Miles values are listed in KM (although its really miles)

What is needed to debug the pre-heater ?