Skip to main content

pymoebot

A Python library intended to monitor (and control?) the MoeBot robotic lawn mowers.

Goals

History

It was originally intended to utilise the official tuya-iot-python-sdk library but that provided minimal support for the MoeBot. Instead, this library now uses local communication with the MoeBot via the tinytuya library. This does require a little bit of pre-work to identify the LOCAL_KEY for the device so that we can communicate with it.

Regardless of chosen library we are required to have configured a Tuya Cloud project, follow these instructions

Using pymoebot

NOTE: The MoeBot needs to have been activated by adding it to the Tuya/SmartLife app first.

In it's most simplistic use, get an instance of MoeBot, poll for data and then show its attributes.

from pymoebot import MoeBot

moebot = MoeBot('DEVICE_ID', 'IP', 'LOCAL_KEY')
moebot.poll()
print("Battery level: %s%" % moebot.battery)

Alternatively, register as a listener and then start the listening thread on your MoeBot.

from pymoebot import MoeBot

moebot = MoeBot('DEVICE_ID', 'IP', 'LOCAL_KEY')
moebot.add_listener(lambda d: print("Got data: %s", d))
moebot.listen()

# Do some other stuff

moebot.unlisten()

See the examples for further examples of usage.

Communicating with the MoeBot

tinytuya have done all the hard work of communicating with the MoeBot. It is worth sharing my understanding of the specifics about the MoeBot though, since I have made some assumptions and peer-review may be able to identify issues.

The MoeBot (like all other Tuya devices) communicates by way of Tuya Data Points (DPS). Some of these are declared when the mower is queried. Others are provided unsolicited.

import tinytuya

d = tinytuya.Device('DEVICEID', 'DEVICEIP', 'DEVICEKEY')
d.set_version(3.3)
print(d.status())

Will result in:

{'dps': {'6': 100, '101': 'STANDBY', '102': 0, '103': 'MOWER_LEAN', '104': True, '105': 3, '106': 1111, '114': 'AutoMode'}}

Tuya Data Points

DPS Read/Write Values Comment
6 r/w 0-100 'Battery'
101 r
  • STANDBY
  • MOWING
  • CHARGING
  • EMERGENCY
  • LOCKED
  • PAUSED
  • PARK
  • CHARGING_WITH_TASK_SUSPEND
  • FIXED_MOWING
  • ERROR
'Machine Status' Provides state - can't seem to command state using this
102 r 0 'Machine error'
103 r
  • MOWER_LEAN
  • MOWER_EMERGENCY
  • MOWER_UI_LOCKED
  • NO_LOOP_SIGNAL
  • BATTERY_NOT_ENOUGH
    'Machine warning' Provides sub-states for when the mower is in EMERGENCY
    104 r/w True/False 'Rain mode' Should we work in the rain?
    105 r/w 1-99 'work time' How many hours to run for when started manually
    106 r/? 1111 'machine password'
    107 w True/False 'Clear machine appointment' results in a DPS 110 response
    108 w True/False 'Query machine appointment' results in a DPS 110 response
    109 w True/False 'query partition parameters' results in a DPS 113 response
    110 r/w [byte data] 'Report machine appointment'
    111 r/? [byte data] 'error log'
    112 r/w [byte data] 'work log' Report of mower working time after work has completed, contains last 10 logs
    113 r/w [byte data] 'Partition parameters' specifies the zone mowing configuration
    114 r/? AutoMode/?? 'WorkMode'
    115 w
    • StartMowing
    • StartFixedMowing
    • PauseWork
    • ContinueWork
    • CancelWork
    • StartReturnStation
      'Machine Control CMD' used to change mower state

      State Model

      Main States

      The following are the declared states of the MoeBot seen so far. They are signified by a '101' DPS.

      • CHARGING
      • EMERGENCY - the emergency stop button has been pressed (or the device has been tipped/picked up).
      • LOCKED - the device is locked and the PIN is required to do anything.
      • PAUSED - the mowing session has been paused.
      • MOWING
      • CHARGING_WITH_TASK_SUSPEND - currently charging but will go back out to mow.
      • STANDBY - the mower is not mowing and is charged. May or may not be docked.
      • PARK - on the way back to the charging dock.
      • FIXED_MOWING - working in a spiral pattern.

      EMERGENCY States

      The following appear to be sub-states for when the mower is in EMERGENCY state. They are signified by a '103' DPS.

      • MOWER_LEAN
      • MOWER_EMERGENCY
      • MOWER_UI_LOCKED
      • PLACE_INSIDE_STATION
      • BATTERY_NOT_ENOUGH

      Internals

      A Facebook user has opened the main case of the MoeBot and taken photos. Refer to the images captured in the 'internals' folder.

      Metadata

      Release files for pymoebot 0.4.0

      For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

      Source distribution (sdist)

      Source distribution for pymoebot 0.4.0
      File Size Uploaded Provenance Actions
      pymoebot-0.4.0.tar.gz 8.3 kB Without provenance Details for pymoebot-0.4.0.tar.gz

      Built distribution (wheel)

      Table of built distributions (wheels) for pymoebot 0.4.0
      File Interpreter ABI Platform Actions
      pymoebot-0.4.0-py3-none-any.whl Python 3 none any Details for pymoebot-0.4.0-py3-none-any.whl

      Total release size: 16.8 kB

      Release files / pymoebot-0.4.0.tar.gz

      Download URL pymoebot-0.4.0.tar.gz
      Size 8.3 kB
      Tags Source
      SHA-256 checksum
      How to use checksums
      4aa19d5a7a81c816fe54f3bd23893d15cf1e7e267736b7b585ab105d08596893
      BLAKE2b-256 checksum
      How to use checksums
      dfc30cbf54fa847408317660002e660621bf45970a16ff138812b7fc1e528201
      Upload date
      Uploaded using Trusted Publishing?
      What is trusted publishing?
      No
      Uploaded via twine/6.2.0 CPython/3.9.25

      Release files / pymoebot-0.4.0-py3-none-any.whl

      Download URL pymoebot-0.4.0-py3-none-any.whl
      Size 8.5 kB
      Tags Python 3
      SHA-256 checksum
      How to use checksums
      b51e3fcaea7317c9c977a9ae8eaafeda1d310459c9c3359887e358521c485d89
      BLAKE2b-256 checksum
      How to use checksums
      b8a63a36a0ee20ef338cd281505dca96bd11fdfbc8ccbf7a808ac6685ee84be6
      Upload date
      Uploaded using Trusted Publishing?
      What is trusted publishing?
      No
      Uploaded via twine/6.2.0 CPython/3.9.25

      Security for pymoebot 0.4.0

      Provenance

      Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

      No provenance found

      None of the files in this release were uploaded with provenance metadata.

      A note on package security

      PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

      To learn more about protecting yourself from malicious actors, visit our package security documentation.

      Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page