Package: pymoebot
pymoebotA Python library intended to monitor (and control?) theMoeBotrobotic lawn mowers.MoeBot are controllable over WiFi via the Tuya protocol, using the Tuya apps on your Apple/Android device.Tested using an S5 model of MoeBot (which is identical to an S10 (and S20??) apart from battery size).A number of other Robot Mowers appear to be physically identical, though it is unconfirmed if they work (or even support WiFi control):JIUDU DM2AYI DRM3 600iHyundai HYRM1000Gtech RLM50Sømløs G1/G1siHunt RoboMower APP 2500m2 PROThis library provides a MoeBot facade to thetinytuyalibrary.The ultimate intent is to have a library that can then be used withinHome-AssistantGoalsMonitor the MoeBotControl the MoeBotIntegrate into Home-Assistant stand-alone - seemoebot-hass-integration.HistoryIt was originally intended to utilise the officialtuya-iot-python-sdklibrary but that provided minimal support for the MoeBot.  Instead, this library now uses local communication with the MoeBot via thetinytuyalibrary.  This does require a little bit of pre-work to identify theLOCAL_KEYfor the device so that we can communicate with it.Regardless of chosen library we are required to have configured a Tuya Cloud project, follow theseinstructionsUsing pymoebotNOTE: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 ofMoeBot, poll for data and then show its attributes.frompymoebotimportMoeBotmoebot=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 yourMoeBot.frompymoebotimportMoeBotmoebot=MoeBot('DEVICE_ID','IP','LOCAL_KEY')moebot.add_listener(lambdad:print("Got data:%s",d))moebot.listen()# Do some other stuffmoebot.unlisten()See theexamplesfor further examples of usage.Communicating with the MoeBottinytuyahave 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.importtinytuyad=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 PointsDPSRead/WriteValuesComment6r/w0-100'Battery'101rSTANDBYMOWINGCHARGINGEMERGENCYLOCKEDPAUSEDPARKCHARGING_WITH_TASK_SUSPENDFIXED_MOWINGERROR'Machine Status' Provides state - can't seem to command state using this102r0'Machine error'103rMOWER_LEANMOWER_EMERGENCYMOWER_UI_LOCKEDNO_LOOP_SIGNALBATTERY_NOT_ENOUGH'Machine warning' Provides sub-states for when the mower is in EMERGENCY104r/wTrue/False'Rain mode' Should we work in the rain?105r/w1-99'work time' How many hours to run for when started manually106r/?1111'machine password'107wTrue/False'Clear machine appointment' results in a DPS 110 response108wTrue/False'Query machine appointment' results in a DPS 110 response109wTrue/False'query partition parameters' results in a DPS 113 response110r/w[byte data]'Report machine appointment'111r/?[byte data]'error log'112r/w[byte data]'work log' Report of mower working time after work has completed, contains last 10 logs113r/w[byte data]'Partition parameters' specifies the zone mowing configuration114r/?AutoMode/??'WorkMode'115wStartMowingStartFixedMowingPauseWorkContinueWorkCancelWorkStartReturnStation'Machine Control CMD' used to change mower stateState ModelMain StatesThe following are the declared states of the MoeBot seen so far.  They are signified by a '101' DPS.CHARGINGEMERGENCY - 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.MOWINGCHARGING_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 StatesThe following appear to be sub-states for when the mower is in EMERGENCY state.  They are signified by a '103' DPS.MOWER_LEANMOWER_EMERGENCYMOWER_UI_LOCKEDPLACE_INSIDE_STATIONBATTERY_NOT_ENOUGH