TapoConnect 2.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TapoConnect --version 2.4.0                
NuGet\Install-Package TapoConnect -Version 2.4.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TapoConnect" Version="2.4.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TapoConnect --version 2.4.0                
#r "nuget: TapoConnect, 2.4.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TapoConnect as a Cake Addin
#addin nuget:?package=TapoConnect&version=2.4.0

// Install TapoConnect as a Cake Tool
#tool nuget:?package=TapoConnect&version=2.4.0                

TapoConnect

Unofficial TP-Link Tapo smart device library for C#.

NuGet version (TapoConnect)

Tested With

Examples

Build clients to interact with Tapo Cloud or smart device.

TapoCloudClient cloudClient = new TapoCloudClient();
TapoDeviceClient deviceClient = new TapoDeviceClient();

Get devices from cloud.

CloudLoginResult cloudKey = await cloudClient.LoginAsync("<Username>", "<Password>");
CloudListDeviceResult deviceResult = await cloudClient.ListDevicesAsync(cloudKey.Token);

Select devices by type.

IEnumerable<TapoDeviceDto> devices = deviceResult.DeviceList
    .Where(x => x.DeviceType == TapoUtils.TapoBulbDeviceType);

Select device by alias.

TapoDeviceDto device = deviceResult.DeviceList.First(x => x.Alias == "<Device Name>")

Login to device by known IP address.

TapoDeviceKey deviceKey = await deviceClient.LoginByIpAsync("<Username>", "<Password>", "<IpAddress>");

Login to device by known MAC address (finds the MAC address on local network through a Windows ARP request).

string ip = TapoUtils.GetIpAddressByMacAddress(device.DeviceMac);
TapoDeviceKey deviceKey = await deviceClient.LoginByIpAsync("<Username>", "<Password>", ip);

Get Device info.

DeviceGetInfoResult deviceInfo = await deviceClient.GetDeviceInfoAsync(deviceKey);

Set Device's power, brightness, color, and state.

await deviceClient.SetPowerAsync(deviceKey, true);

await deviceClient.SetBrightnessAsync(deviceKey, 80);

await deviceClient.SetColorAsync(deviceKey, TapoColor.FromHex("#e8d974"));
await deviceClient.SetColorAsync(deviceKey, TapoColor.FromHsl(200, 100, 100));
await deviceClient.SetColorAsync(deviceKey, TapoColor.FromRgb(100, 25, 32));
await deviceClient.SetColorAsync(deviceKey, TapoColor.FromTemperature(3500));

await deviceClient.SetStateAsync(deviceKey, new TapoSetBulbState(
    color: TapoColor.FromTemperature(3800, brightness: 1),
    deviceOn: true));

Disclaimer

This is an unofficial SDK that has no affiliation with TP-Link. TP-Link and all respective product names are copyright TP-Link Technologies Co, Ltd. and/or its subsidiaries and affiliates.

Credits

Credit to this API go to:

Many thanks to @fishbigger, @K4CZP3R, and others involved for reverse enginering TP-link Tapo API in this post.

For more details, @K4CZP3R has a post on the process of reverse enginering the API.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.0 1,924 2/17/2024
3.0.0 393 9/14/2023
2.4.0 215 7/17/2023
2.3.2 403 11/9/2022
2.3.1 349 11/8/2022
2.3.0 350 11/8/2022
2.2.0 337 11/7/2022
2.1.0 362 11/2/2022
2.0.0 334 11/2/2022