| Crates.io | kasa |
| lib.rs | kasa |
| version | 0.6.0 |
| created_at | 2026-01-11 01:04:26.61014+00 |
| updated_at | 2026-01-19 22:24:01.535393+00 |
| description | CLI for communicating with TP-Link Kasa smart devices |
| homepage | |
| repository | https://github.com/cmackenzie1/kasa-rs |
| max_upload_size | |
| id | 2035038 |
| size | 89,090 |
A CLI for communicating with TP-Link Kasa smart home devices.
cargo-binstall provides a convenient way to install pre-built binaries:
cargo binstall kasa
cargo install kasa
git clone https://github.com/cmackenzie1/kasa-rs.git
cd kasa-rs
cargo install --path crates/kasa
# Discover devices on your local network
kasa discover | jq
# Get device info
kasa device 192.168.1.100 info | jq
# Turn on a smart plug
kasa device 192.168.1.100 on
# Turn off a smart plug
kasa device 192.168.1.100 off
# Get energy meter readings (for devices with energy monitoring)
kasa device 192.168.1.100 energy | jq
# Turn off all devices on the network
kasa broadcast off | jq
kasa discover # Discover devices on the local network
kasa device <TARGET> ... # Send commands to a specific device
kasa broadcast ... # Send commands to all devices on the network
kasa version # Show CLI and library versions
| Command | Description |
|---|---|
info |
Get system information |
on |
Turn relay on |
off |
Turn relay off |
energy |
Get real-time energy readings |
energy-reset |
Reset energy meter statistics |
ledon |
Turn LED indicator on |
ledoff |
Turn LED indicator off |
time |
Get device time |
schedule |
Get schedule rules |
countdown |
Get countdown rules |
antitheft |
Get anti-theft rules |
cloudinfo |
Get cloud connection info |
wlanscan |
Scan for wireless networks |
reboot |
Reboot the device |
reset |
Factory reset the device |
runtime-reset |
Reset runtime statistics |
raw <JSON> |
Send a raw JSON command |
The broadcast command sends a command to all discovered devices in parallel. For safety, destructive commands (reset, reboot, energy-reset, runtime-reset, raw) are not available for broadcast.
kasa device <TARGET> [OPTIONS] <COMMAND>
Arguments:
<TARGET> Target hostname or IP address
Options:
-p, --port <PORT> Target port [default: 9999]
--timeout <TIMEOUT> Timeout in seconds [default: 10]
kasa broadcast [OPTIONS] <COMMAND>
Options:
--discovery-timeout <SECS> Discovery timeout in seconds [default: 3]
--timeout <TIMEOUT> Per-device command timeout in seconds [default: 10]
The following devices have been tested, but others using the same protocol should work:
MIT