-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,27 +10,35 @@ This API is experimental. Use at your own risk. Feel free to contribute if thing | |
## Installation | ||
Install using pip | ||
|
||
pip install pybotvac | ||
```bash | ||
pip install pybotvac | ||
``` | ||
|
||
Alternatively, clone the repository and run | ||
|
||
python setup.py install | ||
```bash | ||
python setup.py install | ||
``` | ||
|
||
## Usage | ||
### Robot | ||
If the serial and secret for your robot is known, simply run | ||
|
||
>>> from pybotvac import Robot | ||
>>> robot = Robot('OPS01234-0123456789AB', '0123456789ABCDEF0123456789ABCDEF', 'my_robot_name') | ||
>>> print(robot) | ||
Name: sample_robot, Serial: OPS01234-0123456789AB, Secret: 0123456789ABCDEF0123456789ABCDEF | ||
```python | ||
>>> from pybotvac import Robot | ||
>>> robot = Robot('OPS01234-0123456789AB', '0123456789ABCDEF0123456789ABCDEF', 'my_robot_name') | ||
>>> print(robot) | ||
Name: sample_robot, Serial: OPS01234-0123456789AB, Secret: 0123456789ABCDEF0123456789ABCDEF | ||
``` | ||
|
||
The 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 cleaning | ||
|
||
robot.start_cleaning() | ||
```python | ||
robot.start_cleaning() | ||
``` | ||
|
||
If no exception occurred, your robot should now get to work. | ||
|
||
|
@@ -48,37 +56,44 @@ Currently the following methods are available in the Robot class: | |
|
||
For convenience, properties exist for state and schedule | ||
|
||
# Get state | ||
state = robot.state | ||
```python | ||
# Get state | ||
state = robot.state | ||
|
||
# Check if schedule is enabled | ||
robot.schedule_enabled | ||
# Check if schedule is enabled | ||
robot.schedule_enabled | ||
|
||
# Disable schedule | ||
robot.schedule_enabled = False | ||
# Disable schedule | ||
robot.schedule_enabled = False | ||
``` | ||
|
||
### Account | ||
If the serial and secret is unknown, they can be retrieved using the Account class. | ||
|
||
>>> from pybotvac import Account | ||
>>> # List all robots associated with account | ||
>>> for robot in Account('[email protected]', 'sample_password').robots: | ||
print(robot) | ||
|
||
Name: my_robot_name, Serial: OPS01234-0123456789AB, Secret: 0123456789ABCDEF0123456789ABCDEF, Traits: ['maps'] | ||
```python | ||
>>> from pybotvac import Account | ||
>>> # List all robots associated with account | ||
>>> for robot in Account('[email protected]', 'sample_password').robots: | ||
... print(robot) | ||
Name: my_robot_name, Serial: OPS01234-0123456789AB, Secret: 0123456789ABCDEF0123456789ABCDEF, Traits: ['maps'] | ||
``` | ||
|
||
Information about maps and download of maps can be done from the Account class: | ||
|
||
>>> from pybotvac import Account | ||
>>> # List all maps associated with a specific robot | ||
>>> for map_info in Account('[email protected]', 'sample_password').maps: | ||
print(map_info) | ||
```python | ||
>>> from pybotvac import Account | ||
>>> # List all maps associated with a specific robot | ||
>>> for map_info in Account('[email protected]', '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: | ||
|
||
>>> from pybotvac import Account | ||
>>> # List all maps associated with a specific robot | ||
>>> map = Account('[email protected]', 'sample_password').maps | ||
>>> download_link = map['robot_serial']['maps'][0]['url'] | ||
Account('[email protected]', 'sample_password').get_map_image('download_link') | ||
You need the url from the map output to do that: | ||
|
||
```python | ||
>>> from pybotvac import Account | ||
>>> # List all maps associated with a specific robot | ||
>>> map = Account('[email protected]', 'sample_password').maps | ||
>>> download_link = map['robot_serial']['maps'][0]['url'] | ||
>>> Account('[email protected]', 'sample_password').get_map_image(download_link) | ||
``` |