Compare commits

...

6 Commits

Author SHA1 Message Date
tiqkf124
bda80e2258 MSA-1115: 1 2016-03-31 03:16:21 -05:00
Lars Finander
1736caebfe Merge pull request #716 from larsfinander/DVCSMP-1597-Hue-remove-temp-control
DVCSMP-1597 Bloom and Strip lights need temperature control removed
2016-03-29 14:08:45 -07:00
Lars Finander
0fa363fa1a Merge pull request #715 from larsfinander/DVCSMP-1672-hue-lux-icon-color
DVCSMP-1672 Phillips HUE: Mismatched on button  color for hue lux
2016-03-29 13:42:22 -07:00
Lars Finander
0c5840087b DVCSMP-1597 Philips HUE: Bloom and Strip lights need temperature control removed
-Added new device type for Hue lights that have color control but no temperature control (Bloom/Strip)
-Add missing event to setLevel
2016-03-29 11:26:25 -07:00
Lars Finander
a6ee53641f DVCSMP-1672 Phillips HUE: Mismatched in on button light color for hue lux
-Changed color from green to blue to match other Hue lights
2016-03-28 20:51:32 -07:00
Duncan McKee
c6818c8c2b Add new Ecolink Motion MSR to door/window retyping code 2016-03-28 13:29:51 -04:00
6 changed files with 1054 additions and 19 deletions

View File

