Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bflorian committed Nov 4, 2015
2 parents c416560 + 1ee7680 commit 594b61c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions smartapps/smartthings/hue-connect.src/hue-connect.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ definition(
category: "SmartThings Labs",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/hue.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/[email protected]",
singleInstance: true
singleInstance: true
)

preferences {
Expand Down Expand Up @@ -623,7 +623,8 @@ def off(childDevice) {

def setLevel(childDevice, percent) {
log.debug "Executing 'setLevel'"
def level = Math.min(Math.round(percent * 255 / 100), 255)
def level
if (percent == 1) level = 1 else level = Math.min(Math.round(percent * 255 / 100), 255)
put("lights/${getId(childDevice)}/state", [bri: level, on: percent > 0])
}

Expand All @@ -648,7 +649,7 @@ def setColor(childDevice, huesettings) {

def value = [sat: sat, hue: hue, alert: alert, transitiontime: transition]
if (huesettings.level != null) {
value.bri = Math.min(Math.round(huesettings.level * 255 / 100), 255)
if (huesettings.level == 1) value.bri = 1 else value.bri = Math.min(Math.round(huesettings.level * 255 / 100), 255)
value.on = value.bri > 0
}

Expand Down

0 comments on commit 594b61c

Please sign in to comment.