All devices are now stored in a central map, part of large refactor
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-11-18 21:12:09 +01:00
parent 6368fce40d
commit 01b2d492ba
6 changed files with 205 additions and 105 deletions

View File

@@ -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
}