This .NET Standard 2.0 API allows programmatic control over the basic functions of Tuya Smart Plugs, including getting and setting Power status.
- .NET Core 2.0
- Zentec Living Smart Plug Outlet with USB Port
- ISELECTOR Mini Smart Plug
- Xenon Smart Plug PW701U
- Teckin Smart Plug SH-SP23-2-UK
Many Smart Plug devices compatible with the Tuya Smart Life and Jinvoo Smart app also appear to be compatible with the Tuya protocol.
Install-Package m4rcus.TuyaCore
Check out the instructions at codetheweb/tuyapi
> dotnet m4rcus.TuyaCore.Console.dll -i <ip> -k <localKey> -d <deviceId> [status|power-on|power-off]
using m4rcus.TuyaCore;
var device = new TuyaPlug()
{
IP = "192.168.0.101",
LocalKey = "5f5f784cd82d449b",
Id = "0120015260091453a970"
};
var status = await device.GetStatus();
await device.SetStatus(!status.Powered); // toggle power
Protocol details from @codetheweb and @clach04: