All devices are now stored in a central map, part of large refactor
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -47,11 +47,12 @@ func decrypt(data []byte) ([]byte, error) {
|
||||
|
||||
|
||||
type Kasa struct {
|
||||
name string
|
||||
ip string
|
||||
}
|
||||
|
||||
func New(ip string) Kasa {
|
||||
return Kasa{ip}
|
||||
func New(name string, ip string) *Kasa {
|
||||
return &Kasa{name, ip}
|
||||
}
|
||||
|
||||
func (kasa *Kasa) sendCmd(cmd cmd) (reply, error) {
|
||||
@@ -130,3 +131,7 @@ func (kasa *Kasa) GetState() bool {
|
||||
return reply.System.GetSysinfo.RelayState == 1
|
||||
}
|
||||
|
||||
func (kasa *Kasa) GetName() string {
|
||||
return kasa.name
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user