TapoConnect
Unofficial TP-Link Tapo smart device library for C#.
Install / Use
/learn @cwakefie27/TapoConnectREADME
TapoConnect
Unofficial TP-Link Tapo smart device library for C#.
Tested With
Examples
As of firmware 1.1.0 Build 230721 Rel.224802, KLAP protocol is being used over the secure pass-through protocol. As a result, this API has to attempt to login with one protocol then fallback to the other. By default, KLAP protocol will be used first since it is the new standard.
Build clients to interact with Tapo Cloud or smart device.
TapoCloudClient cloudClient = new TapoCloudClient();
TapoDeviceClient deviceClient = new TapoDeviceClient();
//Specify order of login protocols to try.
TapoDeviceClient deviceClient = new TapoDeviceClient(new List<ITapoDeviceClient>
{
new KlapDeviceClient(),
new SecurePassthroughDeviceClient(),
});
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:
- Ported from: https://github.com/dickydoouk/tp-link-tapo-connect
- Original: https://github.com/fishbigger/TapoP100
- Original:https://github.com/K4CZP3R/tapo-p100-java-poc
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.
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