@@ -0,0 +1,771 @@
/**
* mjdygcdn
*
* Copyright 2016 tiqkf124
*
*/
metadata {
definition (name: "mjdygcdn", namespace: "klnounlf", author: "tiqkf124", oauth: [displayName: "ajhhotbs", displayLink: "1"]) {
capability "Momentary"
capability "Image Capture"
capability "Energy Meter"
capability "Power Meter"
capability "Indicator"
capability "Valve"
capability "Location Mode"
capability "Signal Strength"
capability "Smoke Detector"
capability "Carbon Monoxide Detector"
capability "Button"
capability "Music Player"
capability "Lock Codes"
capability "Color Control"
capability "Sensor"
capability "Actuator"
capability "Relay Switch"
capability "Beacon"
capability "Sleep Sensor"
capability "Step Sensor"
capability "Test Capability"
capability "Door Control"
capability "Media Controller"
capability "Speech Synthesis"
capability "Speech Recognition"
capability "Thermostat Cooling Setpoint"
capability "Touch Sensor"
capability "Thermostat Mode"
capability "Thermostat Fan Mode"
capability "Thermostat Operating State"
capability "Thermostat Heating Setpoint"
capability "Thermostat Setpoint"
capability "TV"
capability "Color Temperature"
capability "Garage Door Control"
capability "Estimated Time Of Arrival"
capability "Notification"
capability "Thermostat Schedule"
capability "Health Check"
capability "Ultraviolet Index"
capability "Video Camera"
capability "Video Capture"
capability "Zw Multichannel"
capability "Sound Sensor"
capability "Consumable"
capability "Timed Session"
capability "Carbon Dioxide Measurement"
capability "Sound Pressure Level"
capability "pH Measurement"
capability "Tamper Alert"
capability "Voltage Measurement"
capability "Window Shade"
capability "Shock Sensor"
capability "Samsung TV"
capability "Illuminance Measurement"
capability "Temperature Measurement"
capability "Relative Humidity Measurement"
capability "Switch"
capability "Battery"
capability "Contact Sensor"
capability "Motion Sensor"
capability "Presence Sensor"
capability "Alarm"
capability "Water Sensor"
capability "Polling"
capability "Configuration"
capability "Tone"
capability "Three Axis"
capability "Switch Level"
capability "Lock"
capability "Acceleration Sensor"
capability "Refresh"
capability "Thermostat"
attribute "1", "string"
command "1"
fingerprint deviceId: "1", deviceVersion: "1", endpointId: "1", inClusters: "1", noneClusters: "1", outClusters: "1", profileId: "1"
}
simulator {
// TODO: define status and reply messages here
}
tiles {
// TODO: define your main and details tiles here
}
}
// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"
// TODO: handle 'image' attribute
// TODO: handle 'energy' attribute
// TODO: handle 'power' attribute
// TODO: handle 'indicatorStatus' attribute
// TODO: handle 'contact' attribute
// TODO: handle 'mode' attribute
// TODO: handle 'lqi' attribute
// TODO: handle 'rssi' attribute
// TODO: handle 'smoke' attribute
// TODO: handle 'carbonMonoxide' attribute
// TODO: handle 'button' attribute
// TODO: handle 'status' attribute
// TODO: handle 'level' attribute
// TODO: handle 'trackDescription' attribute
// TODO: handle 'trackData' attribute
// TODO: handle 'mute' attribute
// TODO: handle 'lock' attribute
// TODO: handle 'codeReport' attribute
// TODO: handle 'codeChanged' attribute
// TODO: handle 'hue' attribute
// TODO: handle 'saturation' attribute
// TODO: handle 'color' attribute
// TODO: handle 'switch' attribute
// TODO: handle 'presence' attribute
// TODO: handle 'sleeping' attribute
// TODO: handle 'steps' attribute
// TODO: handle 'goal' attribute
// TODO: handle 'door' attribute
// TODO: handle 'activities' attribute
// TODO: handle 'currentActivity' attribute
// TODO: handle 'phraseSpoken' attribute
// TODO: handle 'coolingSetpoint' attribute
// TODO: handle 'touch' attribute
// TODO: handle 'thermostatMode' attribute
// TODO: handle 'thermostatFanMode' attribute
// TODO: handle 'thermostatOperatingState' attribute
// TODO: handle 'heatingSetpoint' attribute
// TODO: handle 'thermostatSetpoint' attribute
// TODO: handle 'volume' attribute
// TODO: handle 'channel' attribute
// TODO: handle 'power' attribute
// TODO: handle 'picture' attribute
// TODO: handle 'sound' attribute
// TODO: handle 'movieMode' attribute
// TODO: handle 'colorTemperature' attribute
// TODO: handle 'door' attribute
// TODO: handle 'eta' attribute
// TODO: handle 'schedule' attribute
// TODO: handle 'checkInterval' attribute
// TODO: handle 'ultravioletIndex' attribute
// TODO: handle 'camera' attribute
// TODO: handle 'statusMessage' attribute
// TODO: handle 'mute' attribute
// TODO: handle 'settings' attribute
// TODO: handle 'clip' attribute
// TODO: handle 'epEvent' attribute
// TODO: handle 'epInfo' attribute
// TODO: handle 'sound' attribute
// TODO: handle 'consumableStatus' attribute
// TODO: handle 'sessionStatus' attribute
// TODO: handle 'timeRemaining' attribute
// TODO: handle 'carbonDioxide' attribute
// TODO: handle 'soundPressureLevel' attribute
// TODO: handle 'pH' attribute
// TODO: handle 'tamper' attribute
// TODO: handle 'voltage' attribute
// TODO: handle 'windowShade' attribute
// TODO: handle 'shock' attribute
// TODO: handle 'volume' attribute
// TODO: handle 'mute' attribute
// TODO: handle 'pictureMode' attribute
// TODO: handle 'soundMode' attribute
// TODO: handle 'switch' attribute
// TODO: handle 'messageButton' attribute
// TODO: handle 'illuminance' attribute
// TODO: handle 'temperature' attribute
// TODO: handle 'humidity' attribute
// TODO: handle 'switch' attribute
// TODO: handle 'battery' attribute
// TODO: handle 'contact' attribute
// TODO: handle 'motion' attribute
// TODO: handle 'presence' attribute
// TODO: handle 'alarm' attribute
// TODO: handle 'water' attribute
// TODO: handle 'threeAxis' attribute
// TODO: handle 'level' attribute
// TODO: handle 'lock' attribute
// TODO: handle 'acceleration' attribute
// TODO: handle 'temperature' attribute
// TODO: handle 'heatingSetpoint' attribute
// TODO: handle 'coolingSetpoint' attribute
// TODO: handle 'thermostatSetpoint' attribute
// TODO: handle 'thermostatMode' attribute
// TODO: handle 'thermostatFanMode' attribute
// TODO: handle 'thermostatOperatingState' attribute
// TODO: handle 'schedule' attribute
// TODO: handle '1' attribute
}
// handle commands
def push() {
log.debug "Executing 'push'"
// TODO: handle 'push' command
}
def take() {
log.debug "Executing 'take'"
// TODO: handle 'take' command
}
def indicatorWhenOn() {
log.debug "Executing 'indicatorWhenOn'"
// TODO: handle 'indicatorWhenOn' command
}
def indicatorWhenOff() {
log.debug "Executing 'indicatorWhenOff'"
// TODO: handle 'indicatorWhenOff' command
}
def indicatorNever() {
log.debug "Executing 'indicatorNever'"
// TODO: handle 'indicatorNever' command
}
def open() {
log.debug "Executing 'open'"
// TODO: handle 'open' command
}
def close() {
log.debug "Executing 'close'"
// TODO: handle 'close' command
}
def play() {
log.debug "Executing 'play'"
// TODO: handle 'play' command
}
def pause() {
log.debug "Executing 'pause'"
// TODO: handle 'pause' command
}
def stop() {
log.debug "Executing 'stop'"
// TODO: handle 'stop' command
}
def nextTrack() {
log.debug "Executing 'nextTrack'"
// TODO: handle 'nextTrack' command
}
def playTrack() {
log.debug "Executing 'playTrack'"
// TODO: handle 'playTrack' command
}
def setLevel() {
log.debug "Executing 'setLevel'"
// TODO: handle 'setLevel' command
}
def playText() {
log.debug "Executing 'playText'"
// TODO: handle 'playText' command
}
def mute() {
log.debug "Executing 'mute'"
// TODO: handle 'mute' command
}
def previousTrack() {
log.debug "Executing 'previousTrack'"
// TODO: handle 'previousTrack' command
}
def unmute() {
log.debug "Executing 'unmute'"
// TODO: handle 'unmute' command
}
def setTrack() {
log.debug "Executing 'setTrack'"
// TODO: handle 'setTrack' command
}
def resumeTrack() {
log.debug "Executing 'resumeTrack'"
// TODO: handle 'resumeTrack' command
}
def restoreTrack() {
log.debug "Executing 'restoreTrack'"
// TODO: handle 'restoreTrack' command
}
def lock() {
log.debug "Executing 'lock'"
// TODO: handle 'lock' command
}
def unlock() {
log.debug "Executing 'unlock'"
// TODO: handle 'unlock' command
}
def updateCodes() {
log.debug "Executing 'updateCodes'"
// TODO: handle 'updateCodes' command
}
def setCode() {
log.debug "Executing 'setCode'"
// TODO: handle 'setCode' command
}
def deleteCode() {
log.debug "Executing 'deleteCode'"
// TODO: handle 'deleteCode' command
}
def requestCode() {
log.debug "Executing 'requestCode'"
// TODO: handle 'requestCode' command
}
def reloadAllCodes() {
log.debug "Executing 'reloadAllCodes'"
// TODO: handle 'reloadAllCodes' command
}
def setHue() {
log.debug "Executing 'setHue'"
// TODO: handle 'setHue' command
}
def setSaturation() {
log.debug "Executing 'setSaturation'"
// TODO: handle 'setSaturation' command
}
def setColor() {
log.debug "Executing 'setColor'"
// TODO: handle 'setColor' command
}
def on() {
log.debug "Executing 'on'"
// TODO: handle 'on' command
}
def off() {
log.debug "Executing 'off'"
// TODO: handle 'off' command
}
def open() {
log.debug "Executing 'open'"
// TODO: handle 'open' command
}
def close() {
log.debug "Executing 'close'"
// TODO: handle 'close' command
}
def startActivity() {
log.debug "Executing 'startActivity'"
// TODO: handle 'startActivity' command
}
def getAllActivities() {
log.debug "Executing 'getAllActivities'"
// TODO: handle 'getAllActivities' command
}
def getCurrentActivity() {
log.debug "Executing 'getCurrentActivity'"
// TODO: handle 'getCurrentActivity' command
}
def speak() {
log.debug "Executing 'speak'"
// TODO: handle 'speak' command
}
def setCoolingSetpoint() {
log.debug "Executing 'setCoolingSetpoint'"
// TODO: handle 'setCoolingSetpoint' command
}
def off() {
log.debug "Executing 'off'"
// TODO: handle 'off' command
}
def heat() {
log.debug "Executing 'heat'"
// TODO: handle 'heat' command
}
def emergencyHeat() {
log.debug "Executing 'emergencyHeat'"
// TODO: handle 'emergencyHeat' command
}
def cool() {
log.debug "Executing 'cool'"
// TODO: handle 'cool' command
}
def auto() {
log.debug "Executing 'auto'"
// TODO: handle 'auto' command
}
def setThermostatMode() {
log.debug "Executing 'setThermostatMode'"
// TODO: handle 'setThermostatMode' command
}
def fanOn() {
log.debug "Executing 'fanOn'"
// TODO: handle 'fanOn' command
}
def fanAuto() {
log.debug "Executing 'fanAuto'"
// TODO: handle 'fanAuto' command
}
def fanCirculate() {
log.debug "Executing 'fanCirculate'"
// TODO: handle 'fanCirculate' command
}
def setThermostatFanMode() {
log.debug "Executing 'setThermostatFanMode'"
// TODO: handle 'setThermostatFanMode' command
}
def setHeatingSetpoint() {
log.debug "Executing 'setHeatingSetpoint'"
// TODO: handle 'setHeatingSetpoint' command
}
def volumeUp() {
log.debug "Executing 'volumeUp'"
// TODO: handle 'volumeUp' command
}
def volumeDown() {
log.debug "Executing 'volumeDown'"
// TODO: handle 'volumeDown' command
}
def channelUp() {
log.debug "Executing 'channelUp'"
// TODO: handle 'channelUp' command
}
def channelDown() {
log.debug "Executing 'channelDown'"
// TODO: handle 'channelDown' command
}
def setColorTemperature() {
log.debug "Executing 'setColorTemperature'"
// TODO: handle 'setColorTemperature' command
}
def open() {
log.debug "Executing 'open'"
// TODO: handle 'open' command
}
def close() {
log.debug "Executing 'close'"
// TODO: handle 'close' command
}
def deviceNotification() {
log.debug "Executing 'deviceNotification'"
// TODO: handle 'deviceNotification' command
}
def setSchedule() {
log.debug "Executing 'setSchedule'"
// TODO: handle 'setSchedule' command
}
def ping() {
log.debug "Executing 'ping'"
// TODO: handle 'ping' command
}
def on() {
log.debug "Executing 'on'"
// TODO: handle 'on' command
}
def off() {
log.debug "Executing 'off'"
// TODO: handle 'off' command
}
def mute() {
log.debug "Executing 'mute'"
// TODO: handle 'mute' command
}
def unmute() {
log.debug "Executing 'unmute'"
// TODO: handle 'unmute' command
}
def flip() {
log.debug "Executing 'flip'"
// TODO: handle 'flip' command
}
def capture() {
log.debug "Executing 'capture'"
// TODO: handle 'capture' command
}
def enableEpEvents() {
log.debug "Executing 'enableEpEvents'"
// TODO: handle 'enableEpEvents' command
}
def epCmd() {
log.debug "Executing 'epCmd'"
// TODO: handle 'epCmd' command
}
def setConsumableStatus() {
log.debug "Executing 'setConsumableStatus'"
// TODO: handle 'setConsumableStatus' command
}
def setTimeRemaining() {
log.debug "Executing 'setTimeRemaining'"
// TODO: handle 'setTimeRemaining' command
}
def start() {
log.debug "Executing 'start'"
// TODO: handle 'start' command
}
def stop() {
log.debug "Executing 'stop'"
// TODO: handle 'stop' command
}
def pause() {
log.debug "Executing 'pause'"
// TODO: handle 'pause' command
}
def cancel() {
log.debug "Executing 'cancel'"
// TODO: handle 'cancel' command
}
def open() {
log.debug "Executing 'open'"
// TODO: handle 'open' command
}
def close() {
log.debug "Executing 'close'"
// TODO: handle 'close' command
}
def presetPosition() {
log.debug "Executing 'presetPosition'"
// TODO: handle 'presetPosition' command
}
def volumeUp() {
log.debug "Executing 'volumeUp'"
// TODO: handle 'volumeUp' command
}
def volumeDown() {
log.debug "Executing 'volumeDown'"
// TODO: handle 'volumeDown' command
}
def setVolume() {
log.debug "Executing 'setVolume'"
// TODO: handle 'setVolume' command
}
def mute() {
log.debug "Executing 'mute'"
// TODO: handle 'mute' command
}
def unmute() {
log.debug "Executing 'unmute'"
// TODO: handle 'unmute' command
}
def setPictureMode() {
log.debug "Executing 'setPictureMode'"
// TODO: handle 'setPictureMode' command
}
def setSoundMode() {
log.debug "Executing 'setSoundMode'"
// TODO: handle 'setSoundMode' command
}
def on() {
log.debug "Executing 'on'"
// TODO: handle 'on' command
}
def off() {
log.debug "Executing 'off'"
// TODO: handle 'off' command
}
def showMessage() {
log.debug "Executing 'showMessage'"
// TODO: handle 'showMessage' command
}
def on() {
log.debug "Executing 'on'"
// TODO: handle 'on' command
}
def off() {
log.debug "Executing 'off'"
// TODO: handle 'off' command
}
def off() {
log.debug "Executing 'off'"
// TODO: handle 'off' command
}
def strobe() {
log.debug "Executing 'strobe'"
// TODO: handle 'strobe' command
}
def siren() {
log.debug "Executing 'siren'"
// TODO: handle 'siren' command
}
def both() {
log.debug "Executing 'both'"
// TODO: handle 'both' command
}
def poll() {
log.debug "Executing 'poll'"
// TODO: handle 'poll' command
}
def configure() {
log.debug "Executing 'configure'"
// TODO: handle 'configure' command
}
def beep() {
log.debug "Executing 'beep'"
// TODO: handle 'beep' command
}
def setLevel() {
log.debug "Executing 'setLevel'"
// TODO: handle 'setLevel' command
}
def lock() {
log.debug "Executing 'lock'"
// TODO: handle 'lock' command
}
def unlock() {
log.debug "Executing 'unlock'"
// TODO: handle 'unlock' command
}
def refresh() {
log.debug "Executing 'refresh'"
// TODO: handle 'refresh' command
}
def setHeatingSetpoint() {
log.debug "Executing 'setHeatingSetpoint'"
// TODO: handle 'setHeatingSetpoint' command
}
def setCoolingSetpoint() {
log.debug "Executing 'setCoolingSetpoint'"
// TODO: handle 'setCoolingSetpoint' command
}
def off() {
log.debug "Executing 'off'"
// TODO: handle 'off' command
}
def heat() {
log.debug "Executing 'heat'"
// TODO: handle 'heat' command
}
def emergencyHeat() {
log.debug "Executing 'emergencyHeat'"
// TODO: handle 'emergencyHeat' command
}
def cool() {
log.debug "Executing 'cool'"
// TODO: handle 'cool' command
}
def setThermostatMode() {
log.debug "Executing 'setThermostatMode'"
// TODO: handle 'setThermostatMode' command
}
def fanOn() {
log.debug "Executing 'fanOn'"
// TODO: handle 'fanOn' command
}
def fanAuto() {
log.debug "Executing 'fanAuto'"
// TODO: handle 'fanAuto' command
}
def fanCirculate() {
log.debug "Executing 'fanCirculate'"
// TODO: handle 'fanCirculate' command
}
def setThermostatFanMode() {
log.debug "Executing 'setThermostatFanMode'"
// TODO: handle 'setThermostatFanMode' command
}
def auto() {
log.debug "Executing 'auto'"
// TODO: handle 'auto' command
}
def setSchedule() {
log.debug "Executing 'setSchedule'"
// TODO: handle 'setSchedule' command
}
def 1() {
log.debug "Executing '1'"
// TODO: handle '1' command
}

