Add method to validate Breathe struct
This commit is contained in:
parent
1dcfb8a624
commit
dbe1c40e16
@ -3,6 +3,7 @@ package lifx
|
|||||||
import (
|
import (
|
||||||
//"crypto/tls"
|
//"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -116,6 +117,13 @@ func NewBreathe() Breathe {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Breathe) Valid() error {
|
||||||
|
if b.Peak < 0 || b.Peak > 1 {
|
||||||
|
return errors.New("peak must be between 0.0 and 1.0")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) SetState(selector string, state State) (*LifxResponse, error) {
|
func (c *Client) SetState(selector string, state State) (*LifxResponse, error) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
|
Loading…
Reference in New Issue
Block a user