An unofficial TPLink Tapo API Client written in Go.
Reverse engineered from https://k4czp3r.xyz/blog/post/reverse-engineering-tp-link-tapo
Reference implementation: https://github.com/mihai-dinculescu/tapo
Docs: https://pkg.go.dev/github.com/fabiankachlock/tapo-api
go get github.com/fabiankachlock/tapo-api
package main
import (
"log"
"os"
"github.com/fabiankachlock/tapo-api"
)
func main() {
tapoIp := "192.168.0.2"
tapoEmail := os.Getenv("TAPO_EMAIL")
tapoPass := os.Getenv("TAPO_PASS")
client := tapo.NewClient(tapoEmail, tapoPass)
device, err := client.P115(tapoIp)
if err != nil {
log.Fatalln(err)
}
device.Toggle()
}
Supported Devices:
- P110
- P115 (tested)
- H100 (tested)
- H200
- L900
- L920
- L930 (tested)
- L510
- L520
- L530
- L535 (tested)
- L610
- L630
Supported Protocols:
- KLAP
✅ - Implemented
✓ - Supported by reference implementation in rust
Feature |
GenericDevice |
L510 L520 L610 |
L530 L535 L630 |
L900 |
L920 L930 |
P100 P105 |
P110 P115 |
P300 P304 |
H100 H200 |
---|---|---|---|---|---|---|---|---|---|
device_reset | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
get_child_device_component_list_json | ✓ | ✅* | |||||||
get_child_device_list | ✓ | ✅ | |||||||
get_child_device_list_json | ✓ | ✓ | |||||||
get_current_power | ✅* | ||||||||
get_device_info | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✓ | ✅ |
get_device_info_json | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✓ | ✅ |
get_device_usage | ✅ | ✅ | ✅ | ✅ | ✅ | ✅* | |||
get_energy_data | ✓ | ||||||||
get_energy_usage | ✅* | ||||||||
get_supported_ringtone_list | ✅* | ||||||||
off | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||
on | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||
toggle (go only) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |||
play_alarm | ✅* | ||||||||
refresh_session | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✓ | ✅ |
set_brightness | ✅ | ✅ | ✅ | ✅ | |||||
set_color | ✓ | ✓ | ✓ | ||||||
set_color_temperature | ✅ | ✅ | ✅ | ||||||
set_hue_saturation | ✅ | ✅ | ✅ | ||||||
set_lighting_effect | ✓ | ||||||||
set() API * | ✅ | ✅ | ✅ | ✅ | |||||
stop_alarm | ✅* |
* The set()
API allows multiple properties to be set in a single request.
* Might be outdated or differ to the reference implementation
✅ - Implemented
✓ - Supported by reference implementation in rust
Feature |
KE100 |
S200B |
T100 |
T110 |
T300 |
T310 T315 |
---|---|---|---|---|---|---|
get_device_info * | ✓ | ✓ | ✓ | ✓ | ✅ | ✅ |
get_device_info_json | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
get_temperature_humidity_records | ✓ | |||||
get_trigger_logs | ✓ | ✓ | ✓ | ✓ | ||
set_child_protection | ✓ | |||||
set_frost_protection | ✓ | |||||
set_max_control_temperature | ✓ | |||||
set_min_control_temperature | ✓ | |||||
set_target_temperature | ✓ | |||||
set_temperature_offset | ✓ |
* Obtained by calling get_child_device_list
on the hub device or get_device_info
on a child device handler.