Mercedes Me Component

Thanks for the pointer. I was able to resolve it. /dev/shm has to be recreated after every boot.

To do so, I run the following commands after booting WSL and before starting HA:

sudo rm -r /dev/shm
sudo mkdir /dev/shm
sudo chmod 777 /dev/shm

I will integrate these commands into a startup script.

1 Like

thanks. Could you share the steps on how to create the startup script? I tried this too but run against the wall “readonly filesystem”…

btw… The master branch of the component has a check for a WSL environment now and when running on WSL I disable the rlock. But not tested in detail… I added the rlock to prevent some race conditions when I get to many updates for one car in parallel.

Not sure why you’re getting the readonly filesystem. I’ll describe my installation in case someone uses a similar setup.

First off, I run homeassistant supervised inside WSL2 using a “genie bottle”. This runs all systemd services which wsl doesn’t support natively. I used this guide.

To autostart the VM with Windows, I added a task in Windows Task Scheduler to run at startup.
This starts the WSL VM, and executes the script detailed below. The command for task scheduler is:
wsl ~/startup.sh

The script runs the bottle, but now to fix this error, it runs the 3 commands discussed above that recreate /dev/shm:

#!/bin/bash

sleep 20
sudo rm -r /dev/shm
sudo mkdir /dev/shm
sudo chmod 777 /dev/shm
sleep 15
genie -s

I also have some USB auto mounting to passthrough deconz and wyzesense in this script, but I kept them out here since they’re out of the scope of this discussion.

1 Like

Hello Rene,

thanks for your post. I think that’s actually the reason why I get a bunch of errors when HASS tries to start the appletv integration. Are there any plans for a fix?

Is there a way to check the current installed version of the integrations in the GUI?

Regards Markus

Release 0.6.5 - Bugfix Release HA2022.04

Breaking Changes:

  • Sensor chargingpower renamed to chargingpowerkw (prevent long time statistic errors after change from kwh to kw)

Bugfixes:

  • EntityCategory fix for HA2022.04
  • deactivate rlock for installation running on WSL2

Hi,

please install the latest version 0.6.5.

Thx
Rene

1 Like

Guys, do you have a smart solution to “lock” the entity that controls the door locks? Is it possitble to secure this with eg a pincode from the frontend? Thanks a lot.

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.