Control iRobot cleaning robots
Project description
This ia a python module for controlling the iRobot Roomba 980 (and possibly Roomba 960 and Braava Jet, but those are untested)
iRobot does not povide an official API for their robots; I reverse engineered this from the communication between my robot, the iRobot iOS app, and the Axeda IoT cloud service. The names of methods and attributes are mapped as closely as possible to the way the ap presents them.
This module is published to pypi, so you can install it via pip install pyirobot
Usage
Robot Password
To use any of the robot functions, you will need to get the password of your robot. Robot.GetPassword() can help you do this. Make sure your robot is on the home base and then hold down the home button for 3-4 seconds, until the LEDs illuminate and the robot emits a series of tones. Then quickly call Robot.GetPassword with the IP address of your robot.
Controlling the Robot
You can start and stop cleaning and send the robot back to the home base with StartCleaning, PauseCleaning, ResumeCleaning, EndCleaning and ReturnHome
from pyirobot import Robot
robot = Robot("192.168.0.0", "MtccDqXskShX|4jXnTd")
robot.StartCleaning()
robot.StopCleaning()
robot.ReturnHome()
Robot Configuration/Status
GetCleaningPreferences returns the cleaning preferences for the robot. CarpetBoost, CleaningPasses, EdgeClean and FinishWhenBinFull are all enums in the module.
import json
from pyirobot import Robot
robot = Robot("192.168.0.0", "MtccDqXskShX|4jXnTd")
print robot.GetCleaningPreferences()
print json.dumps(robot.GetCleaningPreferences(), sort_keys=True, indent=4)
Output:
{u'lang': 0, u'cleaningPasses': <CleaningPasses.Two: 1025>, u'name': u'Roomba', u'finishWhenBinFull': <FinishWhenBinFull.Off: 32>, u'carpetBoost': <CarpetBoost.Auto: 0>, u'edgeClean': <EdgeClean.On: 0>, u'timezone': u'America/Chicago'} { "carpetBoost": "Auto", "cleaningPasses": "Auto", "edgeClean": "On", "finishWhenBinFull": "Off", "lang": 0, "name": "Roomba", "timezone": "America/Chicago" }
GetMission returns real time status about the robot, including battery and bin as well as the current cleaning status, if the robot is currently cleaning.
print robot.GetMission()
{u'binStatus': <BinStatus.Normal: (0,)>, u'readyStatus': <ReadyStatus.Ready: 0>, u'robotPosition': {u'theta': -79, u'point': {u'y': -22, u'x': 2}}, u'robotStatus': <RobotStatus.Charging: 'charge'>, u'missionCoveredSquareFootage': 0, u'missionElapsedMinutes': 0, u'batteryPercentage': 100}
print json.dumps(robot.GetMission(), sort_keys=True, indent=4)
{
"batteryPercentage": 100,
"binStatus": "Normal",
"missionCoveredSquareFootage": 0,
"missionElapsedMinutes": 0,
"readyStatus": "Ready",
"robotPosition": {
"point": {
"x": 2,
"y": -22
},
"theta": -79
},
"robotStatus": "Charging"
}
There are other functions for getting the cleaning schedule, robot time, and various other settings, as well as the corresponding Set functions, and enums for the various fields.
print robot.GetSchedule()
{'Sunday': {'startTime': datetime.time(9, 0), 'clean': False}, 'Monday': {'startTime': datetime.time(10, 0), 'clean': True}, 'Tuesday': {'startTime': datetime.time(10, 0), 'clean': True}, 'Wednesday': {'startTime': datetime.time(10, 0), 'clean': True}, 'Thursday': {'startTime': datetime.time(10, 0), 'clean': True}, 'Friday': {'startTime': datetime.time(10, 0), 'clean': True}, 'Saturday': {'startTime': datetime.time(10, 0), 'clean': False}}
print json.dumps(robot.GetSchedule(), indent=4)
{
"Sunday": {
"startTime": "09:00:00",
"clean": false
},
"Monday": {
"startTime": "10:00:00",
"clean": true
},
"Tuesday": {
"startTime": "10:00:00",
"clean": true
},
"Wednesday": {
"startTime": "10:00:00",
"clean": true
},
"Thursday": {
"startTime": "10:00:00",
"clean": true
},
"Friday": {
"startTime": "10:00:00",
"clean": true
},
"Saturday": {
"startTime": "10:00:00",
"clean": false
}
}
Errors
Any error coming back from the robot’s API is thrown as a RobotError. Errors from networking/communication with the robot are thrown by requests and uncaught/unmodified by this library.
Known Issues
This module is still a work in progress, so error handling and unit tests are pretty light and the API isn’t complete yet This first release only supports local communication with the robot; remote/cloud support is in progress
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
Built Distributions
File details
Details for the file pyirobot-1.0.6.tar.gz
.
File metadata
- Download URL: pyirobot-1.0.6.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fa82e45a316f532e367701cd8748ead97ffe5a19625ac82c4c3e728c03a9be1 |
|
MD5 | 403bc3fa5d29e3e176a95ba602ca0c67 |
|
BLAKE2b-256 | f614f1fd6004807a7023c408d5b7b1863e999c853d460218ccfee1eb1eba21ff |
File details
Details for the file pyirobot-1.0.6-py3.6.egg
.
File metadata
- Download URL: pyirobot-1.0.6-py3.6.egg
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbdbb02e43de23b31fa26193411b96e00af9ff3ee789faed810dbeb59e97c0c2 |
|
MD5 | cb05a548f756f11168fcfda2d03e6f77 |
|
BLAKE2b-256 | 11ed24a4bc2bb545c4c6aaf8085aa77d847e6f11f683c5dea2252263870e09dd |
File details
Details for the file pyirobot-1.0.6-py3.5.egg
.
File metadata
- Download URL: pyirobot-1.0.6-py3.5.egg
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4ac12531ab9cc913ffb1bb9a68236f91b1add253d84c74f6410d876a5d586ae |
|
MD5 | 5916748ac7d7f1af6beb1d2c3076beff |
|
BLAKE2b-256 | def765a44975b78acc598128e12452bd455a43265bc52156311de9abd7f9c732 |
File details
Details for the file pyirobot-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: pyirobot-1.0.6-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5469e20e09706090dba1a5c56065f9943e32e46bea3f764c3ad36d8c4758f8b2 |
|
MD5 | d58ce683200eaf359bf61a9305310bcd |
|
BLAKE2b-256 | 6a364e735bf99c390206319e37a532b7483c20786f36388a2b1e04bad2715703 |
File details
Details for the file pyirobot-1.0.6-py2.7.egg
.
File metadata
- Download URL: pyirobot-1.0.6-py2.7.egg
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 022019aaff8e7fc343f32155f5060c54fa68dbf8b711d7e1ce23af61eb9a71b5 |
|
MD5 | 2d945f316d76994d362a72d6ba0b169b |
|
BLAKE2b-256 | 1eb08e5765ae683f7f47c32a70f1621dde916ecb315ed4b8beb294838941ce8f |
File details
Details for the file pyirobot-1.0.6-py2-none-any.whl
.
File metadata
- Download URL: pyirobot-1.0.6-py2-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fcc4a3dba6657307b25de319beb754a7019aaf2c43c1868ccb13e614aa3da67 |
|
MD5 | 6b210cf2e8754f26d32b5d6935e45187 |
|
BLAKE2b-256 | 5d3f6db8840172cc202ca1ea3a7911ec402a2771b63f1966f57fd441fb9d4fb2 |