pyechorobotics
Allows control and reads status of robot lawn mowers by echorobotics.
Used by Home Assistant Echorobotics integration.
Example:
import sys
import echoroboticsapi
import aiohttp
import asyncio
import logging
async def main():
async with aiohttp.ClientSession() as session:
api = echoroboticsapi.Api(session, robot_ids=["your-robot-id"], email="your-email", password="your-password")
print(await api.last_statuses())
print(await api.set_mode("chargeAndWork"))
if __name__ == "__main__":
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
Unfortunately, the API doesn't tell is which mode ("chargeAndWork", "work" or "chargeAndStay") the robot is in. We can make an educated guess though, depending on what we set ourselves, history events and the status. This is what SmartMode does:
import sys
import echoroboticsapi
import aiohttp
import asyncio
import logging
async def main():
async with aiohttp.ClientSession() as session:
api = echoroboticsapi.Api(session, robot_ids=["your-robot-id"], email="your-email", password="your-password")
smartmode = echoroboticsapi.SmartMode("your-robot-id")
api.register_smart_mode(smartmode)
print(await api.history_list())
print(await api.last_statuses())
print(smartmode.get_robot_mode())
if __name__ == "__main__":
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
See also src/main.py
SmartFetch
While calling last_statuses() and history_list() regularly (suggestion every 2min and 15min), this is somewhat wasteful of bandwidth.
Especially history_list() uses some 60KiB of data volume. If calling this every 15mins is an issue for you, you may be interested in
SmartFetch.
import sys
import echoroboticsapi
import aiohttp
import asyncio
import logging
async def main():
async with aiohttp.ClientSession() as session:
api = echoroboticsapi.Api(session, robot_ids=["your-robot-id"], email="your-email", password="your-password")
smartmode = echoroboticsapi.SmartMode("your-robot-id")
api.register_smart_mode(smartmode)
smartfetch = echoroboticsapi.SmartFetch(api)
last_statuses = await smartfetch.smart_fetch()
print(last_statuses)
print(smartmode.get_robot_mode())
if __name__ == "__main__":
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
Dev notes
To make a new release, use GitHub website and draft a release manually. Make sure the version number in pyproject.toml matches the new tag. GitHub Actions will publish it to pypi.
Adding a new state
If a new state is found, it must be added to models.py.
Also check notify_laststatuses_received() in smart_mode.py if it should be recognized as a specific Mode.
Finally, in home-assistant-echorobotics-integration, increment the version number in the manifest.json. Also check the translations in echorobotics/translations, and any custom dashboard code.
Release files for pyechorobotics 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyechorobotics-2.1.0.tar.gz | 28.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyechorobotics-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.3 kB
Release files / pyechorobotics-2.1.0.tar.gz
| Download URL | pyechorobotics-2.1.0.tar.gz |
|---|---|
| Size | 28.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5dc1a63027abc5702c3f653729fb9487eda0def7860d6d8b9504482f8783e4dc
|
|
BLAKE2b-256 checksum How to use checksums |
c5a85901fb74db5f6760fa606053b43c391ccf2b95c40c3dded382d93822923a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / pyechorobotics-2.1.0-py3-none-any.whl
| Download URL | pyechorobotics-2.1.0-py3-none-any.whl |
|---|---|
| Size | 23.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e4a0b1e556cabc205497e35b5335d756309c4ac87e54a00c7553dfd5ce9542b
|
|
BLAKE2b-256 checksum How to use checksums |
be59aa47cad02efa7a400ebf4d0f60c877cc3b923d1d900c4bbd3e0f17da665e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|