A Python library intended to monitor (and control?) the MoeBot robotic lawn mowers.
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
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
and query its status.
from pymoebot import MoeBot
moebot = MoeBot('DEVICE_ID', 'IP', 'LOCAL_KEY')
print("Battery level: %s%" % moebot.battery)
See the examples for full examples of usage.
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'}}
DPS | Read/Write | Values | Comment |
---|---|---|---|
6 | r/w | 0-100 | 'Battery' |
101 | r |
|
'Machine Status' Provides state - can't seem to command state using this |
102 | r | 0 | 'Machine error' |
103 | r |
|
'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 reservation' 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 Reservation' |
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 |
|
'Machine Control CMD' used to change mower state |
The following are the declared states of the MoeBot seen so far. They are signified by a '101' DPS.
The following appear to be sub-states for when the mower is in EMERGENCY state. They are signified by a '103' DPS.