Added option to activate computer through mqtt
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:
@@ -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() {}
|
||||
|
||||
Reference in New Issue
Block a user