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:
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
Very nice and good looking
Hey @muelli1967 ,
nice widget! Glad to see the whole thing in action.
Would be great if you share your widget code here!
Are there any other solutions or rules created with the Mercedes data? I would be very happy to see it here!
Cheers
Chris
I Chris,
i have edited my post above and pasted the YAML code.
Today I did one simple rule, which is sending me a Telegram if the battery range or the fuel range is below 10%. This is basic stuff I would guess. I will add a rule sending me a Telegram if the windows / rooftop / door-lock is open at a specific time of the day / evening or if it predicts to rain. On the other hand the Mercedes Me app is giving alerts already as well, so I donât want to over-engineer here.
I am not sure if there is more data that can be pulled from the Mercedes API, such as state of the climate automatic. ( e.g. if I program that I want the car heated / cooled at a specific start time of my trip ) it would be great to show in the widget as well.
Jan
Hey, @muelli1967 thanks for your answer and the widget code!
Hey folks, are there any other examples out there?
Hi Chris,
it looks interesting. I would like to test it.
But I fail at points 4 + 5 in the documentation for âSetup openHABâ - âFeed your openHAB items with your Client_ID, Client_Secret, Vehicle IDâ & âset your mbc_spope_* items according to your Mercedes-Benz App subscriptionsâ.
I donât understand this.
Best regards,
igi
Hey igi,
that means you have to put your data from Mercedes-Benz project (created in developer portal) into the items. this works very easy via openhab console.
So for example your mbc_client_id item must contain your MB project client id.
Also you have to set the scopes used for the api.
So if you use e.g. the vehicle fuel stautus API in your mb project, the mbc_scope_fuelstatus must be set to ON.
hope this helps!
Chris
Sorry but I am a beginner.
I have copied the items from your GitHub project. Do I now have to execute the send command 3x for each item? I mean that are 48 items. Do you have a real example - of course without the sensitive data?
The other thing is simply changing the item status from OFF to ON?
no, just for those three:
These are needed to obtain the authentication.
Yes, simply turn the others on.
OK, now I got it
I have run the script âmb-connect.py --dataâ but the information is very minimal and old (timestamp = 2021-04-30). The vehicle should be supported: A250e (W177) 07/2020.
# python3 /etc/openhab/scripts/mb-connect/mb-connect.py --data
-------------------------------------------------------------------
## Starting Mercedes Benz API connection ##
# Mercedes Benz API connection successfully established!
# Searching resources for selected scopes:
# No data available for "rangeliquid".
# No data available for "tanklevelpercent".
# No data available for "soc".
# No data available for "rangeelectric".
# No data available for "readingLampFrontRight".
# No data available for "windowstatusfrontright".
# No data available for "rooftopstatus".
# Update data "windowstatusfrontleft" with value "2" and timestamp "2021-04-30 19:32:43" to openHAB item "mbc_data_windowstatusfrontleft".
# No data available for "sunroofstatus".
# No data available for "doorstatusfrontright".
# Update data "doorstatusfrontleft" with value "CLOSED" and timestamp "2021-04-30 19:33:15" to openHAB item "mbc_data_doorstatusfrontleft".
# No data available for "doorstatusrearright".
# No data available for "interiorLightsFront".
# No data available for "readingLampFrontLeft".
# No data available for "decklidstatus".
# No data available for "windowstatusrearright".
# No data available for "windowstatusrearleft".
# No data available for "lightswitchposition".
# No data available for "doorstatusrearleft".
# No data available for "interiorLightsRear".
# No data available for "doorlockstatusdecklid".
# No data available for "doorlockstatusvehicle".
# No data available for "doorlockstatusgas".
# No data available for "positionHeading".
# No data available for "odo".
# All available data has been sent to openHAB!
# Done in 5.596885919570923 seconds
Hey igi,
the script seems to run well.
Check again on the Mercedes page if the vehicle is really supported, or which scopes. Maybe not everything works there.
Another possibility is that mercedes currently has a small problem. In my logs I see that sometimes no data comes. So try again later.
Hi Chris,
it looks better. A bit later I got more data (but still not all).
# python3 /etc/openhab/scripts/mb-connect/mb-connect.py --data
-------------------------------------------------------------------
## Starting Mercedes Benz API connection ##
# Mercedes Benz API connection successfully established!
# Searching resources for selected scopes:
# Update data "rangeliquid" with value "122" and timestamp "2021-05-17 17:15:40" to openHAB item "mbc_data_rangeliquid".
# Update data "tanklevelpercent" with value "25" without timestamp "2021-05-17 17:07:40" to openHAB item "mbc_data_tanklevelpercent".
# Update data "soc" with value "55" and timestamp "2021-05-17 17:16:39" to openHAB item "mbc_data_soc".
# Update data "rangeelectric" with value "21" and timestamp "2021-05-17 17:15:40" to openHAB item "mbc_data_rangeelectric".
# Update data "readingLampFrontRight" with value "OFF" and timestamp "2021-05-17 17:16:54" to openHAB item "mbc_data_readingLampFrontRight".
# Update data "windowstatusfrontright" with value "2" and timestamp "2021-05-17 17:16:05" to openHAB item "mbc_data_windowstatusfrontright".
# No data available for "rooftopstatus".
# Update data "windowstatusfrontleft" with value "2" and timestamp "2021-05-17 17:16:05" to openHAB item "mbc_data_windowstatusfrontleft".
# No data available for "sunroofstatus".
# Update data "doorstatusfrontright" with value "CLOSED" and timestamp "2021-05-17 16:57:02" to openHAB item "mbc_data_doorstatusfrontright".
# Update data "doorstatusfrontleft" with value "CLOSED" and timestamp "2021-05-17 17:16:45" to openHAB item "mbc_data_doorstatusfrontleft".
# No data available for "doorstatusrearright".
# No data available for "interiorLightsFront".
# Update data "readingLampFrontLeft" with value "OFF" and timestamp "2021-05-17 17:16:54" to openHAB item "mbc_data_readingLampFrontLeft".
# No data available for "decklidstatus".
# No data available for "windowstatusrearright".
# No data available for "windowstatusrearleft".
# No data available for "lightswitchposition".
# Update data "doorstatusrearleft" with value "CLOSED" and timestamp "2021-05-17 17:01:31" to openHAB item "mbc_data_doorstatusrearleft".
# No data available for "interiorLightsRear".
# Update data "doorlockstatusdecklid" with value "OFF" and timestamp "2021-05-17 17:16:46" to openHAB item "mbc_data_doorlockstatusdecklid".
# Update data "doorlockstatusvehicle" with value "2" and timestamp "2021-05-17 17:16:46" to openHAB item "mbc_data_doorlockstatusvehicle".
# Update data "doorlockstatusgas" with value "OFF" and timestamp "2021-05-17 17:16:46" to openHAB item "mbc_data_doorlockstatusgas".
# Update data "positionHeading" with value "336.5" and timestamp "2021-05-17 17:16:37" to openHAB item "mbc_data_positionHeading".
# Update data "odo" with value "7280" and timestamp "2021-05-17 17:15:47" to openHAB item "mbc_data_odo".
# All available data has been sent to openHAB!
# Done in 6.168662071228027 seconds
Igi