plugctl

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

plugctl

Library for controlling Kasa switches

Documentation

Overview

Package plugctl provides an API for controlling Kasa smart home switches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plug

type Plug struct {
	Addr string
}

Plug provides an API for a single Kasa smart home plug or switch.

func (*Plug) RelayState

func (p *Plug) RelayState() (bool, error)

RelayState reports whether the plug is currently on.

func (*Plug) SetRelayState

func (p *Plug) SetRelayState(on bool) error

SetRelayState turns the plug on or off.

func (*Plug) SysInfo

func (p *Plug) SysInfo() (*SysInfo, error)

SysInfo gets the system information from the plug.

func (*Plug) TurnOff

func (p *Plug) TurnOff() error

TurnOff turns the plug off.

func (*Plug) TurnOn

func (p *Plug) TurnOn() error

TurnOn turns the plug on.

type SysInfo

type SysInfo struct {
	SWVer      string `json:"sw_ver,omitempty"`      // e.g. "1.0.3 Build 210506 Rel.105435",
	HWVer      string `json:"hw_ver,omitempty"`      // e.g. "1.0",
	Model      string `json:"model,omitempty"`       // e.g. "KP105(AU)",
	DeviceID   string `json:"deviceId,omitempty"`    // e.g. "8006CF0E89296D2A5BFBDE11C844BB2B1E2D2B7C",
	OEMID      string `json:"oemId,omitempty"`       // e.g. "EAB15315847573797920EFE7E9000562",
	HWID       string `json:"hwId,omitempty"`        // e.g. "120EF751A1A4F170831E6C1F57D97B38",
	RSSI       int    `json:"rssi,omitempty"`        // e.g. -58,
	LongitudeI int    `json:"longitude_i,omitempty"` // e.g. 1473005,
	LatitudeI  int    `json:"latitude_i,omitempty"`  // e.g. -428429,
	Alias      string `json:"alias,omitempty"`       // e.g. "Car charger",
	Status     string `json:"status,omitempty"`      // e.g. "new",
	MICType    string `json:"mic_type,omitempty"`    // e.g. "IOT.SMARTPLUGSWITCH",
	Feature    string `json:"feature,omitempty"`     // e.g. "TIM",
	MAC        string `json:"mac,omitempty"`         // e.g. "00:5F:67:01:A5:50",
	Updating   int    `json:"updating,omitempty"`    // e.g. 0,
	LEDOff     int    `json:"led_off,omitempty"`     // e.g. 0,
	OBDSrc     string `json:"obd_src,omitempty"`     // e.g. "tplink",
	RelayState int    `json:"relay_state,omitempty"` // e.g. 0,
	OnTime     int    `json:"on_time,omitempty"`     // e.g. 0,
	ActiveMode string `json:"active_mode,omitempty"` // e.g. "schedule",
	IconHash   string `json:"icon_hash,omitempty"`   // e.g. "",
	DevName    string `json:"dev_name,omitempty"`    // e.g. "Smart Wi-Fi Plug",
	NextAction struct {
		Type int `json:"type,omitempty"`
	} `json:"next_action,omitempty"` // e.g. {"type": -1},
	NTCState int `json:"ntc_state,omitempty"` // e.g. 0,
	ErrCode  int `json:"err_code,omitempty"`  // e.g. 0
}

Directories

Path Synopsis
cmd
plugctl
The plugctl command provides manual CLI control over a Kasa KP105 smart plug.
The plugctl command provides manual CLI control over a Kasa KP105 smart plug.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL