PyMammotion

raw JSON →
0.7.87 verified Fri May 01 auth: no python

A Python library for controlling Mammotion robotic lawn mowers (Luba, Yuka) over local network. Version 0.7.87 requires Python >=3.14. Provides async device discovery, message parsing, and command sending. Development is active, but the API is still evolving.

pip install pymammotion
error AttributeError: module 'pymammotion' has no attribute 'MammotionDiscovery'
cause Importing from the wrong location; MammotionDiscovery is in the discovery submodule.
fix
Use: from pymammotion.discovery import MammotionDiscovery
error TypeError: object NoneType can't be used in 'await' expression
cause Discovery method not awaited; it is a coroutine.
fix
Use: await discovery.discover()
error NotImplementedError: Command not implemented for this device model
cause Some commands are not supported on all device models (e.g., Luba vs Yuka).
fix
Check device capabilities using device.supported_commands or refer to the docs for your device.
breaking Before version 0.7.0, the main class was `Mammotion` directly from `pymammotion`. It has been replaced by separate `MammotionDiscovery`, `MammotionDevice`, etc. Old code importing `from pymammotion import Mammotion` will break.
fix Update imports to use the new submodules: from pymammotion.discovery import MammotionDiscovery, etc.
deprecated The `mower` module is deprecated in favor of `device`. Using `from pymammotion.mower import ...` will still work but prints a deprecation warning.
fix Replace `from pymammotion.mower import ...` with `from pymammotion.device import ...`.
gotcha Discovery uses UDP broadcast and may not work across subnets or VPNs. Ensure your device is on the same network segment.
fix Run discovery on the same LAN. Use static IP configuration if cross-subnet is needed.

Discover Mammotion devices on the local network.

import asyncio
from pymammotion.discovery import MammotionDiscovery

async def main():
    discovery = MammotionDiscovery()
    devices = await discovery.discover()
    for device in devices:
        print(f"Found: {device.name}")

asyncio.run(main())