Skip to main content

a library for controlling certain robot vacuums

Project description

Tests PyPI version PyPI - Python Version

py-sucks

This is the successor of https://github.com/wpietri/sucks.

Overview

A simple command-line python script to drive a robot vacuum. Currently known to work with the Ecovacs Deebot N79, M80 Pro, M81, M88 Pro, and R95 MKII from both North America and Europe.

Does it work for your model as well? Join the discussion on the sucks-users mailing list.

If you're curious about the protocol, I have a rough doc started. I'll happily accept pull requests for it.

Why the project name? Well, a) it's ridiculous that I needed to MITM my own vacuum. This is not the future I signed up for. And b), it's a vacuum.

Installation

If you have a recent version of Python 3, you should be able to do pip install py-sucks to get the most recently released version of this.

Usage

To get started, you'll need to have already set up an EcoVacs account using your smartphone.

With that ready, step one is to log in:

% sucks login
Ecovacs app email: [your email]
Ecovacs app password: [your password]
your two-letter country code: us
your two-letter continent code: na
Config saved.

That creates a config file in a platform-appropriate place. The password is hashed before saving, so it's reasonably safe. (If it doesn't appear to work for your continent, try "ww", their world-wide catchall.)

With that set up, you could have it clean in auto mode for 10 minutes and return to its charger:

% sucks clean 10

You could have it clean for 15 minutes and then do an extra 10 minutes of edging:

% sucks clean 15 edge 10

If you wanted it to clean for 5 minutes and then stop without charging:

% sucks clean 5 stop

If it's running amok and you'd just like it to stop where it is:

% sucks stop

To tell it to go plug in:

% sucks charge

I run mine from my crontab, but I didn't want it to clean every day, so it also has a mode where it randomly decides to run or not based on a frequency you give it. My crontab entry looks like this:

0 10 * * * /home/william/projects/sucks/sucks.sh clean -f 4/7 15 edge -f 1/14 10

This means that every day at 10 am, it might do something. 4 days out of 7, it will do 15 minutes of automatic cleaning. 1 day out of 14, it will do 10 minutes of edging. And afterward it will always go back to charge.

Library use

You are welcome to try using this as a python library for other efforts. The API is still experimental, so expect changes. Please join the mailing list to participate in shaping the API.

A simple usage might go something like this:

import sucks

config = ...

api = EcoVacsAPI(config['device_id'], config['email'], config['password_hash'],
                         config['country'], config['continent'])
my_vac = api.devices()[0]
vacbot = VacBot(api.uid, api.REALM, api.resource, api.user_access_token, my_vac, config['continent'])
vacbot.connect_and_wait_until_ready()

vacbot.run(Clean())  # start cleaning
time.sleep(900)      # clean for 15 minutes
vacbot.run(Charge()) # return to the charger

Developing

If you'd like to join in on developing, I recommend checking out the code, setting up a virtual environment, and installing this package in editable mode. You can confirm your environment works by running the tests. And please do join the mailing list to discuss your plans.

For more information see the development documentation.

See also

There are now similar libraries in Javascript and Go.

Thanks

My heartfelt thanks to:

  • xmpppeek, a great library for examining XMPP traffic flows (yes, your vacuum speaks Jabbber!),
  • mitmproxy, a fantastic tool for analyzing HTTPS,
  • click, a wonderfully complete and thoughtful library for making Python command-line interfaces,
  • requests, a polished Python library for HTTP requests,
  • Decompilers online, which was very helpful in figuring out what the Android app was up to,
  • Albert Louw, who was kind enough to post code from his own experiments with his device, and
  • All the users who have given useful feedback and contributed code!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-sucks-0.9.10.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

py_sucks-0.9.10-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file py-sucks-0.9.10.tar.gz.

File metadata

  • Download URL: py-sucks-0.9.10.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for py-sucks-0.9.10.tar.gz
Algorithm Hash digest
SHA256 dc56781013b752b24e57fbbccfa9298ddf7b6e3874c6f9874bb5ad81d9ec3532
MD5 2d5f9d4f9a5da62f9f2c78f54c41cd0d
BLAKE2b-256 924f46ef908bcb562bb85c99aea0850be285efbc482f99f9bc917404b0354f23

See more details on using hashes here.

File details

Details for the file py_sucks-0.9.10-py3-none-any.whl.

File metadata

  • Download URL: py_sucks-0.9.10-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for py_sucks-0.9.10-py3-none-any.whl
Algorithm Hash digest
SHA256 71546674e8f7d040d126b2a9e0667bd77f8c6216bf4c48ed88e31229b285ddd8
MD5 af07bd5e0e792fbe2d6a323e40393da9
BLAKE2b-256 e0e3b6047d527aa0b24a7011bafa36ae249c474778162b07af23c2b2c068344d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page