Compare commits

...

2 Commits

Author SHA1 Message Date
1dcfb8a624
Add Breathe struct constructor 2021-03-20 21:24:44 -05:00
52f610489f
Fix breathe endpoint typo 2021-03-20 21:24:06 -05:00
2 changed files with 19 additions and 1 deletions

View File

@ -33,6 +33,6 @@ var (
return BuildURL(Endpoint, fmt.Sprintf("/lights/%s/toggle", selector)) return BuildURL(Endpoint, fmt.Sprintf("/lights/%s/toggle", selector))
} }
EndpointBreathe = func(selector string) string { EndpointBreathe = func(selector string) string {
return BuildURL(Endpoint, fmt.Sprintf("/lights/%s/effect/breathe", selector)) return BuildURL(Endpoint, fmt.Sprintf("/lights/%s/effects/breathe", selector))
} }
) )

View File

@ -98,6 +98,24 @@ type (
} }
) )
var (
DefaultBreatheCycles float64 = 1
DefaultBreathePeriod float64 = 1
DefaultBreathePersist bool = false
DefaultBreathePowerOn bool = true
DefaultBreathePeak float64 = 0.5
)
func NewBreathe() Breathe {
var b Breathe
b.Period = DefaultBreathePeriod
b.Cycles = DefaultBreatheCycles
b.Persist = DefaultBreathePersist
b.PowerOn = DefaultBreathePowerOn
b.Peak = DefaultBreathePeak
return b
}
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