aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2018-05-25 00:36:41 -0400
committerBen Burwell <ben@benburwell.com>2018-05-25 00:36:41 -0400
commitdfea3cd5a56047512f56658af42d2bb9ee791e4a (patch)
tree65784a78f70d6d60533524e01cf6cf58a958a533 /main.go
parent93649031c575e54b59407873f29d6fa12aa93d53 (diff)
Enable adjusting transition timeHEADmaster
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/main.go b/main.go
index e279d0f..49ed9f9 100644
--- a/main.go
+++ b/main.go
@@ -19,6 +19,7 @@ func main() {
flag.Float64Var(&config.Latitude, "latitude", config.Latitude, "Latitude (used to calculate sunrise and sunset)")
flag.Float64Var(&config.Longitude, "longitude", config.Longitude, "Longitude (used to calculate sunrise and sunset)")
flag.Int64Var(&config.Interval, "interval", config.Interval, "Interval (in seconds) at which to run the update if --forever is set")
+ flag.StringVar(&config.TransitionTime, "transitionTime", config.TransitionTime, "Transition time for adjusting the color temperature")
forever := flag.Bool("forever", false, "Run the update every [interval], use Ctrl-C to cancel")
flag.Parse()
@@ -107,20 +108,21 @@ func updateBridge(bridge *hue.Bridge, ct ColorTemperature, config *PhluxConfig)
}
log.Printf("Found %d lights\n", len(lights))
for _, light := range lights {
- updateLight(light, ct)
+ updateLight(light, ct, config)
}
return nil
}
-func updateLight(light hue.Light, ct ColorTemperature) {
+func updateLight(light hue.Light, ct ColorTemperature, config *PhluxConfig) {
log.Printf("Light %d: %s (%s)\n", light.Index, light.Name, light.Type)
if supportsColorTemp(light) {
log.Printf(" CT range: %d-%d\n", light.Capabilities.Control.CT.Min, light.Capabilities.Control.CT.Max)
newCt := ct.TranslateForLight(light)
log.Printf(" Setting CT to %d\n", newCt)
light.SetState(hue.LightState{
- On: light.State.On,
- CT: newCt,
+ On: light.State.On,
+ CT: newCt,
+ TransitionTime: config.TransitionTime,
})
}
}