My attempt at monitor and control Ecovacs Deebot vacuum cleaners from OpenHAB, via MQTT.
At the core, the great sucks library by @wpietri.
- Follow the instructions at https://github.com/wpietri/sucks, basically:
pip install sucks
-
Run
sucks login
, in order to generate the necesarysucks.conf
config file. -
PLEASE TEST that you can run sucks correctly. Play with
sucks clean 1
,sucks stop
.
Only continue if you are sure that sucks
it's running fine. If not please go to the great sucks community and ask for help.
- Install dependencies
pip install paho-mqtt
- If and only if (3) it's ok: Clone this repo and run
ecovacs-mqtt-gateway.py
Run it with python3.
It should remain running in the background, for that, I recommend Supervisor
There is a provided supervisord ecovacs.ini example.
I'm using sucks library to connect to the Ecovacs system and monitor for status and activity. At startup and whenever a status change is detected, it publishes the values to the mqtt broker Eclipse Mosquitto. It also listen for mqtt control messages to send commands to the vacuum cleaners.
I use MQTT for all my IoT/Sensors communications to OpenHAB and strongly recommend everybody to do so.
MQTT it's standard, lightewight, easy to deploy, easy to monitor from any device, and gives the possibility of isolate devices from the home automation controller with a simple standard layer of abstraction.
If you are an OpenHAB user, you can use the provided ecovacs.things, ecovacs.items and ecovacs.sitemap to show the status of your robots and/or control them.
If you are not an OpenHAB user, no matter how wrong you are, you can monitor and command via mqtt topics using your preferred software.
This gateway, when running, will listen from sucks events and update the following mqtt topics:
ecovacs/{did}/battery_level
ecovacs/{did}/battery_status
ecovacs/{did}/clean_status
ecovacs/{did}/vacuum_status
ecovacs/{did}/fan_speed
ecovacs/{did}/components/main_brush
ecovacs/{did}/components/side_brush
ecovacs/{did}/components/filter
{did}
its the Device Id. It's something like E0000626317798704736. You can get it by running ecovacs-mqtt-gateway.py
and it will show on the first line. Or you can also get it running sucks --debug stop
, and it will be in a line like this:
sucks DEBUG got {'todo': 'result', 'result': 'ok', 'devices': [{
'did': 'E0000693437743404736'
, 'name ...
ecovacs/E0345693817701104736/battery_level
Keep in mind that this is simply a convention by me. This will be useful if in the future I decide to support more than one robot. If you understand this you can use anything you want in {did}, even something more human friendly like /my_vacuum_cleaner/
So from this on, you can use your usual mqtt consuming software to keep yourself posted of the Ecovacs whereabouts.
I use and recommend OpenHAB.
To control the vacuum cleaner via mqtt you have to publish 0 for auto
, 2 for charge
, 1 for stop
or 3 for playsound
message to the following topic:
ecovacs/{did}/command
I recommmend MQTT.fx to monitor mqtt activity and do the troubleshooting.
- Move some harcoded config (mqtt base topic, server, port) to some config file.
- Error handling. Stuck here because sucks library it's giving me errors when I force errors. At least the most usual, like stuck robot. Is there a warning when it runs out of batteries returning?
- Test for stability on the mqtt connection. Reconnect if necessary.
- Test for stability in general. Monitor memory usage.
- (mine) Apply some logic with presence and automate ecovacs run daily.
- Adhere to Homie convention
Add control buttons on OpenHAB sitemap.Done!Adapt to new OpenHAB 2.4 MQTT binding
Feel free to send push requests or drop me a line at: gschimmel at gmail dot com.