GithubHelp home page GithubHelp logo

cfunkhouser / kasa Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 85 KB

Library and CLI utility for interacting with tp-link Kasa devices on the local network

License: MIT License

Go 98.05% Makefile 1.95%

kasa's Introduction

kasa

A library and command line utility for interacting with tp-link Kasa devices on your local network.

Command Line

Full kasautil options:

$ kasautil
NAME:
   kasautil - Control Kasa devices on the local network

USAGE:
   kasautil [global options] command [command options] [arguments...]

COMMANDS:
   list, ls  List kasa devices on the local network.
   off       Set a kasa device to "off"
   on        Set a kasa device to "on"
   help, h   Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help (default: false)

You may discover Kasa devices locally with the list command of kasautil.

$ kasautil list
Address          Alias             State
10.24.6.14:9999  ADSL Modem        On
10.23.6.15:9999  Living Room Lamp  On

The only currently-supported control function is setting the relay state on supported devices. To do this, provide the Kasa device's address to the on or off commands of kasautil.

$ kasautil off 10.24.6.14:9999
$ kasautil list
Address          Alias             State
10.24.6.14:9999  ADSL Modem        Off
10.23.6.15:9999  Living Room Lamp  On

Broadcast Issues

Discovery relies on UDP packets sent to a broadcast address. This can fail when the host on which kasautil has many network interfaces or multiple network addresses on a single interface. This is known to happen on Linux with a single interface on multiple VLANs, for example.

In this case, you have two options:

  1. Specify a local address using -L / --local on the correct network from which to send the Kasa request

  2. Specify a device or broadcast address using -d / --device / --discover on the correct network to which the Kasa request should be sent

$ kasautil list -L 10.24.6.15:54321
Address          Alias             State
10.24.6.14:9999  ADSL Modem        On
10.23.6.15:9999  Living Room Lamp  On
$ kasautil list -d 10.24.6.255:9999
Address          Alias             State
10.24.6.14:9999  ADSL Modem        On
10.23.6.15:9999  Living Room Lamp  On

kasa's People

Contributors

cfunkhouser avatar

Stargazers

 avatar Arbal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.