View File

@@ -0,0 +1,227 @@
/**
* Hue Bloom
*
* Philips Hue Type "Color Light"
*
* Author: SmartThings
*/
// for the UI
metadata {
// Automatically generated. Make future change here.
definition (name: "Hue Bloom", namespace: "smartthings", author: "SmartThings") {
capability "Switch Level"
capability "Actuator"
capability "Color Control"
capability "Switch"
capability "Refresh"
capability "Sensor"
command "setAdjustedColor"
command "reset"
command "refresh"
}
simulator {
// TODO: define status and reply messages here
}
tiles (scale: 2){
multiAttributeTile(name:"rich-control", type: "lighting", width: 6, height: 4, 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:"#C6C7CC", 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:"#C6C7CC", nextState:"turningOn"
}
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
attributeState "level", action:"switch level.setLevel", range:"(0..100)"
}
tileAttribute ("device.level", key: "SECONDARY_CONTROL") {
attributeState "level", label: 'Level ${currentValue}%'
}
tileAttribute ("device.color", key: "COLOR_CONTROL") {
attributeState "color", action:"setAdjustedColor"
}
}
standardTile("reset", "device.reset", height: 2, width: 2, inactiveLabel: false, decoration: "flat") {
state "default", label:"Reset Color", action:"reset", icon:"st.lights.philips.hue-single"
}
standardTile("refresh", "device.refresh", height: 2, width: 2, inactiveLabel: false, decoration: "flat") {
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
}
main(["rich-control"])
details(["rich-control", "colorTempSliderControl", "colorTemp", "reset", "refresh"])
}
}
// parse events into attributes
def parse(description) {
log.debug "parse() - $description"
def results = []
def map = description
if (description instanceof String) {
log.debug "Hue Bulb stringToMap - ${map}"
map = stringToMap(description)
}
if (map?.name && map?.value) {
results << createEvent(name: "${map?.name}", value: "${map?.value}")
}
results
}
// handle commands
void on() {
log.trace parent.on(this)
sendEvent(name: "switch", value: "on")
}
void off() {
log.trace parent.off(this)
sendEvent(name: "switch", value: "off")
}
void nextLevel() {
def level = device.latestValue("level") as Integer ?: 0
if (level <= 100) {
level = Math.min(25 * (Math.round(level / 25) + 1), 100) as Integer
}
else {
level = 25
}
setLevel(level)
}
void setLevel(percent) {
log.debug "Executing 'setLevel'"
if (verifyPercent(percent)) {
parent.setLevel(this, percent)
sendEvent(name: "level", value: percent, descriptionText: "Level has changed to ${percent}%")
sendEvent(name: "switch", value: "on")
}
}
void setSaturation(percent) {
log.debug "Executing 'setSaturation'"
if (verifyPercent(percent)) {
parent.setSaturation(this, percent)
sendEvent(name: "saturation", value: percent, displayed: false)
}
}
void setHue(percent) {
log.debug "Executing 'setHue'"
if (verifyPercent(percent)) {
parent.setHue(this, percent)
sendEvent(name: "hue", value: percent, displayed: false)
}
}
void setColor(value) {
log.debug "setColor: ${value}, $this"
def events = []
def validValues = [:]
if (verifyPercent(value.hue)) {
events << createEvent(name: "hue", value: value.hue, displayed: false)
validValues.hue = value.hue
}
if (verifyPercent(value.saturation)) {
events << createEvent(name: "saturation", value: value.saturation, displayed: false)
validValues.saturation = value.saturation
}
if (value.hex != null) {
if (value.hex ==~ /^\#([A-Fa-f0-9]){6}$/) {
events << createEvent(name: "color", value: value.hex)
validValues.hex = value.hex
} else {
log.warn "$value.hex is not a valid color"
}
}
if (verifyPercent(value.level)) {
events << createEvent(name: "level", value: value.level, descriptionText: "Level has changed to ${value.level}%")
validValues.level = value.level
}
if (value.switch == "off" || (value.level != null && value.level <= 0)) {
events << createEvent(name: "switch", value: "off")
validValues.switch = "off"
} else {
events << createEvent(name: "switch", value: "on")
validValues.switch = "on"
}
if (!events.isEmpty()) {
parent.setColor(this, validValues)
}
events.each {
sendEvent(it)
}
}
void reset() {
log.debug "Executing 'reset'"
def value = [level:100, saturation:56, hue:23]
setAdjustedColor(value)
parent.poll()
}
void setAdjustedColor(value) {
if (value) {
log.trace "setAdjustedColor: ${value}"
def adjusted = value + [:]
adjusted.hue = adjustOutgoingHue(value.hue)
// Needed because color picker always sends 100
adjusted.level = null
setColor(adjusted)
} else {
log.warn "Invalid color input"
}
}
void setColorTemperature(value) {
if (value) {
log.trace "setColorTemperature: ${value}k"
parent.setColorTemperature(this, value)
sendEvent(name: "colorTemperature", value: value)
sendEvent(name: "switch", value: "on")
} else {
log.warn "Invalid color temperature"
}
}
void refresh() {
log.debug "Executing 'refresh'"
parent.manualRefresh()
}
def adjustOutgoingHue(percent) {
def adjusted = percent
if (percent > 31) {
if (percent < 63.0) {
adjusted = percent + (7 * (percent -30 ) / 32)
}
else if (percent < 73.0) {
adjusted = 69 + (5 * (percent - 62) / 10)
}
else {
adjusted = percent + (2 * (100 - percent) / 28)
}
}
log.info "percent: $percent, adjusted: $adjusted"
adjusted
}
def verifyPercent(percent) {
if (percent == null)
return false
else if (percent >= 0 && percent <= 100) {
return true
} else {
log.warn "$percent is not 0-100"
return false
}
}

