mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-09 13:21:53 +00:00
Compare commits
1 Commits
MSA-1963-7
...
MSA-1938-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbd11e8ad7 |
900
devicetypes/happy-new/kad.src/kad.groovy
Normal file
900
devicetypes/happy-new/kad.src/kad.groovy
Normal file
@@ -0,0 +1,900 @@
|
||||
/**
|
||||
* kad
|
||||
*
|
||||
* Copyright 2017 Kadeem Coleman
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing permissions and limitations under the License.
|
||||
*
|
||||
*/
|
||||
metadata {
|
||||
definition (name: "kad", namespace: "happy new ", author: "Kadeem Coleman") {
|
||||
capability "Acceleration Sensor"
|
||||
capability "Actuator"
|
||||
capability "Alarm"
|
||||
capability "Alarm System"
|
||||
capability "Alarm System Arm Only"
|
||||
capability "Astronomical Data"
|
||||
capability "Audio Notification"
|
||||
capability "Battery"
|
||||
capability "Beacon"
|
||||
capability "Bridge"
|
||||
capability "Buffered Video Capture"
|
||||
capability "Bulb"
|
||||
capability "Button"
|
||||
capability "Carbon Dioxide Measurement"
|
||||
capability "Carbon Monoxide Detector"
|
||||
capability "Color Control"
|
||||
capability "Color Temperature"
|
||||
capability "Configuration"
|
||||
capability "Consumable"
|
||||
capability "Contact Sensor"
|
||||
capability "Door Control"
|
||||
capability "Energy Meter"
|
||||
capability "Estimated Time Of Arrival"
|
||||
capability "Garage Door Control"
|
||||
capability "Health Check"
|
||||
capability "Image Capture"
|
||||
capability "Indicator"
|
||||
capability "Infrared Level"
|
||||
capability "Light"
|
||||
capability "Light"
|
||||
capability "Lock"
|
||||
capability "Lock Codes"
|
||||
capability "Lock Only"
|
||||
capability "Media Controller"
|
||||
capability "Momentary"
|
||||
capability "Motion Sensor"
|
||||
capability "Music Player"
|
||||
capability "Ocf"
|
||||
capability "Outlet"
|
||||
capability "pH Measurement"
|
||||
capability "Polling"
|
||||
capability "Power"
|
||||
capability "Power Meter"
|
||||
capability "Power Source"
|
||||
capability "Presence Sensor"
|
||||
capability "Refresh"
|
||||
capability "Relay Switch"
|
||||
capability "Samsung TV"
|
||||
capability "Sensor"
|
||||
capability "Shock Sensor"
|
||||
capability "Signal Strength"
|
||||
capability "Sleep Sensor"
|
||||
capability "Smoke Detector"
|
||||
capability "Sound Sensor"
|
||||
capability "Speech Recognition"
|
||||
capability "Speech Synthesis"
|
||||
capability "Switch"
|
||||
capability "Switch Level"
|
||||
capability "Tamper Alert"
|
||||
capability "Temperature Measurement"
|
||||
capability "Test Capability"
|
||||
capability "Thermostat"
|
||||
capability "Thermostat Cooling Setpoint"
|
||||
capability "Thermostat Fan Mode"
|
||||
capability "Thermostat Heating Setpoint"
|
||||
capability "Thermostat Mode"
|
||||
capability "Thermostat Operating State"
|
||||
capability "Thermostat Setpoint"
|
||||
capability "Three Axis"
|
||||
capability "Timed Session"
|
||||
capability "Tone"
|
||||
capability "Touch Sensor"
|
||||
capability "Ultraviolet Index"
|
||||
capability "Valve"
|
||||
capability "Video Camera"
|
||||
capability "Video Capture"
|
||||
capability "Voltage Measurement"
|
||||
capability "Water Sensor"
|
||||
capability "Window Shade"
|
||||
capability "Zw Multichannel"
|
||||
}
|
||||
|
||||
|
||||
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 'acceleration' attribute
|
||||
// TODO: handle 'alarm' attribute
|
||||
// TODO: handle 'alarmSystemStatus' attribute
|
||||
// TODO: handle 'alarmSystemStatus' attribute
|
||||
// TODO: handle 'sunrise' attribute
|
||||
// TODO: handle 'sunset' attribute
|
||||
// TODO: handle 'sunriseTime' attribute
|
||||
// TODO: handle 'sunsetTime' attribute
|
||||
// TODO: handle 'battery' attribute
|
||||
// TODO: handle 'presence' attribute
|
||||
// TODO: handle 'clip' attribute
|
||||
// TODO: handle 'switch' attribute
|
||||
// TODO: handle 'button' attribute
|
||||
// TODO: handle 'numberOfButtons' attribute
|
||||
// TODO: handle 'carbonDioxide' attribute
|
||||
// TODO: handle 'carbonMonoxide' attribute
|
||||
// TODO: handle 'hue' attribute
|
||||
// TODO: handle 'saturation' attribute
|
||||
// TODO: handle 'color' attribute
|
||||
// TODO: handle 'colorTemperature' attribute
|
||||
// TODO: handle 'consumableStatus' attribute
|
||||
// TODO: handle 'contact' attribute
|
||||
// TODO: handle 'door' attribute
|
||||
// TODO: handle 'energy' attribute
|
||||
// TODO: handle 'eta' attribute
|
||||
// TODO: handle 'door' attribute
|
||||
// TODO: handle 'checkInterval' attribute
|
||||
// TODO: handle 'image' attribute
|
||||
// TODO: handle 'indicatorStatus' attribute
|
||||
// TODO: handle 'infraredLevel' attribute
|
||||
// TODO: handle 'switch' attribute
|
||||
// TODO: handle 'switch' attribute
|
||||
// TODO: handle 'lock' attribute
|
||||
// TODO: handle 'lock' attribute
|
||||
// TODO: handle 'codeReport' attribute
|
||||
// TODO: handle 'codeChanged' attribute
|
||||
// TODO: handle 'lock' attribute
|
||||
// TODO: handle 'activities' attribute
|
||||
// TODO: handle 'currentActivity' attribute
|
||||
// TODO: handle 'motion' attribute
|
||||
// TODO: handle 'status' attribute
|
||||
// TODO: handle 'level' attribute
|
||||
// TODO: handle 'trackDescription' attribute
|
||||
// TODO: handle 'trackData' attribute
|
||||
// TODO: handle 'mute' attribute
|
||||
// TODO: handle 'switch' attribute
|
||||
// TODO: handle 'pH' attribute
|
||||
// TODO: handle 'powerSource' attribute
|
||||
// TODO: handle 'power' attribute
|
||||
// TODO: handle 'powerSource' attribute
|
||||
// TODO: handle 'presence' attribute
|
||||
// TODO: handle 'switch' 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 'shock' attribute
|
||||
// TODO: handle 'lqi' attribute
|
||||
// TODO: handle 'rssi' attribute
|
||||
// TODO: handle 'sleeping' attribute
|
||||
// TODO: handle 'smoke' attribute
|
||||
// TODO: handle 'carbonMonoxide' attribute
|
||||
// TODO: handle 'sound' attribute
|
||||
// TODO: handle 'phraseSpoken' attribute
|
||||
// TODO: handle 'switch' attribute
|
||||
// TODO: handle 'level' attribute
|
||||
// TODO: handle 'tamper' attribute
|
||||
// TODO: handle 'temperature' 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 'coolingSetpointMin' attribute
|
||||
// TODO: handle 'coolingSetpointMax' attribute
|
||||
// TODO: handle 'heatingSetpointMin' attribute
|
||||
// TODO: handle 'heatingSetpointMax' attribute
|
||||
// TODO: handle 'thermostatSetpointMin' attribute
|
||||
// TODO: handle 'thermostatSetpointMax' attribute
|
||||
// TODO: handle 'coolingSetpointMin' attribute
|
||||
// TODO: handle 'coolingSetpointMax' attribute
|
||||
// TODO: handle 'heatingSetpointMin' attribute
|
||||
// TODO: handle 'heatingSetpointMax' attribute
|
||||
// TODO: handle 'thermostatSetpointMin' attribute
|
||||
// TODO: handle 'thermostatSetpointMax' attribute
|
||||
// TODO: handle 'coolingSetpoint' attribute
|
||||
// TODO: handle 'coolingSetpointMin' attribute
|
||||
// TODO: handle 'coolingSetpointMax' attribute
|
||||
// TODO: handle 'thermostatFanMode' attribute
|
||||
// TODO: handle 'heatingSetpoint' attribute
|
||||
// TODO: handle 'heatingSetpointMin' attribute
|
||||
// TODO: handle 'heatingSetpointMax' attribute
|
||||
// TODO: handle 'thermostatMode' attribute
|
||||
// TODO: handle 'thermostatOperatingState' attribute
|
||||
// TODO: handle 'thermostatSetpoint' attribute
|
||||
// TODO: handle 'thermostatSetpointMin' attribute
|
||||
// TODO: handle 'thermostatSetpointMax' attribute
|
||||
// TODO: handle 'threeAxis' attribute
|
||||
// TODO: handle 'sessionStatus' attribute
|
||||
// TODO: handle 'timeRemaining' attribute
|
||||
// TODO: handle 'touch' attribute
|
||||
// TODO: handle 'ultravioletIndex' attribute
|
||||
// TODO: handle 'contact' attribute
|
||||
// TODO: handle 'valve' attribute
|
||||
// TODO: handle 'camera' attribute
|
||||
// TODO: handle 'statusMessage' attribute
|
||||
// TODO: handle 'mute' attribute
|
||||
// TODO: handle 'settings' attribute
|
||||
// TODO: handle 'clip' attribute
|
||||
// TODO: handle 'stream' attribute
|
||||
// TODO: handle 'voltage' attribute
|
||||
// TODO: handle 'water' attribute
|
||||
// TODO: handle 'windowShade' attribute
|
||||
// TODO: handle 'epEvent' attribute
|
||||
// TODO: handle 'epInfo' attribute
|
||||
|
||||
}
|
||||
|
||||
// handle commands
|
||||
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 sendEvent(alarmSystemStatus,off)() {
|
||||
log.debug "Executing 'sendEvent(alarmSystemStatus,off)'"
|
||||
// TODO: handle 'sendEvent(alarmSystemStatus,off)' command
|
||||
}
|
||||
|
||||
def sendEvent(alarmSystemStatus,stay)() {
|
||||
log.debug "Executing 'sendEvent(alarmSystemStatus,stay)'"
|
||||
// TODO: handle 'sendEvent(alarmSystemStatus,stay)' command
|
||||
}
|
||||
|
||||
def sendEvent(alarmSystemStatus,away)() {
|
||||
log.debug "Executing 'sendEvent(alarmSystemStatus,away)'"
|
||||
// TODO: handle 'sendEvent(alarmSystemStatus,away)' command
|
||||
}
|
||||
|
||||
def sendEvent(alarmSystemStatus,stay)() {
|
||||
log.debug "Executing 'sendEvent(alarmSystemStatus,stay)'"
|
||||
// TODO: handle 'sendEvent(alarmSystemStatus,stay)' command
|
||||
}
|
||||
|
||||
def sendEvent(alarmSystemStatus,away)() {
|
||||
log.debug "Executing 'sendEvent(alarmSystemStatus,away)'"
|
||||
// TODO: handle 'sendEvent(alarmSystemStatus,away)' command
|
||||
}
|
||||
|
||||
def sendEvent(sunrise)() {
|
||||
log.debug "Executing 'sendEvent(sunrise)'"
|
||||
// TODO: handle 'sendEvent(sunrise)' command
|
||||
}
|
||||
|
||||
def sendEvent(sunset)() {
|
||||
log.debug "Executing 'sendEvent(sunset)'"
|
||||
// TODO: handle 'sendEvent(sunset)' command
|
||||
}
|
||||
|
||||
def sendEvent(sunriseTime)() {
|
||||
log.debug "Executing 'sendEvent(sunriseTime)'"
|
||||
// TODO: handle 'sendEvent(sunriseTime)' command
|
||||
}
|
||||
|
||||
def sendEvent(sunsetTime)() {
|
||||
log.debug "Executing 'sendEvent(sunsetTime)'"
|
||||
// TODO: handle 'sendEvent(sunsetTime)' command
|
||||
}
|
||||
|
||||
def playText() {
|
||||
log.debug "Executing 'playText'"
|
||||
// TODO: handle 'playText' command
|
||||
}
|
||||
|
||||
def playTextAndResume() {
|
||||
log.debug "Executing 'playTextAndResume'"
|
||||
// TODO: handle 'playTextAndResume' command
|
||||
}
|
||||
|
||||
def playTextAndRestore() {
|
||||
log.debug "Executing 'playTextAndRestore'"
|
||||
// TODO: handle 'playTextAndRestore' command
|
||||
}
|
||||
|
||||
def playTrack() {
|
||||
log.debug "Executing 'playTrack'"
|
||||
// TODO: handle 'playTrack' command
|
||||
}
|
||||
|
||||
def playTrackAndResume() {
|
||||
log.debug "Executing 'playTrackAndResume'"
|
||||
// TODO: handle 'playTrackAndResume' command
|
||||
}
|
||||
|
||||
def playTrackAndRestore() {
|
||||
log.debug "Executing 'playTrackAndRestore'"
|
||||
// TODO: handle 'playTrackAndRestore' command
|
||||
}
|
||||
|
||||
def capture() {
|
||||
log.debug "Executing 'capture'"
|
||||
// TODO: handle 'capture' command
|
||||
}
|
||||
|
||||
def off() {
|
||||
log.debug "Executing 'off'"
|
||||
// TODO: handle 'off' command
|
||||
}
|
||||
|
||||
def on() {
|
||||
log.debug "Executing 'on'"
|
||||
// TODO: handle 'on' 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 setColorTemperature() {
|
||||
log.debug "Executing 'setColorTemperature'"
|
||||
// TODO: handle 'setColorTemperature' command
|
||||
}
|
||||
|
||||
def configure() {
|
||||
log.debug "Executing 'configure'"
|
||||
// TODO: handle 'configure' command
|
||||
}
|
||||
|
||||
def setConsumableStatus() {
|
||||
log.debug "Executing 'setConsumableStatus'"
|
||||
// TODO: handle 'setConsumableStatus' command
|
||||
}
|
||||
|
||||
def open() {
|
||||
log.debug "Executing 'open'"
|
||||
// TODO: handle 'open' command
|
||||
}
|
||||
|
||||
def close() {
|
||||
log.debug "Executing 'close'"
|
||||
// TODO: handle 'close' command
|
||||
}
|
||||
|
||||
def open() {
|
||||
log.debug "Executing 'open'"
|
||||
// TODO: handle 'open' command
|
||||
}
|
||||
|
||||
def close() {
|
||||
log.debug "Executing 'close'"
|
||||
// TODO: handle 'close' command
|
||||
}
|
||||
|
||||
def ping() {
|
||||
log.debug "Executing 'ping'"
|
||||
// TODO: handle 'ping' 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 setInfraredLevel() {
|
||||
log.debug "Executing 'setInfraredLevel'"
|
||||
// TODO: handle 'setInfraredLevel' command
|
||||
}
|
||||
|
||||
def off() {
|
||||
log.debug "Executing 'off'"
|
||||
// TODO: handle 'off' command
|
||||
}
|
||||
|
||||
def on() {
|
||||
log.debug "Executing 'on'"
|
||||
// TODO: handle 'on' command
|
||||
}
|
||||
|
||||
def off() {
|
||||
log.debug "Executing 'off'"
|
||||
// TODO: handle 'off' command
|
||||
}
|
||||
|
||||
def on() {
|
||||
log.debug "Executing 'on'"
|
||||
// TODO: handle 'on' command
|
||||
}
|
||||
|
||||
def lock() {
|
||||
log.debug "Executing 'lock'"
|
||||
// TODO: handle 'lock' command
|
||||
}
|
||||
|
||||
def unlock() {
|
||||
log.debug "Executing 'unlock'"
|
||||
// TODO: handle 'unlock' 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 lock() {
|
||||
log.debug "Executing 'lock'"
|
||||
// TODO: handle 'lock' 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 push() {
|
||||
log.debug "Executing 'push'"
|
||||
// TODO: handle 'push' 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 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 postOcfCommand() {
|
||||
log.debug "Executing 'postOcfCommand'"
|
||||
// TODO: handle 'postOcfCommand' command
|
||||
}
|
||||
|
||||
def off() {
|
||||
log.debug "Executing 'off'"
|
||||
// TODO: handle 'off' command
|
||||
}
|
||||
|
||||
def on() {
|
||||
log.debug "Executing 'on'"
|
||||
// TODO: handle 'on' command
|
||||
}
|
||||
|
||||
def poll() {
|
||||
log.debug "Executing 'poll'"
|
||||
// TODO: handle 'poll' command
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
log.debug "Executing 'refresh'"
|
||||
// TODO: handle 'refresh' command
|
||||
}
|
||||
|
||||
def on() {
|
||||
log.debug "Executing 'on'"
|
||||
// TODO: handle 'on' command
|
||||
}
|
||||
|
||||
def off() {
|
||||
log.debug "Executing 'off'"
|
||||
// TODO: handle 'off' 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 speak() {
|
||||
log.debug "Executing 'speak'"
|
||||
// TODO: handle 'speak' command
|
||||
}
|
||||
|
||||
def on() {
|
||||
log.debug "Executing 'on'"
|
||||
// TODO: handle 'on' command
|
||||
}
|
||||
|
||||
def off() {
|
||||
log.debug "Executing 'off'"
|
||||
// TODO: handle 'off' command
|
||||
}
|
||||
|
||||
def setLevel() {
|
||||
log.debug "Executing 'setLevel'"
|
||||
// TODO: handle 'setLevel' 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 setCoolingSetpoint() {
|
||||
log.debug "Executing 'setCoolingSetpoint'"
|
||||
// TODO: handle 'setCoolingSetpoint' 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 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 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 beep() {
|
||||
log.debug "Executing 'beep'"
|
||||
// TODO: handle 'beep' command
|
||||
}
|
||||
|
||||
def open() {
|
||||
log.debug "Executing 'open'"
|
||||
// TODO: handle 'open' command
|
||||
}
|
||||
|
||||
def close() {
|
||||
log.debug "Executing 'close'"
|
||||
// TODO: handle 'close' 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 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 enableEpEvents() {
|
||||
log.debug "Executing 'enableEpEvents'"
|
||||
// TODO: handle 'enableEpEvents' command
|
||||
}
|
||||
|
||||
def epCmd() {
|
||||
log.debug "Executing 'epCmd'"
|
||||
// TODO: handle 'epCmd' command
|
||||
}
|
||||
@@ -103,7 +103,7 @@ metadata {
|
||||
}
|
||||
|
||||
valueTile("illuminance", "device.illuminance", inactiveLabel: false, width: 2, height: 2) {
|
||||
state "illuminance", label:'${currentValue} lux', unit:""
|
||||
state "illuminance", label:'${currentValue} ${unit}', unit:"lux"
|
||||
}
|
||||
|
||||
valueTile("ultravioletIndex", "device.ultravioletIndex", inactiveLabel: false, width: 2, height: 2) {
|
||||
@@ -410,4 +410,4 @@ private command(physicalgraph.zwave.Command cmd) {
|
||||
private commands(commands, delay=200) {
|
||||
log.info "sending commands: ${commands}"
|
||||
delayBetween(commands.collect{ command(it) }, delay)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ metadata {
|
||||
state "humidity", label:'${currentValue}% humidity', unit:""
|
||||
}
|
||||
valueTile("illuminance", "device.illuminance", inactiveLabel: false, width: 2, height: 2) {
|
||||
state "luminosity", label:'${currentValue} lux', unit:""
|
||||
state "luminosity", label:'${currentValue} ${unit}', unit:"lux"
|
||||
}
|
||||
valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
||||
state "battery", label:'${currentValue}% battery', unit:""
|
||||
@@ -282,4 +282,5 @@ private secure(physicalgraph.zwave.Command cmd) {
|
||||
|
||||
private secureSequence(commands, delay=200) {
|
||||
delayBetween(commands.collect{ secure(it) }, delay)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ metadata {
|
||||
state "humidity", label:'${currentValue}% humidity', unit:""
|
||||
}
|
||||
valueTile("illuminance", "device.illuminance", inactiveLabel: false, width: 2, height: 2) {
|
||||
state "luminosity", label:'${currentValue} lux', unit:""
|
||||
state "luminosity", label:'${currentValue} ${unit}', unit:"lux"
|
||||
}
|
||||
valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
||||
state "battery", label:'${currentValue}% battery', unit:""
|
||||
@@ -193,4 +193,4 @@ def configure() {
|
||||
// set data reporting period to 5 minutes
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 111, size: 4, scaledConfigurationValue: 300).format()
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2017 SmartThings
|
||||
* Copyright 2016 SmartThings
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at:
|
||||
@@ -64,7 +64,6 @@ private getATTRIBUTE_HUE() { 0x0000 }
|
||||
private getATTRIBUTE_SATURATION() { 0x0001 }
|
||||
private getHUE_COMMAND() { 0x00 }
|
||||
private getSATURATION_COMMAND() { 0x03 }
|
||||
private getMOVE_TO_HUE_AND_SATURATION_COMMAND() { 0x06 }
|
||||
private getCOLOR_CONTROL_CLUSTER() { 0x0300 }
|
||||
|
||||
// Parse incoming device messages to generate events
|
||||
@@ -85,11 +84,11 @@ def parse(String description) {
|
||||
|
||||
if (zigbeeMap?.clusterInt == COLOR_CONTROL_CLUSTER) {
|
||||
if(zigbeeMap.attrInt == ATTRIBUTE_HUE){ //Hue Attribute
|
||||
def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100)
|
||||
def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 100)
|
||||
sendEvent(name: "hue", value: hueValue, descriptionText: "Color has changed")
|
||||
}
|
||||
else if(zigbeeMap.attrInt == ATTRIBUTE_SATURATION){ //Saturation Attribute
|
||||
def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100)
|
||||
def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 100)
|
||||
sendEvent(name: "saturation", value: saturationValue, descriptionText: "Color has changed", displayed: false)
|
||||
}
|
||||
}
|
||||
@@ -124,12 +123,7 @@ def ping() {
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
zigbee.onOffRefresh() +
|
||||
zigbee.levelRefresh() +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) +
|
||||
zigbee.onOffConfig(0, 300) +
|
||||
zigbee.levelConfig()
|
||||
zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE, DataType.UINT8, 1, 3600, 0x01) + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION, DataType.UINT8, 1, 3600, 0x01)
|
||||
}
|
||||
|
||||
def configure() {
|
||||
@@ -139,38 +133,26 @@ def configure() {
|
||||
sendEvent(name: "checkInterval", value: 3 * 10 * 60 + 1 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||
|
||||
// OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity
|
||||
refresh()
|
||||
zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE, DataType.UINT8, 1, 3600, 0x01) + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION, DataType.UINT8, 1, 3600, 0x01) + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
}
|
||||
|
||||
def setLevel(value) {
|
||||
zigbee.setLevel(value)
|
||||
}
|
||||
|
||||
private getScaledHue(value) {
|
||||
zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
}
|
||||
|
||||
private getScaledSaturation(value) {
|
||||
zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
}
|
||||
|
||||
def setColor(value){
|
||||
log.trace "setColor($value)"
|
||||
zigbee.on() +
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, MOVE_TO_HUE_AND_SATURATION_COMMAND,
|
||||
getScaledHue(value.hue), getScaledSaturation(value.saturation), "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
zigbee.on() + setHue(value.hue) + "delay 500" + setSaturation(value.saturation)
|
||||
}
|
||||
|
||||
def setHue(value) {
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, HUE_COMMAND, getScaledHue(value), "00", "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE)
|
||||
def scaledHueValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, HUE_COMMAND, scaledHueValue, "00", "0500") //payload-> hue value, direction (00-> shortest distance), transition time (1/10th second) (0500 in U16 reads 5)
|
||||
}
|
||||
|
||||
def setSaturation(value) {
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, getScaledSaturation(value), "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
def scaledSatValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, scaledSatValue, "0500") + "delay 1000" + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
}
|
||||
|
||||
def installed() {
|
||||
@@ -179,4 +161,4 @@ def installed() {
|
||||
sendEvent(name: "level", value: 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2017 SmartThings
|
||||
* Copyright 2016 SmartThings
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at:
|
||||
@@ -78,7 +78,6 @@ private getATTRIBUTE_HUE() { 0x0000 }
|
||||
private getATTRIBUTE_SATURATION() { 0x0001 }
|
||||
private getHUE_COMMAND() { 0x00 }
|
||||
private getSATURATION_COMMAND() { 0x03 }
|
||||
private getMOVE_TO_HUE_AND_SATURATION_COMMAND() { 0x06 }
|
||||
private getCOLOR_CONTROL_CLUSTER() { 0x0300 }
|
||||
private getATTRIBUTE_COLOR_TEMPERATURE() { 0x0007 }
|
||||
|
||||
@@ -103,11 +102,11 @@ def parse(String description) {
|
||||
|
||||
if (zigbeeMap?.clusterInt == COLOR_CONTROL_CLUSTER) {
|
||||
if(zigbeeMap.attrInt == ATTRIBUTE_HUE){ //Hue Attribute
|
||||
def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100)
|
||||
def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 100)
|
||||
sendEvent(name: "hue", value: hueValue, descriptionText: "Color has changed")
|
||||
}
|
||||
else if(zigbeeMap.attrInt == ATTRIBUTE_SATURATION){ //Saturation Attribute
|
||||
def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100)
|
||||
def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 100)
|
||||
sendEvent(name: "saturation", value: saturationValue, descriptionText: "Color has changed", displayed: false)
|
||||
}
|
||||
}
|
||||
@@ -142,13 +141,7 @@ def ping() {
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
zigbee.onOffRefresh() +
|
||||
zigbee.levelRefresh() +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE) +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) +
|
||||
zigbee.onOffConfig(0, 300) +
|
||||
zigbee.levelConfig()
|
||||
zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE, DataType.UINT8, 1, 3600, 0x01) + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION, DataType.UINT8, 1, 3600, 0x01)
|
||||
}
|
||||
|
||||
def configure() {
|
||||
@@ -163,12 +156,7 @@ def configure() {
|
||||
|
||||
def setColorTemperature(value) {
|
||||
setGenericName(value)
|
||||
value = value as Integer
|
||||
def tempInMired = (1000000 / value) as Integer
|
||||
def finalHex = zigbee.swapEndianHex(zigbee.convertToHexString(tempInMired, 4))
|
||||
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, 0x0A, "$finalHex 0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE)
|
||||
zigbee.setColorTemperature(value)
|
||||
}
|
||||
|
||||
//Naming based on the wiki article here: http://en.wikipedia.org/wiki/Color_temperature
|
||||
@@ -192,31 +180,19 @@ def setLevel(value) {
|
||||
zigbee.setLevel(value)
|
||||
}
|
||||
|
||||
private getScaledHue(value) {
|
||||
zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
}
|
||||
|
||||
private getScaledSaturation(value) {
|
||||
zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
}
|
||||
|
||||
def setColor(value){
|
||||
log.trace "setColor($value)"
|
||||
zigbee.on() +
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, MOVE_TO_HUE_AND_SATURATION_COMMAND,
|
||||
getScaledHue(value.hue), getScaledSaturation(value.saturation), "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
zigbee.on() + setHue(value.hue) + "delay 300" + setSaturation(value.saturation)
|
||||
}
|
||||
|
||||
def setHue(value) {
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, HUE_COMMAND, getScaledHue(value), "00", "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE)
|
||||
def scaledHueValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, HUE_COMMAND, scaledHueValue, "00", "0500") //payload-> hue value, direction (00-> shortest distance), transition time (1/10th second) (0500 in U16 reads 5)
|
||||
}
|
||||
|
||||
def setSaturation(value) {
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, getScaledSaturation(value), "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
def scaledSatValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, scaledSatValue, "0500") + "delay 1000" + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
}
|
||||
|
||||
def installed() {
|
||||
@@ -225,4 +201,4 @@ def installed() {
|
||||
sendEvent(name: "level", value: 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2017 SmartThings
|
||||
* Copyright 2015 SmartThings
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at:
|
||||
@@ -71,11 +71,6 @@ metadata {
|
||||
}
|
||||
}
|
||||
|
||||
// Globals
|
||||
private getMOVE_TO_COLOR_TEMPERATURE_COMMAND() { 0x0A }
|
||||
private getCOLOR_CONTROL_CLUSTER() { 0x0300 }
|
||||
private getATTRIBUTE_COLOR_TEMPERATURE() { 0x0007 }
|
||||
|
||||
// Parse incoming device messages to generate events
|
||||
def parse(String description) {
|
||||
log.debug "description is $description"
|
||||
@@ -128,11 +123,7 @@ def ping() {
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
zigbee.onOffRefresh() +
|
||||
zigbee.levelRefresh() +
|
||||
zigbee.colorTemperatureRefresh() +
|
||||
zigbee.onOffConfig(0, 300) +
|
||||
zigbee.levelConfig()
|
||||
zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh() + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.colorTemperatureConfig()
|
||||
}
|
||||
|
||||
def configure() {
|
||||
@@ -147,12 +138,7 @@ def configure() {
|
||||
|
||||
def setColorTemperature(value) {
|
||||
setGenericName(value)
|
||||
value = value as Integer
|
||||
def tempInMired = (1000000 / value) as Integer
|
||||
def finalHex = zigbee.swapEndianHex(zigbee.convertToHexString(tempInMired, 4))
|
||||
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, MOVE_TO_COLOR_TEMPERATURE_COMMAND, "$finalHex 0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE)
|
||||
zigbee.setColorTemperature(value)
|
||||
}
|
||||
|
||||
//Naming based on the wiki article here: http://en.wikipedia.org/wiki/Color_temperature
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2017 SmartThings
|
||||
* Copyright 2016 SmartThings
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at:
|
||||
@@ -55,7 +55,6 @@ private getATTRIBUTE_HUE() { 0x0000 }
|
||||
private getATTRIBUTE_SATURATION() { 0x0001 }
|
||||
private getHUE_COMMAND() { 0x00 }
|
||||
private getSATURATION_COMMAND() { 0x03 }
|
||||
private getMOVE_TO_HUE_AND_SATURATION_COMMAND() { 0x06 }
|
||||
private getCOLOR_CONTROL_CLUSTER() { 0x0300 }
|
||||
|
||||
// Parse incoming device messages to generate events
|
||||
@@ -73,11 +72,11 @@ def parse(String description) {
|
||||
|
||||
if (zigbeeMap?.clusterInt == COLOR_CONTROL_CLUSTER) {
|
||||
if(zigbeeMap.attrInt == ATTRIBUTE_HUE){ //Hue Attribute
|
||||
def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100)
|
||||
def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 360)
|
||||
sendEvent(name: "hue", value: hueValue, displayed:false)
|
||||
}
|
||||
else if(zigbeeMap.attrInt == ATTRIBUTE_SATURATION){ //Saturation Attribute
|
||||
def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100)
|
||||
def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 100)
|
||||
sendEvent(name: "saturation", value: saturationValue, displayed:false)
|
||||
}
|
||||
}
|
||||
@@ -109,46 +108,28 @@ def configure() {
|
||||
}
|
||||
|
||||
def configureAttributes() {
|
||||
zigbee.onOffConfig() +
|
||||
zigbee.levelConfig()
|
||||
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE, DataType.UINT8, 1, 3600, 0x01) + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION, DataType.UINT8, 1, 3600, 0x01)
|
||||
}
|
||||
|
||||
def refreshAttributes() {
|
||||
zigbee.onOffRefresh() +
|
||||
zigbee.levelRefresh() +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
}
|
||||
|
||||
def setLevel(value) {
|
||||
zigbee.setLevel(value) + zigbee.onOffRefresh() + zigbee.levelRefresh() //adding refresh because of ZLL bulb not conforming to send-me-a-report
|
||||
}
|
||||
|
||||
private getScaledHue(value) {
|
||||
zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
}
|
||||
|
||||
private getScaledSaturation(value) {
|
||||
zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
}
|
||||
|
||||
def setColor(value){
|
||||
log.trace "setColor($value)"
|
||||
zigbee.on() +
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, MOVE_TO_HUE_AND_SATURATION_COMMAND,
|
||||
getScaledHue(value.hue), getScaledSaturation(value.saturation), "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
zigbee.on() + setHue(value.hue) + ["delay 300"] + setSaturation(value.saturation) + ["delay 2000"] + refreshAttributes()
|
||||
}
|
||||
|
||||
def setHue(value) {
|
||||
//payload-> hue value, direction (00-> shortest distance), transition time (1/10th second)
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, HUE_COMMAND, getScaledHue(value), "00", "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE)
|
||||
def scaledHueValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, HUE_COMMAND, scaledHueValue, "00", "0500") + ["delay 1500"] + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) //payload-> hue value, direction (00-> shortest distance), transition time (1/10th second) (0500 in U16 reads 5)
|
||||
}
|
||||
|
||||
def setSaturation(value) {
|
||||
//payload-> sat value, transition time
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, getScaledSaturation(value), "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
def scaledSatValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, scaledSatValue, "0500") + ["delay 1500"] + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) //payload-> sat value, transition time
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2017 SmartThings
|
||||
* Copyright 2016 SmartThings
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at:
|
||||
@@ -70,7 +70,6 @@ private getATTRIBUTE_HUE() { 0x0000 }
|
||||
private getATTRIBUTE_SATURATION() { 0x0001 }
|
||||
private getHUE_COMMAND() { 0x00 }
|
||||
private getSATURATION_COMMAND() { 0x03 }
|
||||
private getMOVE_TO_HUE_AND_SATURATION_COMMAND() { 0x06 }
|
||||
private getCOLOR_CONTROL_CLUSTER() { 0x0300 }
|
||||
private getATTRIBUTE_COLOR_TEMPERATURE() { 0x0007 }
|
||||
|
||||
@@ -89,11 +88,11 @@ def parse(String description) {
|
||||
|
||||
if (zigbeeMap?.clusterInt == COLOR_CONTROL_CLUSTER) {
|
||||
if(zigbeeMap.attrInt == ATTRIBUTE_HUE){ //Hue Attribute
|
||||
def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100)
|
||||
def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 360)
|
||||
sendEvent(name: "hue", value: hueValue, displayed:false)
|
||||
}
|
||||
else if(zigbeeMap.attrInt == ATTRIBUTE_SATURATION){ //Saturation Attribute
|
||||
def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100)
|
||||
def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 100)
|
||||
sendEvent(name: "saturation", value: saturationValue, displayed:false)
|
||||
}
|
||||
}
|
||||
@@ -125,16 +124,11 @@ def configure() {
|
||||
}
|
||||
|
||||
def configureAttributes() {
|
||||
zigbee.onOffConfig() +
|
||||
zigbee.levelConfig()
|
||||
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE, DataType.UINT8, 1, 3600, 0x01) + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION, DataType.UINT8, 1, 3600, 0x01)
|
||||
}
|
||||
|
||||
def refreshAttributes() {
|
||||
zigbee.onOffRefresh() +
|
||||
zigbee.levelRefresh() +
|
||||
zigbee.colorTemperatureRefresh() +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh() + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
}
|
||||
|
||||
def setColorTemperature(value) {
|
||||
@@ -145,32 +139,17 @@ def setLevel(value) {
|
||||
zigbee.setLevel(value) + zigbee.onOffRefresh() + zigbee.levelRefresh() //adding refresh because of ZLL bulb not conforming to send-me-a-report
|
||||
}
|
||||
|
||||
private getScaledHue(value) {
|
||||
zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
}
|
||||
|
||||
private getScaledSaturation(value) {
|
||||
zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
}
|
||||
|
||||
def setColor(value){
|
||||
log.trace "setColor($value)"
|
||||
zigbee.on() +
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, MOVE_TO_HUE_AND_SATURATION_COMMAND,
|
||||
getScaledHue(value.hue), getScaledSaturation(value.saturation), "0000") +
|
||||
zigbee.onOffRefresh() +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
zigbee.on() + setHue(value.hue) + ["delay 300"] + setSaturation(value.saturation) + ["delay 2000"] + refreshAttributes()
|
||||
}
|
||||
|
||||
def setHue(value) {
|
||||
//payload-> hue value, direction (00-> shortest distance), transition time (1/10th second)
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, HUE_COMMAND, getScaledHue(value), "00", "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE)
|
||||
def scaledHueValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, HUE_COMMAND, scaledHueValue, "00", "0500") + ["delay 1500"] + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) //payload-> hue value, direction (00-> shortest distance), transition time (1/10th second) (0500 in U16 reads 5)
|
||||
}
|
||||
|
||||
def setSaturation(value) {
|
||||
//payload-> sat value, transition time
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, getScaledSaturation(value), "0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
|
||||
def scaledSatValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, scaledSatValue, "0500") + ["delay 1500"] + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) //payload-> sat value, transition time
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2017 SmartThings
|
||||
* Copyright 2016 SmartThings
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at:
|
||||
@@ -66,11 +66,6 @@ metadata {
|
||||
}
|
||||
}
|
||||
|
||||
// Globals
|
||||
private getMOVE_TO_COLOR_TEMPERATURE_COMMAND() { 0x0A }
|
||||
private getCOLOR_CONTROL_CLUSTER() { 0x0300 }
|
||||
private getATTRIBUTE_COLOR_TEMPERATURE() { 0x0007 }
|
||||
|
||||
// Parse incoming device messages to generate events
|
||||
def parse(String description) {
|
||||
log.debug "description is $description"
|
||||
@@ -100,14 +95,14 @@ def setLevel(value) {
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
def cmds = zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh()
|
||||
def cmds = zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh()
|
||||
|
||||
// Do NOT config if the device is the Eaton Halo_LT01, it responds with "switch:off" to onOffConfig, and maybe other weird things with the others
|
||||
// Do NOT config if the device is the Eaton Halo_LT01, it responds with "switch:off" to onOffConfig, and maybe other weird things with the others
|
||||
if (!((device.getDataValue("manufacturer") == "Eaton") && (device.getDataValue("model") == "Halo_LT01"))) {
|
||||
cmds += zigbee.onOffConfig() + zigbee.levelConfig()
|
||||
cmds = cmds + zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.colorTemperatureConfig()
|
||||
}
|
||||
|
||||
cmds
|
||||
cmds
|
||||
}
|
||||
|
||||
def poll() {
|
||||
@@ -143,7 +138,7 @@ def configure() {
|
||||
log.debug "configure()"
|
||||
configureHealthCheck()
|
||||
// Implementation note: for the Eaton Halo_LT01, it responds with "switch:off" to onOffConfig, so be sure this is before the call to onOffRefresh
|
||||
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh()
|
||||
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh()
|
||||
}
|
||||
|
||||
def updated() {
|
||||
@@ -153,12 +148,7 @@ def updated() {
|
||||
|
||||
def setColorTemperature(value) {
|
||||
setGenericName(value)
|
||||
value = value as Integer
|
||||
def tempInMired = (1000000 / value) as Integer
|
||||
def finalHex = zigbee.swapEndianHex(zigbee.convertToHexString(tempInMired, 4))
|
||||
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, MOVE_TO_COLOR_TEMPERATURE_COMMAND, "$finalHex 0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE)
|
||||
zigbee.setColorTemperature(value) + ["delay 1500"] + zigbee.colorTemperatureRefresh()
|
||||
}
|
||||
|
||||
//Naming based on the wiki article here: http://en.wikipedia.org/wiki/Color_temperature
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2017 SmartThings
|
||||
* Copyright 2016 SmartThings
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at:
|
||||
@@ -68,11 +68,6 @@ metadata {
|
||||
}
|
||||
}
|
||||
|
||||
// Globals
|
||||
private getMOVE_TO_COLOR_TEMPERATURE_COMMAND() { 0x0A }
|
||||
private getCOLOR_CONTROL_CLUSTER() { 0x0300 }
|
||||
private getATTRIBUTE_COLOR_TEMPERATURE() { 0x0007 }
|
||||
|
||||
// Parse incoming device messages to generate events
|
||||
def parse(String description) {
|
||||
log.debug "description is $description"
|
||||
@@ -99,11 +94,7 @@ def setLevel(value) {
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
zigbee.onOffRefresh() +
|
||||
zigbee.levelRefresh() +
|
||||
zigbee.colorTemperatureRefresh() +
|
||||
zigbee.onOffConfig() +
|
||||
zigbee.levelConfig()
|
||||
zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh() + zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.colorTemperatureConfig()
|
||||
}
|
||||
|
||||
def poll() {
|
||||
@@ -138,7 +129,8 @@ def configureHealthCheck() {
|
||||
def configure() {
|
||||
log.debug "configure()"
|
||||
configureHealthCheck()
|
||||
refresh()
|
||||
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh()
|
||||
|
||||
}
|
||||
|
||||
def updated() {
|
||||
@@ -148,12 +140,7 @@ def updated() {
|
||||
|
||||
def setColorTemperature(value) {
|
||||
setGenericName(value)
|
||||
value = value as Integer
|
||||
def tempInMired = (1000000 / value) as Integer
|
||||
def finalHex = zigbee.swapEndianHex(zigbee.convertToHexString(tempInMired, 4))
|
||||
|
||||
zigbee.command(COLOR_CONTROL_CLUSTER, MOVE_TO_COLOR_TEMPERATURE_COMMAND, "$finalHex 0000") +
|
||||
zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE)
|
||||
zigbee.setColorTemperature(value) + ["delay 1500"] + zigbee.colorTemperatureRefresh()
|
||||
}
|
||||
|
||||
//Naming based on the wiki article here: http://en.wikipedia.org/wiki/Color_temperature
|
||||
|
||||
@@ -1,549 +0,0 @@
|
||||
/**
|
||||
* Copyright 2017 Stelpro
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing permissions and limitations under the License.
|
||||
*
|
||||
* Stelpro Ki Thermostat
|
||||
*
|
||||
* Author: Stelpro
|
||||
*
|
||||
* Date: 2017-05-08
|
||||
*/
|
||||
|
||||
preferences {
|
||||
input("zipcode", "text", title: "ZipCode (Outdoor Temperature)", description: "[Do not use space](Blank = No Forecast)")
|
||||
input("heatdetails", "enum", title: "Do you want a detailed operating state notification?", options: ["No", "Yes"], defaultValue: "No", required: false, displayDuringSetup: true)
|
||||
}
|
||||
|
||||
metadata {
|
||||
definition (name: "Stelpro Ki Thermostat", namespace: "stelpro", author: "Stelpro") {
|
||||
capability "Thermostat"
|
||||
capability "Temperature Measurement"
|
||||
capability "Actuator"
|
||||
capability "Polling"
|
||||
capability "Refresh"
|
||||
capability "Sensor"
|
||||
capability "Configuration"
|
||||
|
||||
attribute "outsideTemp", "number"
|
||||
|
||||
command "switchMode"
|
||||
command "quickSetHeat"
|
||||
command "quickSetOutTemp"
|
||||
command "increaseHeatSetpoint"
|
||||
command "decreaseHeatSetpoint"
|
||||
command "setCustomThermostatMode"
|
||||
command "eco"
|
||||
command "applyNow"
|
||||
|
||||
fingerprint deviceId: "0x0806", inClusters: "0x5E,0x86,0x72,0x40,0x43,0x31,0x85,0x59,0x5A,0x73,0x20,0x42"
|
||||
}
|
||||
|
||||
// simulator metadata
|
||||
simulator {
|
||||
//Add test code here
|
||||
}
|
||||
|
||||
tiles {
|
||||
multiAttributeTile(name:"thermostatMulti", type:"thermostat", width:6, height:4) {
|
||||
tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
|
||||
attributeState("temp", label:'${currentValue}')
|
||||
attributeState("high", label:'HIGH')
|
||||
attributeState("low", label:'LOW')
|
||||
attributeState("--", label:'--')
|
||||
}
|
||||
tileAttribute("device.heatingSetpoint", key: "VALUE_CONTROL") {
|
||||
attributeState("VALUE_UP", action: "increaseHeatSetpoint")
|
||||
attributeState("VALUE_DOWN", action: "decreaseHeatSetpoint")
|
||||
}
|
||||
tileAttribute("device.thermostatOperatingState", key: "OPERATING_STATE") {
|
||||
attributeState("idle", backgroundColor:"#44b621")
|
||||
attributeState("heating", backgroundColor:"#ffa81e")
|
||||
}
|
||||
tileAttribute("device.thermostatMode", key: "THERMOSTAT_MODE") {
|
||||
attributeState("off", label:'Off')
|
||||
attributeState("comfort", label:'Comfort')
|
||||
attributeState("eco", label:'Eco')
|
||||
}
|
||||
tileAttribute("device.heatingSetpoint", key: "HEATING_SETPOINT")
|
||||
{
|
||||
attributeState("heatingSetpoint", label:'${currentValue}')
|
||||
}
|
||||
}
|
||||
standardTile("mode", "device.thermostatMode", width: 2, height: 2) {
|
||||
state "off", label:'${name}', action:"switchMode", nextState:"to_comfort", icon:"st.thermostat.off"
|
||||
state "comfort", label:'${name}', action:"switchMode", nextState:"to_eco", icon:"http://cdn.device-icons.smartthings.com/Home/home29-icn@2x.png"
|
||||
state "eco", label:'${name}', action:"switchMode", nextState:"...", icon:"http://cdn.device-icons.smartthings.com/Outdoor/outdoor3-icn@2x.png"
|
||||
state "to_comfort", label: "comfort", action:"switchMode", nextState:"to_eco"
|
||||
state "to_eco", label: "eco", action:"switchMode", nextState:"..."
|
||||
state "...", label: "...", action:"heat", nextState:"comfort"
|
||||
}
|
||||
valueTile("heatingSetpoint", "device.heatingSetpoint", width: 2, height: 2) {
|
||||
state "temperature", label:'Setpoint\n${currentValue}°', backgroundColors:[
|
||||
[value: 31, color: "#153591"],
|
||||
[value: 44, color: "#1e9cbb"],
|
||||
[value: 59, color: "#90d2a7"],
|
||||
[value: 74, color: "#44b621"],
|
||||
[value: 84, color: "#f1d801"],
|
||||
[value: 95, color: "#d04e00"],
|
||||
[value: 96, color: "#bc2323"]
|
||||
]
|
||||
state "--", label:'--', backgroundColor:"#bdbdbd"
|
||||
}
|
||||
standardTile("refresh", "device.refresh", decoration: "flat", width: 2, height: 2) {
|
||||
state "default", action:"refresh.refresh", icon:"st.secondary.refresh"
|
||||
}
|
||||
main ("thermostatMulti")
|
||||
details(["thermostatMulti", "mode", "heatingSetpoint", "refresh"])
|
||||
}
|
||||
}
|
||||
|
||||
def parse(String description)
|
||||
{
|
||||
if (description == "updated")
|
||||
return []
|
||||
|
||||
def unitScale = getTemperatureScale()
|
||||
//Class, version
|
||||
def map = createEvent(zwaveEvent(zwave.parse(description, [0x40:2, 0x43:2, 0x31:3, 0x42:1])))
|
||||
if (!map) {
|
||||
return null
|
||||
}
|
||||
|
||||
def result = [map]
|
||||
if (map.name in ["heatingSetpoint","thermostatMode"]) {
|
||||
def map2 = [
|
||||
name: "thermostatSetpoint",
|
||||
unit: getTemperatureScale()
|
||||
]
|
||||
if (map.name == "thermostatMode") {
|
||||
state.lastTriedMode = map.value
|
||||
}
|
||||
else {
|
||||
def mode = device.latestValue("thermostatMode")
|
||||
log.info "THERMOSTAT, latest mode = ${mode}"
|
||||
if (map.name == "heatingSetpoint") {
|
||||
map2.value = map.value
|
||||
map2.unit = map.unit
|
||||
}
|
||||
}
|
||||
if (map2.value != null) {
|
||||
log.debug "THERMOSTAT, adding setpoint event: $map"
|
||||
result << createEvent(map2)
|
||||
}
|
||||
}
|
||||
log.debug "Parse returned $result"
|
||||
result
|
||||
}
|
||||
|
||||
// Event Generation
|
||||
def zwaveEvent(physicalgraph.zwave.commands.thermostatsetpointv2.ThermostatSetpointReport cmd)
|
||||
{
|
||||
def cmdScale = cmd.scale == 1 ? "F" : "C"
|
||||
def temp;
|
||||
float tempfloat;
|
||||
def map = [:]
|
||||
if (cmd.scaledValue >= 327)
|
||||
{
|
||||
map.value = "--"
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = convertTemperatureIfNeeded(cmd.scaledValue, cmdScale, cmd.precision)
|
||||
tempfloat = (Math.round(temp.toFloat() * 2)) / 2
|
||||
map.value = tempfloat
|
||||
}
|
||||
map.unit = getTemperatureScale()
|
||||
map.displayed = false
|
||||
switch (cmd.setpointType) {
|
||||
case 1:
|
||||
map.name = "heatingSetpoint"
|
||||
break;
|
||||
default:
|
||||
return [:]
|
||||
}
|
||||
// So we can respond with same format
|
||||
state.size = cmd.size
|
||||
state.scale = cmd.scale
|
||||
state.precision = cmd.precision
|
||||
sendEvent(name:"heatingSetpoint", value:map.value)
|
||||
map
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv3.SensorMultilevelReport cmd)
|
||||
{
|
||||
def temp;
|
||||
float tempfloat;
|
||||
def format;
|
||||
def map = [:]
|
||||
if (cmd.sensorType == 1) {
|
||||
map.value = convertTemperatureIfNeeded(cmd.scaledSensorValue, cmd.scale == 1 ? "F" : "C", cmd.precision)
|
||||
map.unit = getTemperatureScale()
|
||||
map.name = "temperature"
|
||||
|
||||
temp = map.value
|
||||
if (temp == "32765") //0x7FFD
|
||||
{
|
||||
map.value = "low"
|
||||
}
|
||||
else if (temp == "32767") //0x7FFF
|
||||
{
|
||||
map.value = "high"
|
||||
}
|
||||
else if (temp == "-32768") //0x8000
|
||||
{
|
||||
map.value = "--"
|
||||
}
|
||||
else
|
||||
{
|
||||
tempfloat = (Math.round(temp.toFloat() * 2)) / 2
|
||||
map.value = tempfloat
|
||||
}
|
||||
|
||||
} else if (cmd.sensorType == 5) {
|
||||
map.value = cmd.scaledSensorValue
|
||||
map.unit = "%"
|
||||
map.name = "humidity"
|
||||
}
|
||||
sendEvent(name:"temperature", value:map.value)
|
||||
map
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.thermostatoperatingstatev1.ThermostatOperatingStateReport cmd)
|
||||
{
|
||||
def map = [:]
|
||||
switch (cmd.operatingState) {
|
||||
case physicalgraph.zwave.commands.thermostatoperatingstatev1.ThermostatOperatingStateReport.OPERATING_STATE_IDLE:
|
||||
map.value = "idle"
|
||||
break
|
||||
case physicalgraph.zwave.commands.thermostatoperatingstatev1.ThermostatOperatingStateReport.OPERATING_STATE_HEATING:
|
||||
map.value = "heating"
|
||||
break
|
||||
}
|
||||
map.name = "thermostatOperatingState"
|
||||
|
||||
if (settings.heatdetails == "No") {
|
||||
map.displayed = false
|
||||
}
|
||||
|
||||
map
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.thermostatmodev2.ThermostatModeReport cmd) {
|
||||
def map = [:]
|
||||
switch (cmd.mode) {
|
||||
case physicalgraph.zwave.commands.thermostatmodev2.ThermostatModeReport.MODE_HEAT:
|
||||
map.value = "comfort"
|
||||
break
|
||||
case physicalgraph.zwave.commands.thermostatmodev2.ThermostatModeReport.MODE_OFF:
|
||||
map.value = "off"
|
||||
break
|
||||
default:
|
||||
map.value = "eco"
|
||||
break
|
||||
}
|
||||
map.name = "thermostatMode"
|
||||
sendEvent(name:"thermostatMode", value:map.value)
|
||||
map
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.associationv2.AssociationReport cmd) {
|
||||
delayBetween([
|
||||
zwave.associationV1.associationRemove(groupingIdentifier:1, nodeId:0).format(),
|
||||
zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format(),
|
||||
poll()
|
||||
], 2300)
|
||||
}
|
||||
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.thermostatmodev2.ThermostatModeSupportedReport cmd) {
|
||||
log.debug "Zwave event received: $cmd"
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
|
||||
log.debug "Zwave event received: $cmd"
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
||||
log.warn "Unexpected zwave command $cmd"
|
||||
}
|
||||
|
||||
// Command Implementations
|
||||
def poll() {
|
||||
def weather
|
||||
|
||||
// If there is a zipcode defined, weather forecast will be sent. Otherwise, no weather forecast.
|
||||
if (settings.zipcode) {
|
||||
log.debug "ZipCode: ${settings.zipcode}"
|
||||
weather = getWeatherFeature( "conditions", settings.zipcode )
|
||||
|
||||
// Check if the variable is populated, otherwise return.
|
||||
if (!weather) {
|
||||
log.debug( "Something went wrong, no data found." )
|
||||
return false
|
||||
}
|
||||
|
||||
// Set the tiles
|
||||
def locationScale = getTemperatureScale()
|
||||
def tempToSend
|
||||
if (locationScale == "C")
|
||||
{
|
||||
log.debug( "Outdoor Temperature: ${weather.current_observation.temp_c}ºC" )
|
||||
sendEvent( name: 'outsideTemp', value: weather.current_observation.temp_c )
|
||||
tempToSend = weather.current_observation.temp_c
|
||||
}
|
||||
else
|
||||
{
|
||||
log.debug( "Outdoor Temperature: ${weather.current_observation.temp_f}ºF" )
|
||||
sendEvent( name: 'outsideTemp', value: weather.current_observation.temp_f )
|
||||
tempToSend = weather.current_observation.temp_f
|
||||
}
|
||||
|
||||
|
||||
delayBetween([
|
||||
quickSetOutTemp(tempToSend),
|
||||
zwave.thermostatOperatingStateV1.thermostatOperatingStateGet().format(),
|
||||
zwave.thermostatModeV2.thermostatModeGet().format(),
|
||||
zwave.thermostatSetpointV2.thermostatSetpointGet(setpointType: 1).format(),
|
||||
zwave.sensorMultilevelV3.sensorMultilevelGet().format(), // current temperature
|
||||
sendEvent( name: 'change', value: 0 )
|
||||
], 100)
|
||||
} else {
|
||||
delayBetween([
|
||||
zwave.thermostatOperatingStateV1.thermostatOperatingStateGet().format(),
|
||||
zwave.thermostatModeV2.thermostatModeGet().format(),
|
||||
zwave.thermostatSetpointV2.thermostatSetpointGet(setpointType: 1).format(),
|
||||
zwave.sensorMultilevelV3.sensorMultilevelGet().format(), // current temperature
|
||||
sendEvent( name: 'change', value: 0 )
|
||||
], 100)
|
||||
}
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
poll()
|
||||
}
|
||||
|
||||
def configure() {
|
||||
poll()
|
||||
}
|
||||
|
||||
def applyNow() {
|
||||
float currentHeatSetpoint = device.currentValue("heatingSetpoint")
|
||||
def deviceScale
|
||||
def locationScale = getTemperatureScale()
|
||||
|
||||
sendEvent( name: 'change', value: 0 )
|
||||
log.debug("currentHeatSetpoint $currentHeatSetpoint")
|
||||
if (locationScale == "C")
|
||||
{
|
||||
deviceScale = 0
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceScale = 1
|
||||
}
|
||||
|
||||
delayBetween([
|
||||
zwave.thermostatSetpointV2.thermostatSetpointSet(setpointType: 1, scale: deviceScale, precision: state.precision, scaledValue: currentHeatSetpoint).format(),
|
||||
poll()
|
||||
], 1000)
|
||||
}
|
||||
|
||||
def quickSetHeat(degrees) {
|
||||
setHeatingSetpoint(degrees, 0)
|
||||
}
|
||||
|
||||
def setHeatingSetpoint(degrees, delay = 0) {
|
||||
sendEvent(name:"heatingSetpoint", value:degrees)
|
||||
applyNow()
|
||||
}
|
||||
|
||||
def quickSetOutTemp(degrees) {
|
||||
setOutdoorTemperature(degrees, 0)
|
||||
}
|
||||
|
||||
def setOutdoorTemperature(degrees, delay = 0) {
|
||||
setOutdoorTemperature(degrees.toDouble(), delay)
|
||||
}
|
||||
|
||||
def setOutdoorTemperature(Double degrees, Integer delay = 0) {
|
||||
def deviceScale
|
||||
def locationScale = getTemperatureScale()
|
||||
def p = (state.precision == null) ? 1 : state.precision
|
||||
|
||||
if (locationScale == "C")
|
||||
{
|
||||
deviceScale = 0
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceScale = 1
|
||||
}
|
||||
log.info "setOutdoorTemperature: ${degrees}"
|
||||
zwave.sensorMultilevelV3.sensorMultilevelReport(sensorType: 1, scale: deviceScale, precision: p, scaledSensorValue: degrees).format()
|
||||
}
|
||||
|
||||
def increaseHeatSetpoint()
|
||||
{
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
if (currentMode != "off")
|
||||
{
|
||||
float currentSetpoint = device.currentValue("heatingSetpoint")
|
||||
def locationScale = getTemperatureScale()
|
||||
float maxSetpoint
|
||||
float step
|
||||
|
||||
if (locationScale == "C")
|
||||
{
|
||||
maxSetpoint = 30;
|
||||
step = 0.5
|
||||
}
|
||||
else
|
||||
{
|
||||
maxSetpoint = 86
|
||||
step = 1
|
||||
}
|
||||
|
||||
if (currentSetpoint < maxSetpoint)
|
||||
{
|
||||
currentSetpoint = currentSetpoint + step
|
||||
quickSetHeat(currentSetpoint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def decreaseHeatSetpoint()
|
||||
{
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
if (currentMode != "off")
|
||||
{
|
||||
float currentSetpoint = device.currentValue("heatingSetpoint")
|
||||
def locationScale = getTemperatureScale()
|
||||
float minSetpoint
|
||||
float step
|
||||
|
||||
if (locationScale == "C")
|
||||
{
|
||||
minSetpoint = 5;
|
||||
step = 0.5
|
||||
}
|
||||
else
|
||||
{
|
||||
minSetpoint = 41
|
||||
step = 1
|
||||
}
|
||||
|
||||
if (currentSetpoint > minSetpoint)
|
||||
{
|
||||
currentSetpoint = currentSetpoint - step
|
||||
quickSetHeat(currentSetpoint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def switchMode() {
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
def lastTriedMode = state.lastTriedMode ?: currentMode ?: "comfort"
|
||||
def supportedModes = getDataByName("supportedModes")
|
||||
def modeOrder = modes()
|
||||
def next = { modeOrder[modeOrder.indexOf(it) + 1] ?: modeOrder[0] }
|
||||
def nextMode = next(lastTriedMode)
|
||||
if (supportedModes?.contains(currentMode)) {
|
||||
while (!supportedModes.contains(nextMode) && nextMode != "comfort") {
|
||||
nextMode = next(nextMode)
|
||||
}
|
||||
}
|
||||
state.lastTriedMode = nextMode
|
||||
delayBetween([
|
||||
zwave.thermostatModeV2.thermostatModeSet(mode: modeMap[nextMode]).format(),
|
||||
poll()
|
||||
], 1000)
|
||||
}
|
||||
|
||||
def modes() {
|
||||
["comfort", "eco", "off"]
|
||||
}
|
||||
|
||||
def getModeMap() { [
|
||||
"off": 0,
|
||||
"comfort": 1,
|
||||
"eco": 11,
|
||||
]}
|
||||
|
||||
def getDataByName(String name) {
|
||||
state[name] ?: device.getDataValue(name)
|
||||
}
|
||||
|
||||
def setCoolingSetpoint(coolingSetpoint) {
|
||||
log.trace "${device.displayName} does not support cool setpoint"
|
||||
}
|
||||
|
||||
def off() {
|
||||
log.trace "off mode applied"
|
||||
delayBetween([
|
||||
zwave.thermostatModeV2.thermostatModeSet(mode: 0).format(),
|
||||
poll()
|
||||
], 1000)
|
||||
}
|
||||
|
||||
def heat() {
|
||||
log.trace "heat mode applied"
|
||||
delayBetween([
|
||||
zwave.thermostatModeV2.thermostatModeSet(mode: 1).format(),
|
||||
poll()
|
||||
], 1000)
|
||||
}
|
||||
|
||||
def eco() {
|
||||
log.trace "eco mode applied"
|
||||
delayBetween([
|
||||
zwave.thermostatModeV2.thermostatModeSet(mode: 11).format(),
|
||||
poll()
|
||||
], 1000)
|
||||
}
|
||||
|
||||
def auto() {
|
||||
log.trace "${device.displayName} does not support auto mode"
|
||||
}
|
||||
|
||||
def emergencyHeat() {
|
||||
log.trace "${device.displayName} does not support emergency heat mode"
|
||||
}
|
||||
|
||||
def cool() {
|
||||
log.trace "${device.displayName} does not support cool mode"
|
||||
}
|
||||
|
||||
def setCustomThermostatMode(mode) {
|
||||
setThermostatMode(mode)
|
||||
}
|
||||
|
||||
def setThermostatMode(String value) {
|
||||
delayBetween([
|
||||
zwave.thermostatModeV2.thermostatModeSet(mode: modeMap[value]).format(),
|
||||
poll()
|
||||
], 1000)
|
||||
}
|
||||
|
||||
def fanOn() {
|
||||
log.trace "${device.displayName} does not support fan on"
|
||||
}
|
||||
|
||||
def fanAuto() {
|
||||
log.trace "${device.displayName} does not support fan auto"
|
||||
}
|
||||
|
||||
def fanCirculate() {
|
||||
log.trace "${device.displayName} does not support fan circulate"
|
||||
}
|
||||
|
||||
def setThermostatFanMode() {
|
||||
log.trace "${device.displayName} does not support fan mode"
|
||||
}
|
||||
Reference in New Issue
Block a user