Added option to activate computer through mqtt
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-12-03 02:15:06 +01:00
parent 51958a0542
commit d42afecd67
4 changed files with 37 additions and 6 deletions

View File

@@ -20,8 +20,17 @@ func NewComputer(macAddress string, name device.InternalName, url string) *compu
return c
}
// device.Basic
var _ device.Basic = (*computer)(nil)
func (c *computer) GetID() device.InternalName {
return device.InternalName(c.name)
}
// device.Activate
var _ device.Activate = (*computer)(nil)
func (c *computer) Activate(state bool) {
if state {
log.Printf("Starting %s\n", c.name)
_, err := http.Get(c.url)
if err != nil {
log.Println(err)
@@ -31,12 +40,6 @@ func (c *computer) Activate(state bool) {
}
}
// device.Basic
var _ device.Basic = (*computer)(nil)
func (c *computer) GetID() device.InternalName {
return device.InternalName(c.name)
}
// google.DeviceInterface
var _ google.DeviceInterface = (*computer)(nil)
func (*computer) IsGoogleDevice() {}