From 9950a1a2ad833bdf7eaf7d2dfd73de6914510e1e Mon Sep 17 00:00:00 2001 From: Brian Martin Date: Tue, 31 Dec 2019 00:59:02 -0500 Subject: [PATCH] merge sucks example --- Pipfile | 1 + docs/Use_With_Sucks.md | 35 ++++++++++++++++++++++++++++++++++- docs/index.md | 6 ++++++ examples/sucks.py | 29 ----------------------------- 4 files changed, 41 insertions(+), 30 deletions(-) delete mode 100644 examples/sucks.py diff --git a/Pipfile b/Pipfile index 321e7f1..751e7c5 100644 --- a/Pipfile +++ b/Pipfile @@ -23,6 +23,7 @@ autoflake = "*" pytest-env = "*" pytest = "==5.0.1" pytest-asyncio = "*" +mkdocs = "*" [pipenv] allow_prereleases = true diff --git a/docs/Use_With_Sucks.md b/docs/Use_With_Sucks.md index d37bd3c..bfa08e3 100644 --- a/docs/Use_With_Sucks.md +++ b/docs/Use_With_Sucks.md @@ -10,4 +10,37 @@ At this time you'll need to use the bmartin5692 fork of sucks. Especially if yo OR -- You can use Sucks as a library from your own script, see the [example script](../examples/sucks.py) +- You can use Sucks as a library from your own script, for details see the [sucks project](https://github.com/wpietri/sucks) + +```python +#!/usr/bin/env python3 + +from sucks import * + + +class BumperVacBot(VacBot): + def __init__(self, server_address): + self.server_address = server_address + vacuum = {"did": "none", "class": "none"} + super().__init__("sucks", "ecouser.net", "", "", vacuum, "") + + def connect_and_wait_until_ready(self): + logging.info("connecting") + self.xmpp.connect(self.server_address) + self.xmpp.process() + self.xmpp.wait_until_ready() + + +logging.basicConfig(level=logging.DEBUG, format="%(levelname)-8s %(message)s") +server_address = ("xxx.xxx.xxx.xxx", 5223) + +# Initialize +vacbot = BumperVacBot(server_address) + +# Connect +vacbot.connect_and_wait_until_ready() + +# Send a command +vacbot.run(Clean()) + +``` diff --git a/docs/index.md b/docs/index.md index 1eacc0c..faf1659 100644 --- a/docs/index.md +++ b/docs/index.md @@ -39,3 +39,9 @@ For more information on generating certificates manually, see the [Creating Cert - **Note:** Some models may require removing and re-inserting the battery pack. - This doesn't seem to be required for models that don't have easily accessible batteries such as the 900/901. - If your configuration is correct, the robot will connect to Bumper within about 30 seconds. Bumper will output information about the connection status. + +# Troubleshooting + +Logs are output in the /logs directory. + +If there is an issue, enable debug logging with the `--debug` switch for additional detail. \ No newline at end of file diff --git a/examples/sucks.py b/examples/sucks.py deleted file mode 100644 index 3c890e4..0000000 --- a/examples/sucks.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 - -from sucks import * - - -class BumperVacBot(VacBot): - def __init__(self, server_address): - self.server_address = server_address - vacuum = {"did": "none", "class": "none"} - super().__init__("sucks", "ecouser.net", "", "", vacuum, "") - - def connect_and_wait_until_ready(self): - logging.info("connecting") - self.xmpp.connect(self.server_address) - self.xmpp.process() - self.xmpp.wait_until_ready() - - -logging.basicConfig(level=logging.DEBUG, format="%(levelname)-8s %(message)s") -server_address = ("xxx.xxx.xxx.xxx", 5223) - -# Initialize -vacbot = BumperVacBot(server_address) - -# Connect -vacbot.connect_and_wait_until_ready() - -# Send a command -vacbot.run(Clean())