kasa

Crates.iokasa
lib.rskasa
version0.6.0
created_at2026-01-11 01:04:26.61014+00
updated_at2026-01-19 22:24:01.535393+00
descriptionCLI for communicating with TP-Link Kasa smart devices
homepage
repositoryhttps://github.com/cmackenzie1/kasa-rs
max_upload_size
id2035038
size89,090
Cole Mackenzie (cmackenzie1)

documentation

README

kasa

A CLI for communicating with TP-Link Kasa smart home devices.

Installation

Using cargo-binstall (recommended)

cargo-binstall provides a convenient way to install pre-built binaries:

cargo binstall kasa

Using cargo install

cargo install kasa

From source

git clone https://github.com/cmackenzie1/kasa-rs.git
cd kasa-rs
cargo install --path crates/kasa

Usage

# 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

Commands

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

Device Commands

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

Broadcast Commands

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.

Options

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]

Supported Devices

The following devices have been tested, but others using the same protocol should work:

  • HS100 - Smart Wi-Fi Plug
  • HS103 - Smart Wi-Fi Plug Lite
  • HS110 - Smart Wi-Fi Plug with Energy Monitoring
  • KP115 - Smart Wi-Fi Plug Slim with Energy Monitoring

License

MIT

Commit count: 72

cargo fmt