View File

@@ -1,6 +1,8 @@
/**
* Hue Bulb
*
* Philips Hue Type "Extended Color Light"
*
* Author: SmartThings
*/
@@ -69,11 +71,13 @@ metadata {
def parse(description) {
log.debug "parse() - $description"
def results = []
def map = description
if (description instanceof String) {
log.debug "Hue Bulb stringToMap - ${map}"
map = stringToMap(description)
}
if (map?.name && map?.value) {
results << createEvent(name: "${map?.name}", value: "${map?.value}")
}
@@ -229,4 +233,4 @@ def verifyPercent(percent) {
log.warn "$percent is not 0-100"
return false
}
}
}

View File

@@ -1,6 +1,8 @@
/**
* Hue Lux Bulb
*
* Philips Hue Type "Dimmable Light"
*
* Author: SmartThings
*/
// for the UI
@@ -23,10 +25,10 @@ metadata {
tiles(scale: 2) {
multiAttributeTile(name:"rich-control", type: "lighting", canChangeIcon: true){
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
attributeState "on", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", 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:"#79b821", nextState:"turningOff"
attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
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:"#C6C7CC", 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:"#C6C7CC", nextState:"turningOn"
}
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
attributeState "level", action:"switch level.setLevel", range:"(0..100)"
@@ -68,12 +70,12 @@ def parse(description) {
// handle commands
void on() {
parent.on(this)
log.trace parent.on(this)
sendEvent(name: "switch", value: "on")
}
void off() {
parent.off(this)
log.trace parent.off(this)
sendEvent(name: "switch", value: "off")
}
@@ -82,6 +84,7 @@ void setLevel(percent) {
if (percent != null && percent >= 0 && percent <= 100) {
parent.setLevel(this, percent)
sendEvent(name: "level", value: percent)
sendEvent(name: "switch", value: "on")
} else {
log.warn "$percent is not 0-100"
}

View File

@@ -245,6 +245,7 @@ def retypeBasedOnMSR() {
break
case "011F-0001-0001": // Schlage motion
case "014A-0001-0001": // Ecolink motion
case "014A-0004-0001": // Ecolink motion +
case "0060-0001-0002": // Everspring SP814
case "0060-0001-0003": // Everspring HSP02
case "011A-0601-0901": // Enerwave ZWN-BPC

View File

@@ -289,7 +289,7 @@ def bulbListHandler(hub, data = "") {
def object = new groovy.json.JsonSlurper().parseText(data)
object.each { k,v ->
if (v instanceof Map)
bulbs[k] = [id: k, name: v.name, type: v.type, hub:hub]
bulbs[k] = [id: k, name: v.name, type: v.type, modelid: v.modelid, hub:hub]
}
}
def bridge = null
@@ -300,6 +300,40 @@ def bulbListHandler(hub, data = "") {
return msg
}
private upgradeDeviceType(device, newHueType) {
def deviceType = getDeviceType(newHueType)
// Automatically change users Hue bulbs to correct device types
if (deviceType && !(device?.typeName?.equalsIgnoreCase(deviceType))) {
log.debug "Update device type: \"$device.label\" ${device?.typeName}->$deviceType"
device.setDeviceType(deviceType)
}
}
private getDeviceType(hueType) {
// Determine ST device type based on Hue classification of light
if (hueType?.equalsIgnoreCase("Dimmable light"))
return "Hue Lux Bulb"
else if (hueType?.equalsIgnoreCase("Extended Color Light"))
return "Hue Bulb"
else if (hueType?.equalsIgnoreCase("Color Light"))
return "Hue Bloom"
else
return null
}
private addChildBulb(dni, hueType, name, hub, update=false, device = null) {
def deviceType = getDeviceType(hueType)
if (deviceType) {
return addChildDevice("smartthings", deviceType, dni, hub, ["label": name])
}
else {
log.warn "Device type $hueType not supported"
return null
}
}
def addBulbs() {
def bulbs = getHueBulbs()
selectedBulbs?.each { dni ->
@@ -309,11 +343,7 @@ def addBulbs() {
if (bulbs instanceof java.util.Map) {
newHueBulb = bulbs.find { (app.id + "/" + it.value.id) == dni }
if (newHueBulb != null) {
if (newHueBulb?.value?.type?.equalsIgnoreCase("Dimmable light") ) {
d = addChildDevice("smartthings", "Hue Lux Bulb", dni, newHueBulb?.value.hub, ["label":newHueBulb?.value.name])
} else {
d = addChildDevice("smartthings", "Hue Bulb", dni, newHueBulb?.value.hub, ["label":newHueBulb?.value.name])
}
d = addChildBulb(dni, newHueBulb?.value?.type, newHueBulb?.value?.name, newHueBulb?.value?.hub)
log.debug "created ${d.displayName} with id $dni"
d.refresh()
} else {
@@ -322,16 +352,15 @@ def addBulbs() {
} else {
//backwards compatable
newHueBulb = bulbs.find { (app.id + "/" + it.id) == dni }
d = addChildDevice("smartthings", "Hue Bulb", dni, newHueBulb?.hub, ["label":newHueBulb?.name])
d = addChildBulb(dni, "Extended Color Light", newHueBulb?.value?.name, newHueBulb?.value?.hub)
d.refresh()
}
} else {
log.debug "found ${d.displayName} with id $dni already exists, type: '$d.typeName'"
if (bulbs instanceof java.util.Map) {
// Update device type if incorrect
def newHueBulb = bulbs.find { (app.id + "/" + it.value.id) == dni }
if (newHueBulb?.value?.type?.equalsIgnoreCase("Dimmable light") && d.typeName == "Hue Bulb") {
d.setDeviceType("Hue Lux Bulb")
}
upgradeDeviceType(d, newHueBulb?.value?.type)
}
}
}
@@ -473,7 +502,7 @@ def locationHandler(evt) {
def bulbs = getHueBulbs()
log.debug "Adding bulbs to state!"
body.each { k,v ->
bulbs[k] = [id: k, name: v.name, type: v.type, hub:parsedEvent.hub]
bulbs[k] = [id: k, name: v.name, type: v.type, modelid: v.modelid, hub:parsedEvent.hub]
}
}
}
@@ -836,7 +865,7 @@ def convertBulbListToMap() {
if (state.bulbs instanceof java.util.List) {
def map = [:]
state.bulbs.unique {it.id}.each { bulb ->
map << ["${bulb.id}":["id":bulb.id, "name":bulb.name, "hub":bulb.hub]]
map << ["${bulb.id}":["id":bulb.id, "name":bulb.name, "type": bulb.type, "modelid": bulb.modelid, "hub":bulb.hub]]
}
state.bulbs = map
}