I will answer the last post first, as this is the shortest of the two.
I do not own a Mercedes, so I cannot test this car. What I see on github (
https://github.com/alfonsojimenez/mercedes) that someone developed an API in order to communicate with the car. The response is similar to what the Volvo API does.
E.g. Home Assistant had integrated a mercedesme component. See
https://www.home-assistant.io/components/mercedesme.
However from their website:
The component was removed. The vendor disabled the API endpoint and a new API is not available currently.
So there is not much I can do for you. I advise you, as you are a Mercedes owner, to monitor if at some stage a new API will come available.
Then it might be possible to use it in combination with Domoticz or any other Home Automation system.
As I own a Volvo I decided to use a python script, developed by molobrakos, and also used by Home Assistant and OpenHab.
My idea was, as it works there it should be possible to make it work with Domoticz as well.
First you should know my current set-up of Domoticz.
My production Rasperry Pi is a RPi2 and I leave this Pi as much as possible untouched. All my tests are carried out on a RPi1, before I transfer a script or plug-in to my production pi. This Pi1 runs as a slave domoticz device of the Pi2 (master).
On this Pi1 I have also installed Mosquitto MQTT broker, NodeJS and Node-Red.
In order not to break the Pi1 and Pi2 I decided to install the Volvo on Call python script on another pi (RPi3+)
I assume that it is possible to install the Mosquitto broker, NodeJS, Node-Red and the VoC script together with Domoticz on the same Rpi.
The first requirement is that you have a valid subscription to the VoC service.
If so, then it's time to go.
I assume that you have installed the latest Raspbian Stretch and upgraded all the packages.
Also a static (fixed) IP address is recommended. I assume also that you use ssh access.
1. Install Mosquitto MQTT broker.
There are many guidelines on the Internet available.
E.g. See:
https://appcodelabs.com/introduction-to ... spberry-pi
Test your MQTT broker, so that you know that it is working properly. Install also mosquitto-clients.
A tool, I use, on the desktop is MQTTfx. (See
https://mqttfx.jensd.de/) But there are many others.
Test that you can connect with your tool to the Mosquitto broker. Default port is 1883.
Do not forget to secure your broker with at least username/password.
2. Install in Domoticz the MQTT Client Gateway with LAN interface and fill in the required fields
See:
- MQTT Domoticz.png (134.46 KiB) Viewed 8208 times
Check that you can communicate between Domoticz and the MQTT Broker.
Subscribe with any client to domoticz/out and you will see various messages passing.
3. As the VoC script requires Python 3.6 or higher we have to update python.
Follow the guideline:
https://www.scivision.dev/compile-insta ... pberry-pi/
OR
https://gist.github.com/SeppPenner/6a5a ... 524417761d
Verify always: python -V
Yesterday, March 25, the latest version of python 3.7.3. has been published.
Adapt your version numbers accordingly.
4. Install the VoC python script from molobrakos in any folder you like, preferably your home directory (/home/pi) .
It's recommended that this folder is added to your path.
git clone
https://github.com/molobrakos/volvooncall
Insert your credentials, like username (emailaddress) and password into: .voc.conf
These are equal to the one you use in your app.
Configuration file in $HOME/.voc.conf:
username: <username>
password: <password>
Now it is time to test.
Give the following command:
pi@rpi3plus:~ $ voc --help
You will get:
Retrieve information from VOC
Usage:
voc (-h | --help)
voc --version
voc [-v|-vv] [options] list
voc [-v|-vv] [options] status
voc [-v|-vv] [options] trips [(--pretty|--json|--csv)]
voc [-v|-vv] [options] owntracks
voc [-v|-vv] [options] print [<attribute>]
voc [-v|-vv] [options] (lock | unlock)
voc [-v|-vv] [options] heater (start | stop)
voc [-v|-vv] [options] engine (start | stop)
voc [-v|-vv] [options] honk_and_blink
voc [-v|-vv] [options] call <method>
voc [-v|-vv] [options] mqtt
voc [-v|-vv] [options] dashboard
Options:
-u <username> VOC username
-p <password> VOC password
-r <region> VOC region (na, cn, etc.)
-s <url> VOC service URL
-i <vin> Vehicle VIN or registration number
-g Geolocate position
--owntracks_key=<key> Owntracks encryption password
-I <interval> Polling interval (seconds) [default: 300]
-h --help Show this message
--immutable Read only mode
-v,-vv Increase verbosity
-d More debugging
--scandinavian_miles Report using Scandinavian miles instead of km ISO unit
--utc Print timestamps in UTC (+00:00) instead of local time
--version Show version
So if this works your fine.
Test further with voc dashboard and you will find a lot of information of your car.
To see everything that might be supported for your car issue the command voc print.
Steps 1 and 2 might not be be necessary if you are able to write a script in e.g. Lua or dzVents and to read the values directly from voc and use them in Domoticz (if everything is running on the same Pi).
However in my case the voc script and Domoticz (production) run on different RPi's.
So I publish all the topics with voc mqtt to my Mosquitto MQTT broker on another pi.
If you want to do that you have to add the following line to .voc.conf:
mqtt_url: mqtt://<username of mqtt broker>:<password of mqtt broker>@192.168.xxx.yyy:1883
(if you use the default port and without<>)
Check with your client, that voc mqtt publishes all sensors under the following topic: volvo/abc123/#
abc123 is your number plate.
On this pi I have installed NodeJS and Node-RED according to this guide:
NodeJS:
https://www.instructables.com/id/Instal ... spberry-Pi
Node-RED:
https://nodered.org/docs/getting-started/installation
If this all works you can start to read all the published topics into node red and to convert the messages and to re- publish them again to domoticz/in.
Create the necessary virtual switches and sensors in Domoticz. Note down their idx. If you want all, you need approx 30-35 sensors/switches.
I hope this guide helps you with the first steps.
In the process you will come across various problems/questions/ideas.
Do not hesitate to ask.