Package: pybotvac
pybotvacThis is an unofficial API for controlling Neato Botvac Connected vacuum robots.
The code is based onhttps://github.com/kangguru/botvacand credit for reverse engineering the API goes toLars Brillert @kangguruDisclaimerThis API is experimental. Use at your own risk. Feel free to contribute if things are not working.InstallationInstall using pippipinstallpybotvacAlternatively, clone the repository and runpythonsetup.pyinstallUsageRobotIf the serial and secret for your robot is known, simply run>>>frompybotvacimportRobot>>>robot=Robot('OPS01234-0123456789AB','0123456789ABCDEF0123456789ABCDEF','my_robot_name')>>>print(robot)Name:sample_robot,Serial:OPS01234-0123456789AB,Secret:0123456789ABCDEF0123456789ABCDEFThe format of the serial should be 'OPSxxxxx-xxxxxxxxxxxx', and the secret should be a string of hex characters 32 characters long.
These can be found by using the Account class.To start cleaningrobot.start_cleaning()If no exception occurred, your robot should now get to work.Currently the following methods are available in the Robot class:get_robot_state()start_cleaning()start_spot_cleaning()pause_cleaning()stop_cleaning()send_to_base()enable_schedule()disable_schedule()get_schedule()For convenience, properties exist for state and schedule# Get statestate=robot.state# Check if schedule is enabledrobot.schedule_enabled# Disable schedulerobot.schedule_enabled=FalseAccountIf the serial and secret are unknown, they can be retrieved using the Account class.
You need a session instance to create an account.
There are three different types of sessions available.
It depends on your provider which session is suitable for you.PasswordSessionlets you authenticate via E-Mail and Password. Even though this works fine, it is not recommended.OAuthSessionlets you authenticate via OAuth2. You have to create an applicationherein order to generateclient_id,client_secretandredirect_url.PasswordlessSessionis known to work for users of the new MyKobold App. The only knownclient_idisKY4YbVAvtgB7lp8vIbWQ7zLk3hssZlhR.frompybotvacimportAccount,Neato,OAuthSession,PasswordlessSession,PasswordSession,Vorwerkemail="Your email"password="Your password"client_id="Your client it"client_secret="Your client secret"redirect_uri="Your redirect URI"# Authenticate via Email and Passwordpassword_session=PasswordSession(email=email,password=password,vendor=Neato())# Authenticate via OAuth2oauth_session=OAuthSession(client_id=client_id,client_secret=client_secret,redirect_uri=redirect_uri,vendor=Neato())authorization_url=oauth_session.get_authorization_url()print("Visit: "+authorization_url)authorization_response=input("Enter the full callback URL: ")token=oauth_session.fetch_token(authorization_response)# Authenticate via One Time Passwordpasswordless_session=PasswordlessSession(client_id=client_id,vendor=Vorwerk())passwordless_session.send_email_otp(email)code=input("Enter the code: ")passwordless_session.fetch_token_passwordless(email,code)# Create an account with one of the generated sessionsaccount=Account(password_session)# List all robots associated with accountforrobotinaccount.robots:print(robot)Information about maps and download of maps can be done from the Account class:>>>frompybotvacimportAccount>>># List all maps associated with a specific robot>>>formap_infoinAccount(PasswordSession('sample@email.com','sample_password')).maps:...print(map_info)A cleaning map can be downloaded with the account class. Returns the raw image response. Example shows latest map.
You need the url from the map output to do that:>>>frompybotvacimportAccount>>># List all maps associated with a specific robot>>>map=Account(PasswordSession('sample@email.com','sample_password')).maps>>>download_link=map['robot_serial']['maps'][0]['url']>>>Account('sample@email.com','sample_password').get_map_image(download_link)