Device init was moved to sendCommand
This commit is contained in:
@@ -19,6 +19,13 @@ func sendCommand(n *noolite.NooliteAdapter, command string, channel, value, r, g
|
||||
return errors.New("Command was not set")
|
||||
}
|
||||
|
||||
n, err := noolite.DefaultNooliteAdapter()
|
||||
defer n.Close()
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if command == "set" {
|
||||
if value != 0 {
|
||||
return n.SetBrightnesValue(channel, value)
|
||||
@@ -86,14 +93,6 @@ func main() {
|
||||
|
||||
flag.Parse()
|
||||
|
||||
n, err := noolite.DefaultNooliteAdapter()
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
defer n.Close()
|
||||
|
||||
if *http_port < 0 {
|
||||
err := sendCommand(n, *command, *channel, *value, *red, *green, *blue)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user