Skip to content

Commit

Permalink
Merge pull request SmartThingsCommunity#3662 from SmartThingsCommunit…
Browse files Browse the repository at this point in the history
…y/master

Rolling up master to staging
  • Loading branch information
workingmonk committed Nov 5, 2018
2 parents ebb3e46 + 8a2769d commit c375e3b
Show file tree
Hide file tree
Showing 10 changed files with 435 additions and 128 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,7 @@ def setColor(value) {
def c = value.hex.findAll(/[0-9a-fA-F]{2}/).collect { Integer.parseInt(it, 16) }
result << zwave.switchColorV3.switchColorSet(red: c[0], green: c[1], blue: c[2], warmWhite: 0, coldWhite: 0)
} else {
def hue = value.hue ?: device.currentValue("hue")
def saturation = value.saturation ?: device.currentValue("saturation")
if(hue == null) hue = 13
if(saturation == null) saturation = 13
def rgb = huesatToRGB(hue, saturation)
def rgb = huesatToRGB(value.hue, value.saturation)
result << zwave.switchColorV3.switchColorSet(red: rgb[0], green: rgb[1], blue: rgb[2], warmWhite:0, coldWhite:0)
}
commands(result) + "delay 7000" + commands(queryAllColors(), 1000)
Expand Down
74 changes: 40 additions & 34 deletions devicetypes/smartthings/aeon-led-bulb.src/aeon-led-bulb.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,35 @@ metadata {
simulator {
}

standardTile("switch", "device.switch", width: 1, height: 1, canChangeIcon: true) {
state "on", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#00a0dc", nextState:"turningOff"
state "off", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
state "turningOn", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#00a0dc", nextState:"turningOff"
state "turningOff", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
tiles(scale: 2) {
multiAttributeTile(name:"switch", type: "lighting", width: 1, height: 1, canChangeIcon: true) {
tileAttribute("device.switch", key: "PRIMARY_CONTROL") {
attributeState("on", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#00a0dc", nextState:"turningOff")
attributeState("off", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn")
attributeState("turningOn", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#00a0dc", nextState:"turningOff")
attributeState("turningOff", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn")
}

tileAttribute ("device.level", key: "SLIDER_CONTROL") {
attributeState "level", action:"switch level.setLevel"
}

tileAttribute ("device.color", key: "COLOR_CONTROL") {
attributeState "color", action:"setColor"
}
}
}
standardTile("reset", "device.reset", inactiveLabel: false, decoration: "flat") {

standardTile("reset", "device.reset", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "default", label:"Reset Color", action:"reset", icon:"st.lights.philips.hue-single"
}
standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
}
controlTile("levelSliderControl", "device.level", "slider", height: 1, width: 2, inactiveLabel: false, range:"(0..100)") {
state "level", action:"switch level.setLevel"
}
controlTile("rgbSelector", "device.color", "color", height: 3, width: 3, inactiveLabel: false) {
state "color", action:"color control.setColor"
}
valueTile("level", "device.level", inactiveLabel: false, decoration: "flat") {
state "level", label: 'Level ${currentValue}%'
}
controlTile("colorTempControl", "device.colorTemperature", "slider", height: 1, width: 2, inactiveLabel: false) {
state "colorTemperature", action:"setColorTemperature"
}
valueTile("hue", "device.hue", inactiveLabel: false, decoration: "flat") {
state "hue", label: 'Hue ${currentValue} '

controlTile("colorTempSliderControl", "device.colorTemperature", "slider", width: 4, height: 2, inactiveLabel: false, range:"(2700..6500)") {
state "colorTemperature", action:"color temperature.setColorTemperature"
}

main(["switch"])
details(["switch", "levelSliderControl", "rgbSelector", "reset", "colorTempControl", "refresh"])
details(["switch", "levelSliderControl", "rgbSelector", "colorTempSliderControl", "reset"])
}

def updated() {
Expand Down Expand Up @@ -175,11 +174,7 @@ def setColor(value) {
def c = value.hex.findAll(/[0-9a-fA-F]{2}/).collect { Integer.parseInt(it, 16) }
result << zwave.switchColorV3.switchColorSet(red:c[0], green:c[1], blue:c[2], warmWhite:0, coldWhite:0)
} else {
def hue = value.hue ?: device.currentValue("hue")
def saturation = value.saturation ?: device.currentValue("saturation")
if(hue == null) hue = 13
if(saturation == null) saturation = 13
def rgb = huesatToRGB(hue, saturation)
def rgb = huesatToRGB(value.hue, value.saturation)
result << zwave.switchColorV3.switchColorSet(red: rgb[0], green: rgb[1], blue: rgb[2], warmWhite:0, coldWhite:0)
}

Expand All @@ -191,16 +186,27 @@ def setColor(value) {
commands(result)
}

def setColorTemperature(percent) {
if(percent > 99) percent = 99
int warmValue = percent * 255 / 99
command(zwave.switchColorV3.switchColorSet(red:0, green:0, blue:0, warmWhite:warmValue, coldWhite:(255 - warmValue)))
private getCOLOR_TEMP_MAX() { 6500 }
private getCOLOR_TEMP_MIN() { 2700 }
private getCOLOR_TEMP_DIFF() { COLOR_TEMP_MAX - COLOR_TEMP_MIN }

def setColorTemperature(temp) {
if(temp > COLOR_TEMP_MAX)
temp = COLOR_TEMP_MAX
else if(temp < COLOR_TEMP_MIN)
temp = COLOR_TEMP_MIN
log.debug "setColorTemperature($temp)"
def warmValue = ((COLOR_TEMP_MAX - temp) / COLOR_TEMP_DIFF * 255) as Integer
def coldValue = 255 - warmValue
def cmds = [zwave.switchColorV3.switchColorSet(red: 0, green: 0, blue: 0, warmWhite: warmValue, coldWhite: coldValue)]
cmds += queryAllColors()
commands(cmds)
}

def reset() {
log.debug "reset()"
sendEvent(name: "color", value: "#ffffff")
setColorTemperature(99)
setColorTemperature(COLOR_TEMP_MAX)
}

private command(physicalgraph.zwave.Command cmd) {
Expand Down
43 changes: 6 additions & 37 deletions devicetypes/smartthings/rgbw-light.src/rgbw-light.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,7 @@ def setColor(value) {
def c = value.hex.findAll(/[0-9a-fA-F]{2}/).collect { Integer.parseInt(it, 16) }
result << zwave.switchColorV3.switchColorSet(red:c[0], green:c[1], blue:c[2], warmWhite:0, coldWhite:0)
} else {
def hue = value.hue ?: device.currentValue("hue")
def saturation = value.saturation ?: device.currentValue("saturation")
if(hue == null) hue = 13
if(saturation == null) saturation = 13
def rgb = huesatToRGB(hue, saturation)
def rgb = huesatToRGB(value.hue, value.saturation)
result << zwave.switchColorV3.switchColorSet(red: rgb[0], green: rgb[1], blue: rgb[2], warmWhite:0, coldWhite:0)
}
result += queryAllColors()
Expand Down Expand Up @@ -296,39 +292,12 @@ private commands(commands, delay=200) {
}

def rgbToHSV(red, green, blue) {
float r = red / 255f
float g = green / 255f
float b = blue / 255f
float max = [r, g, b].max()
float delta = max - [r, g, b].min()
def hue = 13
def saturation = 0
if (max && delta) {
saturation = 100 * delta / max
if (r == max) {
hue = ((g - b) / delta) * 100 / 6
} else if (g == max) {
hue = (2 + (b - r) / delta) * 100 / 6
} else {
hue = (4 + (r - g) / delta) * 100 / 6
}
}
[hue: hue, saturation: saturation, value: max * 100]
def hex = colorUtil.rgbToHex(red as int, green as int, blue as int)
def hsv = colorUtil.hexToHsv(hex)
return [hue: hsv[0], saturation: hsv[1], value: hsv[2]]
}

def huesatToRGB(hue, sat) {
while(hue >= 100) hue -= 100
int h = (int)(hue / 100 * 6)
float f = hue / 100 * 6 - h
int p = Math.round(255 * (1 - (sat / 100)))
int q = Math.round(255 * (1 - (sat / 100) * f))
int t = Math.round(255 * (1 - (sat / 100) * (1 - f)))
switch (h) {
case 0: return [255, t, p]
case 1: return [q, 255, p]
case 2: return [p, 255, t]
case 3: return [p, q, 255]
case 4: return [t, p, 255]
case 5: return [255, p, q]
}
def color = colorUtil.hsvToHex(Math.round(hue) as int, Math.round(sat) as int)
return colorUtil.hexToRgb(color)
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ metadata {
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008", outClusters: "0019", manufacturer: "LDS", model: "ZHA-DIMLight-GLS0000", deviceJoinName: "A60 Dim Bulb"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0019", manufacturer: "LDS", model: "ZBT-DIMLight-GLS", deviceJoinName: "A60 Dim Bulb"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0009", outClusters: "0019", manufacturer: "Aurora", model: "FWMPROZXBulb50AU", deviceJoinName: "Aurora MPro"
fingerprint profileId: "0104", inClusters: "0000, 0004, 0003, 0006, 0008, 0005, FFFF, 1000", outClusters: "0019", manufacturer: "Aurora", model: "FWBulb51AU", deviceJoinName: "Aurora Smart Dimmable"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B05, 1000, FEDC", outClusters: "0019", manufacturer: "Aurora", model: "FWGU10Bulb50AU", deviceJoinName: "Aurora Smart Dimmable GU10"

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ metadata {
command "childOn", ["string"]
command "childOff", ["string"]

fingerprint profileId: "0104", inClusters: "0000, 0005, 0004, 0006", outClusters: "0000", manufacturer: "ORVIBO", model: "074b3ffba5a045b7afd94c47079dd553", deviceJoinName: "Orvibo Smart Switch 1"
fingerprint profileId: "0104", inClusters: "0000, 0005, 0004, 0006", outClusters: "0000", manufacturer: "ORVIBO", model: "074b3ffba5a045b7afd94c47079dd553", deviceJoinName: "Switch 1"
}
// simulator metadata
simulator {
Expand Down
10 changes: 6 additions & 4 deletions devicetypes/smartthings/zigbee-valve.src/zigbee-valve.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def parse(String description) {
else if(event.value == "off") {
event.value = "closed"
}
} else if (event.name == "powerSource") {
event.value = event.value.toLowerCase()
}
sendEvent(event)
//handle valve attribute
Expand All @@ -92,16 +94,16 @@ def parse(String description) {
if (descMap.clusterInt == CLUSTER_BASIC && descMap.attrInt == BASIC_ATTR_POWER_SOURCE){
def value = descMap.value
if (value == "01" || value == "02") {
sendEvent(name: "powerSource", value: "Mains")
sendEvent(name: "powerSource", value: "mains")
}
else if (value == "03") {
sendEvent(name: "powerSource", value: "Battery")
sendEvent(name: "powerSource", value: "battery")
}
else if (value == "04") {
sendEvent(name: "powerSource", value: "DC")
sendEvent(name: "powerSource", value: "dc")
}
else {
sendEvent(name: "powerSource", value: "Unknown")
sendEvent(name: "powerSource", value: "unknown")
}
}
else if (descMap.clusterInt == CLUSTER_POWER && descMap.attrInt == POWER_ATTR_BATTERY_PERCENTAGE_REMAINING) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ metadata {
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY Under Cabinet TW", deviceJoinName: "SYLVANIA Smart Under Cabinet TW"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B05, FC01", outClusters: "0019", manufacturer: "LEDVANCE", model: "BR30 TW", deviceJoinName: "SYLVANIA Smart+ Adustable White BR30"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B05, FC01", outClusters: "0019", manufacturer: "LEDVANCE", model: "RT TW", deviceJoinName: "SYLVANIA Smart+ Adustable White RT5/6"
fingerprint profileId: "0104", inClusters: "0000, 0004, 0003, 0006, 0008, 0005, 0300, FFFF, FFFF, 1000", outClusters: "0019", manufacturer: "Aurora", model: "TWBulb51AU", deviceJoinName: "Aurora Smart Tunable White"

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ metadata {
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008", outClusters: "0019", manufacturer: "innr", model: "RB 175 W", deviceJoinName: "innr Smart Bulb (Warm Dimming)"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0702, 0B05", outClusters: "0019", manufacturer: "sengled", model: "E14-U43", deviceJoinName: "Sengled E14-U43"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008", outClusters: "0019", manufacturer: "innr", model: "RB 145", deviceJoinName: "innr Smart Candle"
fingerprint profileId: "0104", inClusters: "0000, 0004, 0003, 0006, 0008, 0005, FFFF, 1000", outClusters: "0019", manufacturer: "Aurora", model: "FWBulb51AU", deviceJoinName: "Aurora Smart Dimmable"

}

Expand Down
Loading

0 comments on commit c375e3b

Please sign in to comment.