A cross-platform CLI for controlling TP-Link Kasa and Tapo smart home devices via the cloud API. Built in Rust for speed and portability.
brew install piekstra/tap/tplcDownload the latest release for your platform from GitHub Releases.
cargo install --git https://github.com/piekstra/tplink-cloud-cli# Authenticate (interactive prompt with MFA support)
tplc login
# List all devices
tplc devices list
# Turn a device on/off
tplc power on "Living Room Lamp"
tplc power toggle "Porch Light"
# Check power status
tplc power status "Living Room Lamp"tplc login # Interactive login (supports MFA)
tplc logout # Clear stored credentials
tplc status # Check authentication statusCredentials can also be provided via environment variables:
TPLC_USERNAME- TP-Link account emailTPLC_PASSWORD- Account password
Login authenticates with both Kasa and Tapo clouds simultaneously (same TP-Link credentials). Tokens are stored securely in your OS keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service).
tplc devices list # List all devices
tplc devices get "Device Name" # Get device details
tplc devices search "lamp" # Search by partial nametplc power on "Device Name" # Turn on
tplc power off "Device Name" # Turn off
tplc power toggle "Device Name" # Toggle state
tplc power status "Device Name" # Check on/offFor devices with energy monitoring (HS110, KP115, KP125, P110, HS300 outlets):
tplc energy realtime "Device Name" # Current power draw
tplc energy daily "Device Name" # Daily stats (current month)
tplc energy daily "Device Name" --year 2026 --month 1
tplc energy monthly "Device Name" # Monthly stats (current year)
tplc energy summary # All emeter devicesFor light devices (KL430, KL420L5, L530):
tplc light brightness "Strip" 75 # Set brightness (0-100)
tplc light color "Strip" --hue 240 --saturation 100 # Set color
tplc light temp "Strip" 4000 # Color temperature (2500-9000K)
tplc light state "Strip" # Get current statetplc schedule list "Device Name"
tplc schedule add "Device Name" --action on --time 07:00 --days mon,tue,wed,thu,fri
tplc schedule add "Device Name" --action off --sunset
tplc schedule edit "Device Name" RULE_ID --disable
tplc schedule delete "Device Name" RULE_ID
tplc schedule clear "Device Name" # Delete all rulestplc info sysinfo "Device Name" # System information
tplc info network "Device Name" # WiFi info (SSID, signal)
tplc info time "Device Name" # Device clock
tplc led on "Device Name" # Turn indicator LED on
tplc led off "Device Name" # Turn indicator LED offDefault output is JSON (machine-readable). Add --table or -t for human-readable tables:
tplc devices list -t╭──────────────────┬────────┬────────┬───────┬────────┬────────┬───────────────╮
│ NAME │ MODEL │ TYPE │ CLOUD │ STATUS │ EMETER │ DEVICE ID │
├──────────────────┼────────┼────────┼───────┼────────┼────────┼───────────────┤
│ Living Room Lamp │ KP115 │ plug │ kasa │ online │ yes │ 80067B24... │
│ Porch Light │ HS200 │ switch │ kasa │ online │ no │ A3F19C02... │
│ Smart Plug Mini │ P100 │ plug │ tapo │ online │ no │ C2E8A901... │
╰──────────────────┴────────┴────────┴───────┴────────┴────────┴───────────────╯
Errors are output as JSON to stderr with appropriate exit codes:
| Exit code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Authentication error |
| 3 | Device not found |
| 4 | Device offline |
Devices can be referenced by:
- Exact alias (case-sensitive)
- Device ID
- Case-insensitive alias match
- Partial alias match (if unambiguous)
Multi-outlet devices (HS300, KP303, KP400, etc.) expose each outlet as a separate device addressable by its alias. Devices from both Kasa and Tapo clouds are searched automatically.
| Model | Type | Energy monitoring |
|---|---|---|
| HS100, HS103, HS105 | Smart Plug | |
| HS110 | Smart Plug | Yes |
| HS200 | Smart Switch | |
| HS300 | Smart Power Strip (6 outlets) | Yes (per outlet) |
| KP115, KP125 | Smart Plug | Yes |
| KP200, KP400 | Outdoor Plug (2 outlets) | |
| KP303 | Smart Power Strip (3 outlets) | |
| EP40 | Outdoor Plug | |
| KL420L5, KL430 | Smart Light Strip |
| Model | Type | Energy monitoring |
|---|---|---|
| P100 | Mini Smart Wi-Fi Plug | |
| P110 | Mini Smart Wi-Fi Plug | Yes |
| L530 | Smart Wi-Fi Light Bulb |
tplc is designed to be used by AI agents. All commands output structured JSON by default (errors go to stderr), so agents can parse results directly. See CLAUDE.md for skill/plugin integration guidance.
- tplink-cloud-api - Python library this CLI is based on
- Contributing - How to contribute to this project
GPL-3.0 - see LICENSE for details.