Mercedes Me Component

'Hi, I am really rookie with HA. I set up the card created by Manuel. Everything worked fine. Now I tried o integrate the Mercedesmeapi into my config and I got the message integration not found. Attached my config. I logged out and again in to the Mercedes Me app, tried to set the password/user in the API with secret (as shown in green shot) and gave in the password and user directly. Always the same problem. It would be great if someone has an idea what I can do. Thanks Peter
</>55 !
16

Hello everyone,
I’m new to HA and I’m trying to activate your plugin but I can not. I managed to activate these plugins but this one is a problem!

My HA runs on RPi3 B + with the Hassbian and python 3. My HA tells me he can not activate the plug-in because he encounters an error. I’ve corrected config file :

mercedesmeapi:
  username: !secret mb_username
  password: !secret mb_password
  pin: !secret mb_pin
  country_code: CH               # two digts country code
  accept_lang: ch_FR             # four digits country code
  #save_car_details: true         # save a json to the HA config directory with the features and states, please use this for debug only 
 #attributes: doorStateFrontLeft, doorStateFrontRight, doorStateRearLeft, doorStateRearRight, frontLeftDoorLocked, frontRightDoorLocked, rearLeftDoorLocked, rearRightDoorLocked, frontLeftDoorClosed, frontRightDoorClosed, rearLeftDoorClosed, rearRightDoorClosed, rearRightDoorClosed, doorsClosed, trunkStateRollup, sunroofstatus

When I look in the log file, here are the errors:

2019-09-03 21:04:18 ERROR (MainThread) [homeassistant.setup] Error during setup of component mercedesmeapi
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/setup.py", line 172, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/mercedesmeapi/__init__.py", line 215, in setup
    from custom_components.mercedesmeapi.oauth import MercedesMeOAuth
  File "/home/homeassistant/.homeassistant/custom_components/mercedesmeapi/oauth.py", line 16, in <module>
    import lxml.html
ModuleNotFoundError: No module named 'lxml'

So I noticed that there is a problem with the library lxml. so I installed it but it still does not work!

when I do

pip freeze

i get this:

asn1crypto==0.24.0
backports.functools-lru-cache==1.5
beautifulsoup4==4.7.1
chardet==3.0.4
configparser==3.5.0b2
cryptography==2.6.1
entrypoints==0.3
enum34==1.1.6
html5lib==1.0.1
ipaddress==1.0.17
keyring==17.1.1
keyrings.alt==3.1.1
lxml==4.3.2
pycrypto==2.6.1
PyGObject==3.30.4
pyxdg==0.25
RPi.GPIO==0.7.0
SecretStorage==2.3.1
six==1.12.0
soupsieve==1.8
webencodings==0.5.1

I think my python installation is ok but I do not know why the plugin does not load!

Can someone help me make it work?
Also, as a new user, I confronted some config problems. If someone has a complete and detailed installation manual, I’m interested.
Also, I do not know if you have to activate paid options on the sdk portal of mercedes me for the plugin to work?

Hi,

do you have installed HA in a virtual environment? If yes, please check that lxml is available in this env too.

# goto HA directory
source bin/activate
pip3 install lxml

The component need lxml and requests. (requests comes with HA)

Is it possible to add this component into HACS addon store? It would make for easy updates. :slight_smile:

Ive maked this:

source bin/activate
pip3 install lxml --user homeassistant

but still not work with the same issue!
the command return to me already satsfied and installed parckage lxml-4.4.1 and still not working!

After that, ive manually copied

/usr/lib/python3/dist-packages/lxml

folder to

/srv/homeassistant/lid/python3.7/site-packages/

and ive changed ownerchip to

homeassistant:homeassistant

. Then ive reboot service HA and now it’s working! thank for your job and helping

Sorry for asking but do you know when you have time to implement this? This would make my setup complete :-).

Thanks!

Hi @HypnoToad,

I’ve reorganized the github structure to enable HACS. If you would like to test it, please add a custom repository in HACS settings. Add “ReneNulschDE/mbapipy” and select “Integration”.

I hope it works…

BR
Rene

1 Like

hi @plantoschka,

I have added the batteryState as attribute to the Odometer. However, I’m not sure if this makes sense.

It is available only for few car types. Based on description that I have found, it could have 3 states 0=green, 1=yellow, 2=red… what ever that means

Thanks very much, when I’m home I’ll give it a try and see if it works. :slight_smile:

Hi Rene,

If I add this via HACS now will I need to redo all my sensors? I have templated a load and not sure I want to go through all that again :slight_smile:

Thanks

mb

Hi, no, it is for Auto Update only. BR rene

1 Like

Perfect, thanks :slight_smile:

Hello all, I’m fairly new to hassio myself and was looking over this forum as I would be interested in adding my car to my setup but from what I’ve read it seems like this is only available in Europe? anyone know if this would work in Canada? our app seems too more like the European app and not like the US app which is very different so I was wondering if the setup might be similar for us. Thanks in advance.

Hi @MAUL0rxB,

did you tried it :slight_smile:? Based on the app it could work. However I have no access to an canadian car. If you would like to change this send me a private message.

BR
Rene

Just updated and don’t see a batteryState in my Odometer:

In the Mercedes Me app I see a battery state.

I’m trying to read through the forums on how to install a custom addon so I can give it a try.

Hi, copy the folder “custom_components” out of the repo into your HA config directory. After that create the config entries in your configuration.yaml. See repo page for some examples. Please make sure that you have used the MB-App (Android or IOS) in the last weeks. BR Rene

Hi @plantoschka,

could you enable the save_car_details: true setting and send me the files as a private message? I will take a look.

I have access to 3 different cars and only one car shows the battery option.

BR
Rene

1 Like

I get this when installing and configuring the component (through HACS on a Hassi.io install):

2019-11-19 14:22:24 ERROR (MainThread) [homeassistant.setup] Error during setup of component mercedesmeapi
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 176, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/mercedesmeapi/__init__.py", line 271, in setup
    token_info = auth_handler.request_initial_token()
  File "/config/custom_components/mercedesmeapi/oauth.py", line 217, in request_initial_token
    for x in step_3_elements}
  File "/config/custom_components/mercedesmeapi/oauth.py", line 217, in <dictcomp>
    for x in step_3_elements}
  File "src/lxml/etree.pyx", line 2466, in lxml.etree._Attrib.__getitem__
KeyError: 'value'

Got this working today on my new car. Thanks a million for all the effort.

I’ve now got the binary sensor for door lock status feeding Node red. If I get home (Wifi presence detection) and my and car is still unlocked after 5 mins, I get a message through telegram to remind me.

Should stop my neighbours knocking on the door to tell me I’ve left the boot open!

Eager to hear of other automations!

1 Like