kasa

package module
Version: v0.0.0-...-6988fcc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2019 License: MIT Imports: 10 Imported by: 2

README

Go library for TP-Link HS105 smart plug

Description

Go library for TP-Link HS105 smart plug.

The SmartHome protocol runs on TCP port 9999.

Requirements

言語/FW Version
go 1.11.5

Installing

go get github.com/Pluslab/tplink-api

Usage

import "github.com/Pluslab/tplink-api"

Licence

MIT

Author

Yoshikawa Taiki

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AP

type AP struct {
	SSID    string `json:"ssid,omitempty"`
	KeyType int    `json:"key_type,omitempty"`
}

AP Access Point near the device

func (AP) String

func (ap AP) String() (s string)

type API

type API interface {
	GetDevicesInfo() ([]DeviceInfo, error)
	GetHS100(alias string) (HS100, error)
	GetHS105(alias string) (HS105, error)
	GetHS110(alias string) (HS110, error)
}

API Public interface to get information, devices and interact with them

func Connect

func Connect(username, password string) (API, error)

Connect Create an authenticated API

type DeviceInfo

type DeviceInfo struct {
	SwVer      string  `json:"sw_ver,omitempty"`
	HwVer      string  `json:"hw_ver,omitempty"`
	Type       string  `json:"type,omitempty"`
	Model      string  `json:"model,omitempty"`
	Mac        string  `json:"mac,omitempty"`
	DeviceID   string  `json:"deviceId,omitempty"`
	HwID       string  `json:"hwId,omitempty"`
	FwID       string  `json:"fwId,omitempty"`
	OemID      string  `json:"oemId,omitempty"`
	Alias      string  `json:"alias,omitempty"`
	DeviceName string  `json:"dev_name,omitempty"`
	IconHash   string  `json:"icon_hash,omitempty"`
	ActiveMode string  `json:"active_mode,omitempty"`
	Feature    string  `json:"feature,omitempty"`
	RelayState int     `json:"relay_state,omitempty"`
	OnTime     int     `json:"on_time,omitempty"`
	Updating   int     `json:"updating,omitempty"`
	Rssi       int     `json:"rssi,omitempty"`
	LedOff     int     `json:"led_off,omitempty"`
	Latitude   float64 `json:"latitude,omitempty"`
	Longitude  float64 `json:"longitude,omitempty"`
}

DeviceInfo Get all the information about a device

func (DeviceInfo) String

func (d DeviceInfo) String() string

type HS100

type HS100 SmartPlug

HS100 Allow to interact with the SmartPlug HS100

type HS105

type HS105 SmartPlug

HS105 Allow to interact with the SmartPlug HS105

type HS110

type HS110 SmartPlug

HS110 Allow to interact with the SmartPlug HS110

type SmartPlug

type SmartPlug interface {
	GetAlias() string
	GetInfo() (DeviceInfo, error)
	TurnOn() error
	TurnOff() error
	SwitchOnOff() error
	Reboot() error
	ScanAPs() ([]AP, error)
}

SmartPlug Allow to interact with either the SmartPlug HS100, HS105 and HS110

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL