Edge Driver for Tuya Wi-Fi Devices Project

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?

Note that these are Wi-Fi devices, not Zigbee and hence nothing to do with w35l3y/EdgeDrivers at main (github.com).

Thanks!

1 Like

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.

  1. 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.

  1. 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.

[ST Edge] •• Tasmota Edge •• for Sonoff, Tuya & many other ESP WiFi & HTTP devices - over 2000 Tasmota supported devices

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.

  1. 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.

@Paul_Oliver

Yes this would be communicating over the local LAN (6668/TCP) to my Tuya devices. No cloud involved. This is how tuyapi does it.

Smart Life also does offer a cloud API but I am not using that.

Just wondering if anyone has started something like this to save me a little time.

2 Likes

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.

3 Likes

Me too. I have a number of Tuya wifi devices, and would be happy to test.

1 Like