-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Device Type - Robot Mower #134
Comments
Here is what I would try to get the DPS values that control the action. First run a monitoring loop (see below) then use the local control (if the robot has one) or app to command the robot to start running. Watch the monitoring loop. Hopefully these state changes will show up in the monitoring loop. import tinytuya
d = tinytuya.OutletDevice('DEVICEID', 'DEVICEIP', 'DEVICEKEY')
d.set_version(3.3)
d.set_socketPersistent(True)
print(" > Send Initial Request for Status < ")
payload = d.generate_payload(tinytuya.DP_QUERY)
d.send(payload)
print(" > Begin Monitoring Loop <")
while(True):
# See if any data is available
data = d.receive()
print('Received Payload: %r' % data)
# Send keyalive heartbeat to stay connected
print(" > Send Heartbeat Ping < ")
payload = d.generate_payload(tinytuya.HEART_BEAT)
d.send(payload) And yes, please feel free to submit a pull request for the DPS values you discover! Thanks for opening thing. I had no idea there was a Tuya mower! |
Thanks Jason, will work up the PR for the Mower type. I have already trialled what you suggested using the Tuya app for control. Here is the output from a slightly modified monitoring loop (removes heartbeat noise and adds a timestamp):
Here we see that I :
Maybe I am doing something completely wrong but I can't just ask it to start mowing by issuing something like: |
Hi @Whytey - I suspect you may have done this already to get the original table you posted, but just in case it would be interesting to see the results from import tinytuya
# Connect to Tuya Cloud using IoT Credentials - see tinytuya.json
c = tinytuya.Cloud(
apiRegion="us",
apiKey="xxxxxxxxxxxxxxxxxxxx",
apiSecret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
apiDeviceID="xxxxxxxxxxxxxxxxxxID")
# download DPS mapping from Tuya - DeviceID of Mower
print(c.getdps(apiDeviceID))
# these may also be interesting
print(c.getproperties(apiDeviceID))
print(c.getfunctions(apiDeviceID)) I have poked around the https://developer.tuya.com/ site to see if there is anything on robotic mowers. I found this: https://developer.tuya.com/en/demo/grass-mower and wonder if you can see your mower in the Tuya IoT platform and if it shows more details about controllable DPs. |
Yeah, unfortunately, the cloud data is even more limited.
It was the same result when using the official I have noted the similarities with robot vacuums and reviewed that demo mower project but I am not sure how to proceed. I am actually thinking of poking Tuya support but I think they might not be interested in helping. |
Hi @jasonacox . Success!!!! I have finally been able to discover the secret sauce for being able to control the mower (plus determine what most of the other DPS codes were for). In case it helps yourself or others in the future, the Zigbee2MQTT provides the instructions for it- https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html#_9-find-your-data-point . In my case, I need to send DPS 115 with one of PauseWork/CancelWork/StartMowing/StartReturnStation values to the mower. FYI, I am still planning to prepare a pull request for adding this data to tinytuya. |
Excellent work @Whytey !!! I suspect the Find your Data Point link will be a great reference for others too. Thanks for sharing! Please do feel free to submit a PR for the data point. I'll add your project as a link. Great job! 😀 |
And I just discovered that you can get a list of all data points at once by opening DevTools after step 7 but before step 8 - once you click the "Device Logs" tab (step 8) the first "list" request will contain all the data points in the DevTools 'Preview' tab. It would have been nice if I had discovered this before looking up all 32 of my data points one at a time 🤣 |
Hi,
I have a Tuya Robot Mower and am hoping to create a Home-Assistant integration for it.
I originally intended to use the
tuya-iot-python-sdk
module but it was very limited in what functionality it would provide.Using
tinytuya
, I get more data and avoid the round-trip to the cloud! Whilst I can set some values against the device I haven't found the magic required to command the mower to startI also seem to get additional dpcode's report unsolicited:
'status': [{'110': 'AIiIiIgBiIiIiAKIiIiIA4iIiIgEiIiIiAWIiIiIBoiIiIg='}]
'status': [{'111': 'Ylxw+RRiXG/nFGJVvhsUYlW9/wJiVb30AmJJefACYkl5zAJiSXm/AmJJWowCAAAAAAA='}]
'status': [{'112': 'YoJb5wAAKK4BYoDkWAAAQOUBYn+SygAABUABYn5JAwAADcsBYn5ITQAAAEYBYn5IEQAAADwBYn5H4QAAADwBYn5HtQAAADwBYn5HigAAADwBYn5HYAAAADwB'}]
'status': [{'113': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=='}]
When I queried the cloud for the functions available to this device category this is what was reported (though I am unsure how to map the 'code' here to a 'dps' ID):
/v1.0/iot-03/categories/gcj/functions
:I am at a loss for how to progress to issue commands to this device. I have tried using Wireshark and the android emulator without success but I am not very competent at the low level messaging stuff.
I am intending to issue a pull-request for the data I have discovered, should it help anyone else - I assume this would be welcome?
Thanks.
The text was updated successfully, but these errors were encountered: