I currently have my Tuya/Smart Life devices integrated with SmartThings through a SmartThings cloud (local service) integration using tuyapi. For the most part it works rather well, and everything is local.
I had some stray thoughts to port tuyapi over to Lua so that I can more cleanly use Edge drivers.
Before I start doing that, has anyone done this already? Has anyone written Lua code to interface with Tuya devices via Wi-Fi/LAN?
It is possible to write an edge driver to communicate with a Wi-Fi device on the local LAN, but not to communicate with any Wi-Fi device that requires going through its own cloud, because the SmartThings architecture does not allow an edge driver to go outside its local cloud.
There are a couple of options.
use an edge driver to communicate to a local server device, typically a raspberry pi, and then go from that server to an external URL. But that would require that the third-party cloud have an open API, and I don’t think Tuya does. Someone can correct me if I’m wrong on that point.
It sounds like you may already have a local alternative in tuyapi. I’m not familiar with that, but if you do have it working, see option two for some ideas.
if the model allows it, flash the device with Tasmota firmware instead of its own and then you will be able to communicate with it directly on the LAN without going through the third-party cloud. Lots of people have done that with various Tuya Devices, but if you go that way, the device will no longer be usable with its own app, and you may lose a number of the proprietary tuya features. See the following thread for details, including links to lists of models that can be handled in this fashion.
It sounds like this might be a model for what you want to do with tuyapi, but again, I’m not familiar with that, so I don’t know if it’s similar.
Wait until Tuya provides matter compatibility for the Wi-Fi device, and then you should be able to bring it in that way with no custom code required. But no guarantees on which models are which features will be available this way; we’re not there yet.
———
But as far as creating an LAN edge driver to communicate with an unmodified standard Tuya Wi-Fi device, unless they have an open API, I don’t think you can do it. Again, if I’m wrong on that, hopefully someone else will correct me.
I don’t know of anyone that has written an Edge driver for Tuya WiFi devices. But I would not be surprised if someone was trying to do it considering how common these devices are
If you write a driver I would be happy to do testing for you.