Skip to content

Commit

Permalink
Fix device names and minimum color temperature calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanwichmann committed Apr 5, 2019
1 parent e6fb2c1 commit ec2dd2d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions huelight.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import (
hue "github.com/stefanwichmann/go.hue"
)

var lightsSupportingDimming = []string{"Dimmable Light", "Color Temperature Light", "Color Light", "Extended Color Light"}
var lightsSupportingColorTemperature = []string{"Color Temperature Light", "Extended Color Light"}
var lightsSupportingXYColor = []string{"Color Light", "Extended Color Light"}
var lightsSupportingDimming = []string{"Dimmable light", "Color temperature light", "Color light", "Extended color light"}
var lightsSupportingColorTemperature = []string{"Color temperature light", "Extended color light"}
var lightsSupportingXYColor = []string{"Color light", "Extended color light"}

// HueLight represents a physical hue light.
type HueLight struct {
Expand Down Expand Up @@ -63,10 +63,12 @@ func (light *HueLight) initialize(attr hue.LightAttributes) {
light.SupportsXYColor = containsString(lightsSupportingXYColor, attr.Type)

// set minimum color temperature depending on type
if attr.Type == "Color Temperature Light" {
if attr.Type == "Color temperature light" {
light.MinimumColorTemperature = 2200
} else if light.SupportsXYColor || light.SupportsColorTemperature {
} else if light.SupportsXYColor {
light.MinimumColorTemperature = 1000
} else if light.SupportsColorTemperature {
light.MinimumColorTemperature = 2000
} else {
light.MinimumColorTemperature = 0
}
Expand Down

0 comments on commit ec2dd2d

Please sign in to comment.