Mercedes Me Component

Hi @Mobiledude ,

if you do not store the pin in your configuration, then the lock will ask for it. Other options: GitHub - iantrich/restriction-card: 🔒 Apply restrictions to Lovelace cards

BR
Rene

1 Like

Thanks @ReneNulschDE that worked indeed. Happy to see many more people use your integration and even the intial card I created :rofl:

2 Likes

You bet! Thanks again

2 Likes

@ReneNulschDE I have a small problem with the setup in my car. When it looses sync (which has happened a few times more than it really should, maybe because the IP address changes frequently when going from the home wifi to the car’s 4G modem?) I can’t request a PIN from that because the OpenWRT firewall has blocked the call, it seems. So is there another address I need to whitelist in addition to the others you gave me futher up? These:

https://id.mercedes-benz.com
https://bff-prod.risingstars.daimler.com
wss://websocket-prod.risingstars.daimler.com/ws
https://rcp-rs.query.api.dvb.corpinter.net
https://psag.query.api.dvb.corpinter.net

Hi @Mastiff,

sorry, I dont get this - why do you have to request a PIN so often? I have not requested a PIN for my PRD environment since 4 months?

Your URL list is complete.

BR
Rene

This is the log when it happens:

2022-04-05 04:03:10 ERROR (MainThread) [custom_components.mbapi2020.oauth] Error requesting data from https://id.mercedes-benz.com/as/token.oauth2: Cannot connect to host id.mercedes-benz.com:443 ssl:default [Connect call failed (‘141.113.50.67’, 443)]
2022-04-05 04:03:10 ERROR (MainThread) [custom_components.mbapi2020] Authentication failed. Please reauthenticate.

My best guess is that it is offline too long. I park at my cabin at times, and cell reception there is rather lousy. Does it need to sync with a certain interval to avoid reauthentication?

To be clear: the integration doesn’t connect to your car directly, it connects to a fixed number of cloud servers of Mercedes (id.mercedes-benz.com in this case, to authenticate against). And according to the error message you get, that connection is failing, it simply cannot connect.

It sounds like a local networking issue.

@robertklep I am fully aware of that. The system is IN the car. With

going from the home wifi to the car’s 4G modem

I mean that the Pi in the car (further up in the thread the system is explained a bit better) has a separate Pi running OpenWRT and connecting to the home wifi when it’s parked at home and to 4G with a Huawei USB modem when it’s not at home. The car can’t connect to wifi. So when parked at the cabin, if the component has to connect to the server and can’t at a set time it will assume that sync is lost, I believe. How often does it need to connect for this? And can it be set up to try again x number of hours later instead of assuming that sync is lost?

Hi @Mastiff, @robertklep ,

I had added some code to try to reconnect in the past and looks like this code is not good enough. I’m checking for clienterrors and I have to extend this to this error type too.

let me check or feel free to prepare a PR.

BR
Rene

Thanks, that sounds great! I’ll put it right into the car system when you have something ready. And I apologize for my ignorance, but I have no idea what a PR is…

Apologies, I misunderstood the situation :woozy_face:

No worries. :grin: I considered writing an answer to you that was a bit more sarcastic, but decided you couldn’t be expected to have read my message higher up in the thread about how I was building this to get a keyless entry system in the car.

1 Like

Energy Dashboard Integration is one the more often asked questions that I get here, on Github or via private messages. Currently, the MB-API has no valid sensor to integrate directly into the energy management of HA.

Let me explain how I tried to solve it with standard HA functionality and the changes to the charging_power sensor integrated in v0.6.5. The charging_power sensor reports the values in kW now.

However we need the values in kWh to use it in the energy dashboard. There is a standard sensor in HA that calculates the “Riemann sum”.

Configuration.yaml:

sensor:
  - platform: integration
    source: sensor.XXXX_charging_power

This will create a new sensor “sensor.sensor_XXXX_charging_power_integral’” and the value is in kWh.

Means you can use this sensor then in your energy dashboard.

Let me know your opinion if this fits to your needs.

I have published a new version 0.6.6.

  • In case the MBAPI is not reachable on HA-start, the component will now retry to load in the background (reported in HA-Community)

Thanks to @Mastiff for reporting and testing the release in the last 14 days.

This is just a bugfix release, so still no option to change the interior lightning… (but yes, may car interior lights are changing already based on unread emails - I hate this feature :slight_smile: )

1 Like

Glad to help, and honestly I think I’m probably the only one, or at least one of the few that would ever have this problem. So thank you! :+1:

Is there a way to detect if a key is in or near the car? Or isn’t that the integration can find?

Hi @Mastiff , this is AFAIK not possible.

OK, thanks. It was worth a shot. It would make it easier with my ESPresense setup just to set it not to lock the car when a key was in it or near it.

Hi guys,

First of all, thanks @ReneNulschDE for creating, maintaining and making this integration evolves.
I’ve quite new to HA, yet I managed to have your Mercedes Me Component working properly, and it rocks.

I just can’t figure what the AuxHeat switch is supposed to do. When I’m trying to switch it on, it just get back to off after a few seconds.

Just to give some insights, I have a CLA Shooting Brake 250e, so, compatible with preheat (I’m actually doing it with the Mercedes Me App on iOS).
Log viewer is giving me this (I’ve anonymized the chassis number) :

2022-04-22 15:50:22 WARNING (MainThread) [custom_components.mbapi2020.client] Car action: AUXHEATSTART failed. error_code: RIS_COMMAND_UNAVAILABLE, error_message: Command is not supported in this vehicle

Any clue ?
Thanks a lot :slight_smile:

Got some issues with this wonderful integration today.

Any ideas?

This error originated from a custom integration.

Logger: custom_components.mbapi2020.oauth
Source: custom_components/mbapi2020/oauth.py:243
Integration: MercedesME 2020 (documentation, issues)
First occurred: 16:36:43 (4 occurrences)
Last logged: 16:37:26

ClientError 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')