Ecovacs Robotic Vacuum API
If you're into MQTT, you might want to use openhab-sucks instead.
I am not a Python programmer; this is really bad code. Please fix it. There is no authentication because the expectation is that you're running this on your internal, trusted home network. You've been warned.
If you know how to get the status information without being able to subscribe to the events, please fix this. It gets the job done for my needs by starting cleaning when someone leaves the house via API call from Hubitat, then sends it home when someone returns.
- Install sucks and flask python modules
# pip3 install sucks # pip3 install flask
- Change the login/password/country/continent/service port variables in the ecovacs_flask.py. My port in the example is 5050.
- Change directory in the .service file to match where your ecovacs_flask.py file is.
- Copy service file to /lib/systemd/system/ then enable it.
# systemctl daemon-reload # systemctl enable ecovacs-api.service # systemctl start ecovacs-api.service
- Grab the Dockerfile via wget and put it in a directory on your Docker server. Then run the commands below from that directory
# docker build -t ecovacs-api --build-arg ECOVACS_USERemail@example.com' --build-arg ECOVACS_PASS='your_password' .Don't forget the dot at the end! CTRL-C out of it when it's complete Optional arguments are ECOVACS_COUNTRY, ECOVACS_CONTINENT, ECOVACS_PORT. You will need to use your email and password that you use with the evovacs app already. These will default to us, na, and 5050. If you're not in the US, you can leave them then connect in via step 3 and determine the correct variables via
- Run your newly created image:
# docker run -p 5050:5050 --name ecovacs-api -t ecovacs-api(if you changed the port when you built your image, you should also change it here)
- That's it. If you need to troubleshoot your docker image, you can get into
# docker exec -it ecovacs-api /bin/bashor
# docker run -it ecovacs-api /bin/bashand then poke around and run the commands below in the troubleshooting section "sucks".
# curl -s http://yourip:5050/api/clean/0 # curl -s http://yourip:5050/api/charge/0 # curl -s http://yourip:5050/api/playsound/0
Use the http get switch to have an on/off switch using the above commands. You use the urls above but without the "curl -s". You may also use Rule Machine to make HTTP calls. You can also link these to Amazon Alexa so you can have the N79S features on the N79.
- If you have multiple vacuums, you may need to change the number above in the usage to 1, or 2 if you have 3 vacuums on your account.
- You should make sure sucks works before configuring this script.
# sucks login # sucks --debug stop
- You can always enable debug in the ecovacs_flask.py script and run it from the commandline.