https://github.com/ivanbeldad/kasa-go
Go library to remotely control TP-Link devices using their cloud web service so they can be controlled from outside the network
https://github.com/ivanbeldad/kasa-go
golang kasa smart-plug tp-link
Last synced: 5 months ago
JSON representation
Go library to remotely control TP-Link devices using their cloud web service so they can be controlled from outside the network
- Host: GitHub
- URL: https://github.com/ivanbeldad/kasa-go
- Owner: ivanbeldad
- License: mit
- Created: 2018-06-06T19:15:00.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-10-04T20:24:42.000Z (over 3 years ago)
- Last Synced: 2025-12-23T06:44:12.772Z (6 months ago)
- Topics: golang, kasa, smart-plug, tp-link
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 30
- Watchers: 2
- Forks: 13
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kasa Go
[](https://github.com/ivanbeldad/kasa-go)
[](https://github.com/ivanbeldad/kasa-go/blob/master/LICENSE)
Go library to remotely control TP-Link devices using their cloud web service so they can be
controlled from outside the network.
## Installation
```
go get github.com/ivanbeldad/kasa-go
```
## Devices Supported
| Device | Type |
| :--- | :--- |
| HS100 | Smart Plug |
| HS103 | Smart Plug |
| HS110 | Smart Plug |
| HS200 | Smart Light Switch |
### Smart Plugs
| Method | Description |
| :--- | :--- |
| GetInfo | Get information about the smart plug |
| TurnOn | Turn on the device |
| TurnOff | Turn off the device |
| SwitchOnOff | Change the state of the device |
| Reboot | Power off the device and power on after a few seconds |
| GetAlias | Get the name of the device |
| ScanAPs | Scan near access points and return info about them |
## Example
```go
api, err := kasa.Connect("tplink@mail.com", "myStrongPassword")
if err != nil {
log.Fatal(err)
}
hs100, err := api.GetHS100("livingroom")
if err != nil {
log.Fatal(err)
}
err = hs100.TurnOn()
if err != nil {
log.Fatal(err)
}
fmt.Print("Living Room turned on successfully!")
```
## License
Kasa Go is open-sourced software licensed under
the [MIT license](https://github.com/ivanbeldad/kasa-go/blob/master/LICENSE).