Git Product home page Git Product logo

Comments (3)

wpietri avatar wpietri commented on September 12, 2024

Excellent questions all. I don't have more than one vacuum, so I have no strong opinions here. Since the API isn't documented, I also can't really code anything related to this.

But I'd encourage you to take a swing at it if you like, as it seems like a great case to cover. If you'd like to discuss approaches, I suggest joining the mailing list: https://groups.google.com/forum/#!forum/sucks-users

Then you can get feedback from all contributors.

from sucks.

ohkeepa avatar ohkeepa commented on September 12, 2024

I have 2 devices, and modify cli.py like this to get them both going at the same time:

    if actions:
        config = read_config()
        api = EcoVacsAPI(config['device_id'], config['email'], config['password_hash'],
                         config['country'], config['continent'])
        vacuum = api.devices()[0]
        vacbot0 = VacBot(api.uid, api.REALM, api.resource, api.user_access_token, vacuum, config['continent'])
        vacbot0.connect_and_wait_until_ready()

        vacuum = api.devices()[1]
        vacbot1 = VacBot(api.uid, api.REALM, api.resource, api.user_access_token, vacuum, config['continent'])
        vacbot1.connect_and_wait_until_ready()

        for action in actions:
            click.echo("performing " + str(action.vac_command))
            vacbot0.run(action.vac_command)
            vacbot1.run(action.vac_command)
            action.wait.wait(vacbot0)

        vacbot0.disconnect(wait=True)
        vacbot1.disconnect(wait=True)

from sucks.

tucknology avatar tucknology commented on September 12, 2024

I finally got around to solving this for my particular use case this weekend, and I thought I'd share the result. I made my own script which builds on the excellent API. Here it is, feel free to use or modify.

Some notes on what I've done. Generally, I want all my vacuums to run all at once when I leave the house. So this script iterates through all my vacuums and runs each one. I have a similar script to charge them.

I use a try block because occasionally one of my vacuums is unreachable (due to bad wifi, dead battery, solar flares...) and I want to make sure it doesn't prevent the other, reachable vacuums from running.

from sucks import *
import configparser
import itertools
import os

def config_file():
  return '/home/pi/tuckvac/sucks/sucks.conf'

def read_config():
  parser = configparser.ConfigParser()
  with open(config_file()) as fp:
      parser.read_file(itertools.chain(['[global]'], fp), source=config_file())
  return parser['global']

def main():
  config = read_config()
  api = EcoVacsAPI(config['device_id'], config['email'], config['password_hash'],
                    config['country'], config['continent'])

  uid = api.uid
  realm = api.REALM
  res = api.resource
  uat = api.user_access_token
  devs = api.devices()

  for dev in devs:
    try:
      vacbot = VacBot(uid, realm, res, uat, dev, config['continent'])
      vacbot.connect_and_wait_until_ready()
      vacbot.run(Clean())
      vacbot.disconnect(wait=True)
    except Exception:
      pass

if __name__ == '__main__':
  main()

from sucks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.