bdwilson / ecovacs-api

Ecovacs Robotic Vacuum API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ecovacs Robotic Vacuum API

This flask API uses the sucks python library and is loosely based off of ecovacs-aws.

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.

Installation (manual)

  1. Install sucks and flask python modules
# pip3 install sucks
# pip3 install flask
  1. Change the login/password/country/continent/service port variables in the ecovacs_flask.py. My port in the example is 5050.
  2. Change directory in the .service file to match where your ecovacs_flask.py file is.
  3. Copy service file to /lib/systemd/system/ then enable it.
# systemctl daemon-reload
# systemctl enable ecovacs-api.service
# systemctl start ecovacs-api.service

Installation (Docker)

  1. Grab the Dockerfile via wget and put it in a directory on your Docker server. Then run the commands below from that directory
  2. # docker build -t ecovacs-api --build-arg ECOVACS_USER='your@email.address' --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 sucks login
  3. 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)
  4. That's it. If you need to troubleshoot your docker image, you can get into it via: # docker exec -it ecovacs-api /bin/bash or # docker run -it ecovacs-api /bin/bash and then poke around and run the commands below in the troubleshooting section "sucks".

Usage

# curl -s http://yourip:5050/api/clean/0 
# curl -s http://yourip:5050/api/charge/0 
# curl -s http://yourip:5050/api/playsound/0 

Hubitat

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.

Troubleshooting

  1. 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.
  2. You should make sure sucks works before configuring this script.
# sucks login
# sucks --debug stop
  1. You can always enable debug in the ecovacs_flask.py script and run it from the commandline.

Bugs/Contact Info

Bug me on Twitter at @brianwilson or email me here.

About

Ecovacs Robotic Vacuum API


Languages

Language:Python 74.3%Language:Dockerfile 25.7%