mabye there is a problem with the file permission?
try tu run the mb-connect.py with the same user as openhab in the putty terminal and check the result.
Yes this works without problems…
Since my script works for you, the problem seems to be more with the configuration of the Exec binding.
If you still have the error message with the whitlist,
you should look for the error at this point.
Maybe read again the description of exec binding, which I have already listed.
Edit the whitelist-file:
nano /etc/openhab/misc/exec.whitelist
Add this line:
python /etc/openhab/scripts/mb-connect/mb-connect.py --data
Restart OH
This should solve the error (except you put the script somewhere else or reference python directly.
No i give it up The automatic execution does not work on my system. I have now tried for several days to have the script run automatically. Manually it works without problems just so it is of no use to me. Thanks for the answers…
Hi Chris,
absolutely great to hear that you managed connecting to your MB. Here is another idea what to do with it:
display your daily CO2 footprint fully automated. it just needs to know the fuel level in your tank and the mileage. As my Mercedes is a bit too old for online connection, I had to use a OBD II and an ESP - not needed with your solution. Hope some others will pick up your and my idea and get a good feeling of their personal CO2 footprint
Hey @Skynet86 ,
Have you ever checked your linux file permissions?
Maybe that’s where it comes from. Make sure that the mb-connect.py file is executable by the user running openhab.
Hi @spawny0815 ,
first thanks for all the good work.
I followed your instructions. However, when trying to run the script
pip3 install -r requirements.txt
I get the error
Invalid requirement: '<!DOCTYPE html>'
Traceback (most recent call last):
File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/requirements.py", line 93, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl/pyparsing.py", line 1632, in parseString
raise exc
File "/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl/pyparsing.py", line 1622, in parseString
loc, tokens = self._parse( instring, 0 )
File "/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl/pyparsing.py", line 3395, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File "/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl/pyparsing.py", line 3717, in parseImpl
return self.expr._parse( instring, loc, doActions, callPreParse=False )
File "/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl/pyparsing.py", line 3378, in parseImpl
loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
File "/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl/pyparsing.py", line 1383, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/usr/share/python-wheels/pyparsing-2.2.0-py2.py3-none-any.whl/pyparsing.py", line 2689, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected W:(abcd...) (at char 0), (line:1, col:1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_internal/req/constructors.py", line 253, in install_req_from_line
req = Requirement(req)
File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/requirements.py", line 97, in __init__
requirement_string[e.loc : e.loc + 8], e.msg
pip._vendor.packaging.requirements.InvalidRequirement: Parse error at "'<!DOCTYP'": Expected W:(abcd...)
Any help?
Thanks, Thomas
make sure you execute the script in the folder where the file is.
- Example: cd /etc/openhab/scripts/mb-connect/ && pip3 install -r requirements.txt
Thanks for the quick help. This is what I did
openhabian@openhabian:~ $ cd /etc/openhab/scripts/mb-connect/ && pip3 install -r requirements.txt
Invalid requirement: '<!DOCTYPE html>'
Traceback (most recent call last):
File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/requirements.py", line 93, in __init__
req = REQUIREMENT.parseString(requirement_string)
...
are you sure you copied the files to that location? Also, can you try to get to the folder one step after the other just to make sure you are really in the folder… that is what i did.
cd etc
cd openhab
cd scripts
cd mb-connect
once you are in the folder mb-connect, run the command:
pip3 install -r requirements.txt
EDIT:
i am on openhab docker so my files are placed differently: looks like this. with ls i checked if the file requirements.txt is really there before performing the pip3 install:
…which I did several times:
openhabian@openhabian:~ $ cd /etc/openhab/scripts/mb-connect
openhabian@openhabian:/etc/openhab/scripts/mb-connect $ ls
mb-connect.py requirements.txt
openhabian@openhabian:/etc/openhab/scripts/mb-connect $ pip3 install -r requirements.txt
Invalid requirement: '<!DOCTYPE html>'
...
Thanks for your help, will look further into this issue the next days.
Should this be working for a Smart EQ? I am getting a “Response Error” after the “Mercedes Benz API connection successfully established!” message.
Look at the mercedes benz developer site, if it’s in the list of compatible vehicles it should work
Regards Mads
Thanks Mads, I checked the developer site, the smart EQ is not on the list So I emailed the support and that what they said:
Thank you for reaching out to us. Unfortunately, we do not support smart EQs and currently, it is not planned to extend the services to smart EQs. I am sorry we could not help further.
That’s unfortunate for me but hopefully helpful for others to know that Smart EQs are not supported although they work with the Mercedes me account.
Hi I have been trying for a few days to get this working but have errors.
I am using openHABian 2.5.5 (buster), Python 3.7.3
When I try to install requirements.txt I get the error that python_openhab==2.14.1 could not be found.
When I check the python website it shows that the 2.14.1 version is binary only
piwheels - python-openhab
When I install from the GitHub tutorial GitHub - sim0nx/python-openhab: python library for accessing the openHAB REST API
pip install python-openhab
It installs 2.10.2 but not the binary 2.14.1 version.
python-dateutil-2.8.1
python-openhab-2.10.2
requests-2.25.1
The error when I run the script mb-connect.py is
python3 /etc/openhab2/scripts/mb-connect/mb-connect.py --dataTraceback (most recent call last):
File “/etc/openhab2/scripts/mb-connect/mb-connect.py”, line 11, in
from openhab import OpenHAB # GitHub - sim0nx/python-openhab: python library for accessing the openHAB REST API
ModuleNotFoundError: No module named ‘openhab’
How can I install python-openhab-2.14.1?
Thanks
With a fresh set of eyes I updated the python packages and it installed 2.14.1.
sudo apt-get install python3 python3-pip
my first OH3 widget for the Mercedes Benz integration.The widget is expanding on click to show more informations. still experimenting with what to view on the closed widget.
EDIT: i forgot to copy in the YAML code of the widget:
uid: widget_Mercedes_v1
tags: []
props:
parameters:
- description: Label
label: Label
name: propLabel
required: false
type: TEXT
parameterGroups: []
timestamp: May 16, 2021, 1:17:42 PM
component: f7-card
config:
expandable: true
swipeToClose: true
backdrop: true
class:
- card-expandable-animate-width
style:
height: 120px
max-height: 120px
min-height: 120px
min-width: 110px
max-width: 400px
margin: 5px
--f7-theme-color: var(--f7-text-color)
background-color: white
slots:
default:
- component: f7-card-content
config:
style:
width: 100%
slots:
default:
- component: Label
config:
text: My GLC 300e
style:
overflow: hidden
white-space: nowrap
text-overflow: ellipsis
font-size: 16px
font-weight: 600
margin-left: 2px
margin-top: -8px
color: black
- component: oh-button
config:
iconF7: xmark_circle_fill
iconSize: 30px
style:
position: absolute
top: 0
right: 0
padding-top: 10px
padding-bottom: 35px
z-index: 999
class:
- card-opened-fade-in
- cell-close-button
- card-close
- component: f7-block
config:
class:
- no-padding
style:
margin: 0px
height: 200px
slots:
default:
- component: f7-row
config:
style:
height: 18px
white-space: nowrap
flex-wrap: nowrap
text-overflow: ellipsis
slots:
default:
- component: f7-col
slots:
default:
- component: Label
config:
text: =props.propLabel
style:
font-size: 22px
font-weight: 500
text-overflow: ellipsis
overflow: hidden
white-space: nowrap
- component: f7-chip
config:
text: '="Bat: " + items.mbc_data_soc.displayState'
color: "=items.mbc_data_soc.state < '10' ? 'red' : 'green'"
style:
font-size: 10px
- component: f7-chip
config:
text: '="Fuel: " + items.mbc_data_tanklevelpercent.displayState'
color: "=items.mbc_data_tanklevelpercent.state < '20' ? 'red' : 'green'"
style:
font-size: 10px
- component: f7-row
config:
style:
height: 66px
width: 100%
overflow: hidden
slots:
default:
- component: f7-col
config:
style:
flex-wrap: nowrap
align-self: flex-end
slots:
default:
- component: f7-row
config:
class:
- justify-content-flex-start
style:
flex-wrap: nowrap
width: 100%
slots:
default:
- component: f7-icon
config:
f7: battery_100
size: 15px
color: blue
style:
margin-top: 0px
- component: Label
config:
text: '="Bat-Range: " + items.mbc_data_rangeelectric.state'
style:
text-overflow: ellipsis
overflow: hidden
white-space: nowrap
margin-left: 5px
font-size: 10px
font-weight: 500
- component: f7-row
config:
class:
- justify-content-flex-start
style:
margin-top: 5px
flex-wrap: nowrap
slots:
default:
- component: f7-icon
config:
f7: star_circle_fill
size: 15px
color: blue
style:
margin-top: 0px
margin-left: 0px
- component: Label
config:
text: '="Fuel-Range: " + items.mbc_data_rangeliquid.state'
style:
text-overflow: ellipsis
overflow: hidden
white-space: nowrap
margin-left: 5px
font-size: 10px
font-weight: 500
- component: f7-block
config:
class:
- card-prevent-open
- card-content-padding
style:
height: 300px
slots:
default:
- component: oh-image
config:
url: http://192.168.178.90:8080/static/images/mb-glc300e.png
style:
width: 100%
height: 66%
object-fit: cover
- component: oh-list
config:
class:
- padding
slots:
default:
- component: Label
config:
text: =props.Title?props.Title:"other States:"
style:
padding: 7px
border-bottom: 1px solid grey
font-weight: 600
color: gray
margin-top: 10px
- component: f7-list-item
slots:
header:
- component: f7-row
slots:
default:
- component: f7-icon
config:
f7: lock
size: 32px
style:
padding: 5px
- component: Label
config:
text: Lock-Status
style:
margin-top: 10px
footer:
- component: f7-row
slots:
default:
- component: Label
config:
text: =items.mbc_data_doorlockstatusvehicle.displayState
style:
margin-top: 8px
color: gray
- component: f7-list-item
slots:
header:
- component: f7-row
slots:
default:
- component: f7-icon
config:
f7: lock_shield
size: 32px
style:
padding: 5px
- component: Label
config:
text: Latch
style:
margin-top: 10px
footer:
- component: f7-row
slots:
default:
- component: Label
config:
text: =items.mbc_data_decklidstatus.state
style:
margin-top: 8px
color: gray
- component: f7-list-item
slots:
header:
- component: f7-row
slots:
default:
- component: f7-icon
config:
f7: sun_max
size: 32px
style:
padding: 5px
- component: Label
config:
text: Sunroof
style:
margin-top: 10px
footer:
- component: f7-row
slots:
default:
- component: Label
config:
text: =items.mbc_data_sunroofstatus.displayState
style:
margin-top: 8px
- component: f7-list-item
slots:
header:
- component: f7-row
slots:
default:
- component: f7-icon
config:
f7: sum
size: 32px
style:
padding: 5px
- component: Label
config:
text: Total-km
style:
margin-top: 10px
footer:
- component: f7-row
slots:
default:
- component: Label
config:
text: =items.mbc_data_odo.displayState
style:
margin-top: 8px
- component: f7-list-item
slots:
header:
- component: f7-row
slots:
default:
- component: f7-icon
config:
f7: clock
size: 32px
style:
padding: 5px
- component: Label
config:
text: last update
style:
margin-top: 10px
footer:
- component: f7-row
slots:
default:
- component: Label
config:
text: =items.mbc_lastConnectionDateTime.displayState
style:
margin-top: 8px