mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-25 13:04:10 +00:00
Compare commits
1 Commits
MSA-1152-2
...
MSA-1115-3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bda80e2258 |
78
build.gradle
78
build.gradle
@@ -1,15 +1,13 @@
|
|||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import com.smartthings.deployment.slack.FileUpload
|
|
||||||
import com.smartthings.deployment.slack.Message
|
|
||||||
|
|
||||||
apply plugin: 'groovy'
|
apply plugin: 'groovy'
|
||||||
apply plugin: 'smartthings-executable-deployment'
|
apply plugin: 'smartthings-executable-deployment'
|
||||||
apply plugin: 'smartthings-slack'
|
apply plugin: 'smartthings-hipchat'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.smartthings.deployment:executable-deployment-scripts:1.0.7"
|
classpath "com.smartthings.deployment:executable-deployment-scripts:1.0.6"
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
@@ -32,43 +30,7 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
slackSendMessage {
|
hipchatShareFile {
|
||||||
String branch = project.hasProperty('branch') ? project.property('branch') : 'unknown'
|
|
||||||
String token = project.hasProperty('slackToken') ? project.property('slackToken') : null
|
|
||||||
String webhookUrl = project.hasProperty('slackWebhookUrl') ? project.property('slackWebhookUrl') : null
|
|
||||||
String channel = project.hasProperty('slackChannel') ? project.property('slackChannel') : null
|
|
||||||
String drinks = 'https://dl.dropboxusercontent.com/s/m1z5mpd3c83lwev/minion_beer.jpeg?dl=0'
|
|
||||||
String wolverine = 'https://dl.dropboxusercontent.com/s/4lbjqzvm2v033u9/minion_wolverine.jpg?dl=0'
|
|
||||||
String beach = 'https://dl.dropboxusercontent.com/s/rqrfgxk53gfng69/minion_beach.png?dl=0'
|
|
||||||
String iconUrl
|
|
||||||
String color
|
|
||||||
String messageText
|
|
||||||
String username
|
|
||||||
switch (branch) {
|
|
||||||
case 'master':
|
|
||||||
username = 'Hickory'
|
|
||||||
iconUrl = wolverine
|
|
||||||
color = '#35D0F2'
|
|
||||||
messageText = 'Began deployment of _SmartThingsPublic[master]_ branch to the _Dev_ environments.'
|
|
||||||
break
|
|
||||||
case 'staging':
|
|
||||||
username = 'Dickory'
|
|
||||||
iconUrl = beach
|
|
||||||
color = '#FFDE20'
|
|
||||||
messageText = 'Began deployment of _SmartThingsPublic[staging]_ branch to the _Staging_ environments.'
|
|
||||||
break
|
|
||||||
case 'production':
|
|
||||||
username = 'Dock'
|
|
||||||
iconUrl = drinks
|
|
||||||
color = '#FF1D23'
|
|
||||||
messageText = 'Began deployment of _SmartThingsPublic[production]_ branch to the _Prod_ environments.'
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
username = 'Hickory'
|
|
||||||
iconUrl = wolverine
|
|
||||||
color = '#35D0F2'
|
|
||||||
messageText = "Began deployment of an _SmartThingsPublic[${branch}]_ branch. Have no idea what's going on."
|
|
||||||
}
|
|
||||||
List<String> archives = []
|
List<String> archives = []
|
||||||
File rootDir = new File("${project.buildDir}/archives")
|
File rootDir = new File("${project.buildDir}/archives")
|
||||||
if (rootDir.exists()) {
|
if (rootDir.exists()) {
|
||||||
@@ -81,25 +43,19 @@ slackSendMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Date date = new Date()
|
|
||||||
String fileDate = date.format('yyyy-MM-dd_HH-mm-ss', TimeZone.getTimeZone('GMT'))
|
|
||||||
|
|
||||||
// Required Task Arguments.
|
// Set task properties
|
||||||
file = new FileUpload(
|
data = archives.join('\n').getBytes(StandardCharsets.UTF_8)
|
||||||
data: archives.join('\n').getBytes(StandardCharsets.UTF_8),
|
fileName = 'deployment-notes.txt'
|
||||||
filename: "deployment-notes-${fileDate}.txt",
|
contentType = 'text/html'
|
||||||
title: 'Deployment Notes',
|
}
|
||||||
channels: channel,
|
|
||||||
token: token,
|
hipchatSendNotification {
|
||||||
color: color
|
String branch = project.hasProperty('branch') ? project.property('branch') : 'unknown'
|
||||||
)
|
message = "Began executable deploy of SmartThingsPublic(${branch})."
|
||||||
message = new Message(
|
if (branch == 'master') {
|
||||||
webhookUrl: webhookUrl,
|
message += ' (dev shards)'
|
||||||
username: username,
|
}
|
||||||
asUser: true,
|
color = branch == 'master' ? 'yellow' : 'red'
|
||||||
iconUrl: iconUrl,
|
notify = true
|
||||||
channel: channel,
|
|
||||||
fallback: 'Deployment Notification',
|
|
||||||
text: messageText
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|||||||
10
circle.yml
10
circle.yml
@@ -15,11 +15,13 @@ deployment:
|
|||||||
develop:
|
develop:
|
||||||
branch: master
|
branch: master
|
||||||
commands:
|
commands:
|
||||||
- ./gradlew deployArchives -PsmartThingsArtifactoryUserName="$ARTIFACTORY_USERNAME" -PsmartThingsArtifactoryPassword="$ARTIFACTORY_PASSWORD" -Ps3Buckets="$S3_BUCKETS_DEV"
|
- ./gradlew deployArchives -PsmartThingsArtifactoryUserName=$ARTIFACTORY_USERNAME -PsmartThingsArtifactoryPassword=$ARTIFACTORY_PASSWORD -Ps3Buckets="$S3_BUCKETS_DEV"
|
||||||
- ./gradlew slackSendMessage -PsmartThingsArtifactoryUserName="$ARTIFACTORY_USERNAME" -PsmartThingsArtifactoryPassword="$ARTIFACTORY_PASSWORD" -Pbranch="$CIRCLE_BRANCH" -PslackToken="$SLACK_TOKEN" -PslackWebhookUrl="$SLACK_WEBHOOK_URL" -PslackChannel="$SLACK_CHANNEL" --stacktrace
|
- ./gradlew hipchatSendNotification -PsmartThingsArtifactoryUserName=$ARTIFACTORY_USERNAME -PsmartThingsArtifactoryPassword=$ARTIFACTORY_PASSWORD -Pbranch=$CIRCLE_BRANCH
|
||||||
|
- ./gradlew hipchatShareFile -PsmartThingsArtifactoryUserName=$ARTIFACTORY_USERNAME -PsmartThingsArtifactoryPassword=$ARTIFACTORY_PASSWORD
|
||||||
|
|
||||||
stage:
|
stage:
|
||||||
branch: staging
|
branch: staging
|
||||||
commands:
|
commands:
|
||||||
- ./gradlew deployArchives -PsmartThingsArtifactoryUserName="$ARTIFACTORY_USERNAME" -PsmartThingsArtifactoryPassword="$ARTIFACTORY_PASSWORD" -Ps3Buckets="$S3_BUCKETS_STAGE"
|
- ./gradlew deployArchives -PsmartThingsArtifactoryUserName=$ARTIFACTORY_USERNAME -PsmartThingsArtifactoryPassword=$ARTIFACTORY_PASSWORD -Ps3Buckets="$S3_BUCKETS_STAGE"
|
||||||
- ./gradlew slackSendMessage -PsmartThingsArtifactoryUserName="$ARTIFACTORY_USERNAME" -PsmartThingsArtifactoryPassword="$ARTIFACTORY_PASSWORD" -Pbranch="$CIRCLE_BRANCH" -PslackToken="$SLACK_TOKEN" -PslackWebhookUrl="$SLACK_WEBHOOK_URL" -PslackChannel="$SLACK_CHANNEL" --stacktrace
|
- ./gradlew hipchatSendNotification -PsmartThingsArtifactoryUserName=$ARTIFACTORY_USERNAME -PsmartThingsArtifactoryPassword=$ARTIFACTORY_PASSWORD -Pbranch=$CIRCLE_BRANCH
|
||||||
|
- ./gradlew hipchatShareFile -PsmartThingsArtifactoryUserName=$ARTIFACTORY_USERNAME -PsmartThingsArtifactoryPassword=$ARTIFACTORY_PASSWORD
|
||||||
|
|||||||
771
devicetypes/klnounlf/mjdygcdn.src/mjdygcdn.groovy
Normal file
771
devicetypes/klnounlf/mjdygcdn.src/mjdygcdn.groovy
Normal 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
|
||||||
|
}
|
||||||
@@ -1,194 +0,0 @@
|
|||||||
/**
|
|
||||||
* Iris Smart Fob
|
|
||||||
*
|
|
||||||
* Copyright 2015 Mitch Pond
|
|
||||||
* Presence code adapted from SmartThings Arrival Sensor HA device type
|
|
||||||
*
|
|
||||||
* 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: "Iris Smart Fob", namespace: "mitchpond", author: "Mitch Pond") {
|
|
||||||
capability "Battery"
|
|
||||||
capability "Button"
|
|
||||||
capability "Configuration"
|
|
||||||
capability "Presence Sensor"
|
|
||||||
capability "Sensor"
|
|
||||||
|
|
||||||
//fingerprint endpointId: "01", profileId: "0104", inClusters: "0000,0001,0003,0007,0020,0B05", outClusters: "0003,0006,0019", model:"3450-L", manufacturer: "CentraLite"
|
|
||||||
}
|
|
||||||
|
|
||||||
preferences{
|
|
||||||
input ("holdTime", "number", title: "Minimum time in seconds for a press to count as \"held\"",
|
|
||||||
defaultValue: 3, displayDuringSetup: false)
|
|
||||||
input "checkInterval", "enum", title: "Presence timeout (minutes)",
|
|
||||||
defaultValue:"2", options: ["2", "3", "5"], displayDuringSetup: false
|
|
||||||
input "logging", "bool", title: "Enable debug logging",
|
|
||||||
defaultValue: false, displayDuringSetup: false
|
|
||||||
}
|
|
||||||
|
|
||||||
tiles(scale: 2) {
|
|
||||||
standardTile("presence", "device.presence", width: 4, height: 4, canChangeBackground: true) {
|
|
||||||
state "present", label: "Present", labelIcon:"st.presence.tile.present", backgroundColor:"#53a7c0"
|
|
||||||
state "not present", labelIcon:"st.presence.tile.not-present", backgroundColor:"#ffffff"
|
|
||||||
}
|
|
||||||
standardTile("button", "device.button", decoration: "flat", width: 2, height: 2) {
|
|
||||||
state "default", icon: "st.unknown.zwave.remote-controller", backgroundColor: "#ffffff"
|
|
||||||
}
|
|
||||||
valueTile("battery", "device.battery", decoration: "flat", width: 2, height: 2) {
|
|
||||||
state "battery", label:'${currentValue}% battery', unit:""
|
|
||||||
}
|
|
||||||
|
|
||||||
main (["presence"])
|
|
||||||
details(["presence","button","battery"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def parse(String description) {
|
|
||||||
def descMap = zigbee.parseDescriptionAsMap(description)
|
|
||||||
logIt descMap
|
|
||||||
state.lastCheckin = now()
|
|
||||||
logIt "lastCheckin = ${state.lastCheckin}"
|
|
||||||
handlePresenceEvent(true)
|
|
||||||
|
|
||||||
def results = []
|
|
||||||
if (description?.startsWith('catchall:'))
|
|
||||||
results = parseCatchAllMessage(descMap)
|
|
||||||
else if (description?.startsWith('read attr -'))
|
|
||||||
results = parseReportAttributeMessage(descMap)
|
|
||||||
else logIt(descMap, "trace")
|
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
def updated() {
|
|
||||||
startTimer()
|
|
||||||
configure()
|
|
||||||
}
|
|
||||||
|
|
||||||
def configure(){
|
|
||||||
logIt "Configuring Smart Fob..."
|
|
||||||
[
|
|
||||||
"zdo bind 0x${device.deviceNetworkId} 1 1 6 {${device.zigbeeId}} {}", "delay 200",
|
|
||||||
"zdo bind 0x${device.deviceNetworkId} 2 1 6 {${device.zigbeeId}} {}", "delay 200",
|
|
||||||
"zdo bind 0x${device.deviceNetworkId} 3 1 6 {${device.zigbeeId}} {}", "delay 200",
|
|
||||||
"zdo bind 0x${device.deviceNetworkId} 4 1 6 {${device.zigbeeId}} {}", "delay 200",
|
|
||||||
"zdo bind 0x${device.deviceNetworkId} 1 1 1 {${device.zigbeeId}} {}", "delay 200"
|
|
||||||
] +
|
|
||||||
zigbee.configureReporting(0x0001,0x0020,0x20,20,20,0x01)
|
|
||||||
}
|
|
||||||
|
|
||||||
def parseCatchAllMessage(descMap) {
|
|
||||||
if (descMap?.clusterId == "0006" && descMap?.command == "01") //button pressed
|
|
||||||
handleButtonPress(descMap.sourceEndpoint as int)
|
|
||||||
else if (descMap?.clusterId == "0006" && descMap?.command == "00") //button released
|
|
||||||
handleButtonRelease(descMap.sourceEndpoint as int)
|
|
||||||
else logIt("Parse: Unhandled message: ${descMap}","trace")
|
|
||||||
}
|
|
||||||
|
|
||||||
def parseReportAttributeMessage(descMap) {
|
|
||||||
if (descMap?.cluster == "0001" && descMap?.attrId == "0020") createBatteryEvent(getBatteryLevel(descMap.value))
|
|
||||||
else logIt descMap
|
|
||||||
}
|
|
||||||
|
|
||||||
private createBatteryEvent(percent) {
|
|
||||||
logIt "Battery level at " + percent
|
|
||||||
return createEvent([name: "battery", value: percent])
|
|
||||||
}
|
|
||||||
|
|
||||||
//this method determines if a press should count as a push or a hold and returns the relevant event type
|
|
||||||
private handleButtonRelease(button) {
|
|
||||||
logIt "lastPress state variable: ${state.lastPress}"
|
|
||||||
def sequenceError = {logIt("Uh oh...missed a message? Dropping this event.", "error"); state.lastPress = null; return []}
|
|
||||||
|
|
||||||
if (!state.lastPress) return sequenceError()
|
|
||||||
else if (state.lastPress.button != button) return sequenceError()
|
|
||||||
|
|
||||||
def currentTime = now()
|
|
||||||
def startOfPress = state.lastPress?.time
|
|
||||||
def timeDif = currentTime - startOfPress
|
|
||||||
def holdTimeMillisec = (settings.holdTime?:3).toInteger() * 1000
|
|
||||||
|
|
||||||
state.lastPress = null //we're done with this. clear it to make error conditions easier to catch
|
|
||||||
|
|
||||||
if (timeDif < 0)
|
|
||||||
//likely a message sequence issue or dropped packet. Drop this press and wait for another.
|
|
||||||
return sequenceError()
|
|
||||||
else if (timeDif < holdTimeMillisec)
|
|
||||||
return createButtonEvent(button,"pushed")
|
|
||||||
else
|
|
||||||
return createButtonEvent(button,"held")
|
|
||||||
}
|
|
||||||
|
|
||||||
private handleButtonPress(button) {
|
|
||||||
state.lastPress = [button: button, time: now()]
|
|
||||||
}
|
|
||||||
|
|
||||||
private createButtonEvent(button,action) {
|
|
||||||
logIt "Button ${button} ${action}"
|
|
||||||
return createEvent([
|
|
||||||
name: "button",
|
|
||||||
value: action,
|
|
||||||
data:[buttonNumber: button],
|
|
||||||
descriptionText: "${device.displayName} button ${button} was ${action}",
|
|
||||||
isStateChange: true,
|
|
||||||
displayed: true])
|
|
||||||
}
|
|
||||||
|
|
||||||
private getBatteryLevel(rawValue) {
|
|
||||||
def intValue = Integer.parseInt(rawValue,16)
|
|
||||||
def min = 2.1
|
|
||||||
def max = 3.0
|
|
||||||
def vBatt = intValue / 10
|
|
||||||
return ((vBatt - min) / (max - min) * 100) as int
|
|
||||||
}
|
|
||||||
|
|
||||||
private handlePresenceEvent(present) {
|
|
||||||
def wasPresent = device.currentState("presence")?.value == "present"
|
|
||||||
if (!wasPresent && present) {
|
|
||||||
logIt "Sensor is present"
|
|
||||||
startTimer()
|
|
||||||
} else if (!present) {
|
|
||||||
logIt "Sensor is not present"
|
|
||||||
stopTimer()
|
|
||||||
}
|
|
||||||
def linkText = getLinkText(device)
|
|
||||||
def eventMap = [
|
|
||||||
name: "presence",
|
|
||||||
value: present ? "present" : "not present",
|
|
||||||
linkText: linkText,
|
|
||||||
descriptionText: "${linkText} has ${present ? 'arrived' : 'left'}",
|
|
||||||
]
|
|
||||||
logIt "Creating presence event: ${eventMap}"
|
|
||||||
sendEvent(eventMap)
|
|
||||||
}
|
|
||||||
|
|
||||||
private startTimer() {
|
|
||||||
logIt "Scheduling periodic timer"
|
|
||||||
schedule("0 * * * * ?", checkPresenceCallback)
|
|
||||||
}
|
|
||||||
|
|
||||||
private stopTimer() {
|
|
||||||
logIt "Stopping periodic timer"
|
|
||||||
unschedule()
|
|
||||||
}
|
|
||||||
|
|
||||||
def checkPresenceCallback() {
|
|
||||||
def timeSinceLastCheckin = (now() - state.lastCheckin) / 1000
|
|
||||||
def theCheckInterval = (checkInterval ? checkInterval as int : 2) * 60
|
|
||||||
logIt "Sensor checked in ${timeSinceLastCheckin} seconds ago"
|
|
||||||
if (timeSinceLastCheckin >= theCheckInterval) {
|
|
||||||
handlePresenceEvent(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ****** Utility functions ******
|
|
||||||
|
|
||||||
private logIt(str, logLevel = 'debug') {if (settings.logging) log."$logLevel"(str) }
|
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
'''Presence timeout (minutes)'''.ko=시간 초과. 스마트폰 위치 정보
|
'''Presence timeout (minutes)'''.ko=시간 초과. 스마트폰 위치 정보
|
||||||
'''Tap to set'''.ko=눌러서 설정
|
'''Tap to set'''.ko=눌러서 설정
|
||||||
'''Arrival Sensor'''.ko=도착알림 센서
|
'''Arrival Sensor'''.ko=도착알림 센서
|
||||||
'''${currentValue}% battery'''.ko=${currentValue}% 배터리
|
|
||||||
# Events / Notifications
|
# Events / Notifications
|
||||||
'''{{ linkText }} battery was {{ value }}'''.ko={{ linkText }}남아있는 배터리는 {{ value }}입니다.
|
'''{{ linkText }} battery was {{ value }}'''.ko={{ linkText }}남아있는 배터리는 {{ value }}입니다.
|
||||||
'''{{ linkText }} has arrived'''.ko={{ linkText }}집에 도착했습니다.
|
'''{{ linkText }} has arrived'''.ko={{ linkText }}집에 도착했습니다.
|
||||||
|
|||||||
@@ -28,8 +28,4 @@
|
|||||||
'''{{ device.displayName }} is On'''.ko={{ device.displayName }}켜졌습니다.
|
'''{{ device.displayName }} is On'''.ko={{ device.displayName }}켜졌습니다.
|
||||||
'''{{ device.displayName }} is Off'''.ko={{ device.displayName }}꺼졌습니다.
|
'''{{ device.displayName }} is Off'''.ko={{ device.displayName }}꺼졌습니다.
|
||||||
'''{{ device.displayName }} power is {{ value }} Watts'''.ko={{ device.displayName }} 전원은 {{ value }}와트입니다
|
'''{{ device.displayName }} power is {{ value }} Watts'''.ko={{ device.displayName }} 전원은 {{ value }}와트입니다
|
||||||
'''On'''.ko=켜짐
|
|
||||||
'''Off'''.ko=꺼짐
|
|
||||||
'''Turning On'''.ko=켜기
|
|
||||||
'''Turning Off'''.ko=끄기
|
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
|||||||
@@ -65,10 +65,10 @@ metadata {
|
|||||||
tiles(scale: 2) {
|
tiles(scale: 2) {
|
||||||
multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
|
multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
|
||||||
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
|
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
|
||||||
attributeState "on", label: 'On', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821", nextState: "turningOff"
|
attributeState "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821", nextState: "turningOff"
|
||||||
attributeState "off", label: 'Off', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "turningOn"
|
attributeState "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "turningOn"
|
||||||
attributeState "turningOn", label: 'Turning On', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821", nextState: "turningOff"
|
attributeState "turningOn", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821", nextState: "turningOff"
|
||||||
attributeState "turningOff", label: 'Turning Off', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "turningOn"
|
attributeState "turningOff", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "turningOn"
|
||||||
}
|
}
|
||||||
tileAttribute ("power", key: "SECONDARY_CONTROL") {
|
tileAttribute ("power", key: "SECONDARY_CONTROL") {
|
||||||
attributeState "power", label:'${currentValue} W'
|
attributeState "power", label:'${currentValue} W'
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
#==============================================================================
|
#==============================================================================
|
||||||
# Korean (ko)
|
# Korean (ko)
|
||||||
# Device Preferences
|
# Device Preferences
|
||||||
'''Dry'''.ko=건조
|
|
||||||
'''Wet'''.ko=누수
|
|
||||||
'''dry'''.ko=건조
|
'''dry'''.ko=건조
|
||||||
'''wet'''.ko=누수
|
'''wet'''.ko=누수
|
||||||
'''battery'''.ko=배터리
|
'''battery'''.ko=배터리
|
||||||
@@ -33,7 +31,6 @@
|
|||||||
'''Adjust temperature by this many degrees'''.ko=몇 도씩 온도를 조절하십시오
|
'''Adjust temperature by this many degrees'''.ko=몇 도씩 온도를 조절하십시오
|
||||||
'''Give your device a name'''.ko=기기 이름 바꾸기
|
'''Give your device a name'''.ko=기기 이름 바꾸기
|
||||||
'''Water Leak Sensor'''.ko=누수센서
|
'''Water Leak Sensor'''.ko=누수센서
|
||||||
'''${currentValue}% battery'''.ko=${currentValue}% 배터리
|
|
||||||
# Events descriptionText
|
# Events descriptionText
|
||||||
'''{{ device.displayName }} is dry'''.ko={{ device.displayName }}가 건조
|
'''{{ device.displayName }} is dry'''.ko={{ device.displayName }}가 건조
|
||||||
'''{{ device.displayName }} is wet'''.ko={{ device.displayName }}누수
|
'''{{ device.displayName }} is wet'''.ko={{ device.displayName }}누수
|
||||||
|
|||||||
@@ -30,9 +30,6 @@
|
|||||||
'''Adjust temperature by this many degrees'''.ko=몇 도씩 온도를 조절하십시오
|
'''Adjust temperature by this many degrees'''.ko=몇 도씩 온도를 조절하십시오
|
||||||
'''Give your device a name'''.ko=기기 이름 바꾸기
|
'''Give your device a name'''.ko=기기 이름 바꾸기
|
||||||
'''Motion Sensor'''.ko=모션 센서
|
'''Motion Sensor'''.ko=모션 센서
|
||||||
'''motion'''.ko=동작 감지
|
|
||||||
'''no motion'''.ko=동작 없음
|
|
||||||
'''${currentValue}% battery'''.ko=${currentValue}% 배터리
|
|
||||||
# Events descriptionText
|
# Events descriptionText
|
||||||
'''{{ device.displayName }} detected motion'''.ko={{ device.displayName }} 가 움직임을 감지하였습니다.
|
'''{{ device.displayName }} detected motion'''.ko={{ device.displayName }} 가 움직임을 감지하였습니다.
|
||||||
'''{{ device.displayName }} motion has stopped'''.ko={{ device.displayName }}움직임이 중단되었습니다
|
'''{{ device.displayName }} motion has stopped'''.ko={{ device.displayName }}움직임이 중단되었습니다
|
||||||
|
|||||||
@@ -43,8 +43,3 @@
|
|||||||
'''{{ device.displayName }} battery was {{ value }}%'''.ko={{ device.displayName }}남아있는 배터리는 {{ value }}%입니다.
|
'''{{ device.displayName }} battery was {{ value }}%'''.ko={{ device.displayName }}남아있는 배터리는 {{ value }}%입니다.
|
||||||
'''Updating device to garage sensor'''.ko=기기-차고 센서 업데이트 중
|
'''Updating device to garage sensor'''.ko=기기-차고 센서 업데이트 중
|
||||||
'''Updating device to open/close sensor'''.ko=기기-열림/닫힘 센서 업데이트 중
|
'''Updating device to open/close sensor'''.ko=기기-열림/닫힘 센서 업데이트 중
|
||||||
'''Inactive'''.ko=비활성
|
|
||||||
'''Active'''.ko=활성
|
|
||||||
'''Open'''.ko=열림
|
|
||||||
'''Closed'''.ko=닫힘
|
|
||||||
'''${currentValue}% battery'''.ko=${currentValue}% 배터리
|
|
||||||
|
|||||||
@@ -83,19 +83,19 @@ metadata {
|
|||||||
tiles(scale: 2) {
|
tiles(scale: 2) {
|
||||||
multiAttributeTile(name:"status", type: "generic", width: 6, height: 4){
|
multiAttributeTile(name:"status", type: "generic", width: 6, height: 4){
|
||||||
tileAttribute ("device.status", key: "PRIMARY_CONTROL") {
|
tileAttribute ("device.status", key: "PRIMARY_CONTROL") {
|
||||||
attributeState "open", label:'Open', icon:"st.contact.contact.open", backgroundColor:"#ffa81e"
|
attributeState "open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e"
|
||||||
attributeState "closed", label:'Closed', icon:"st.contact.contact.closed", backgroundColor:"#79b821"
|
attributeState "closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821"
|
||||||
attributeState "garage-open", label:'Open', icon:"st.doors.garage.garage-open", backgroundColor:"#ffa81e"
|
attributeState "garage-open", label:'Open', icon:"st.doors.garage.garage-open", backgroundColor:"#ffa81e"
|
||||||
attributeState "garage-closed", label:'Closed', icon:"st.doors.garage.garage-closed", backgroundColor:"#79b821"
|
attributeState "garage-closed", label:'Closed', icon:"st.doors.garage.garage-closed", backgroundColor:"#79b821"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
standardTile("contact", "device.contact", width: 2, height: 2) {
|
standardTile("contact", "device.contact", width: 2, height: 2) {
|
||||||
state("open", label:'Open', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
|
state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
|
||||||
state("closed", label:'Closed', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
|
state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
|
||||||
}
|
}
|
||||||
standardTile("acceleration", "device.acceleration", width: 2, height: 2) {
|
standardTile("acceleration", "device.acceleration", width: 2, height: 2) {
|
||||||
state("active", label:'Active', icon:"st.motion.acceleration.active", backgroundColor:"#53a7c0")
|
state("active", label:'${name}', icon:"st.motion.acceleration.active", backgroundColor:"#53a7c0")
|
||||||
state("inactive", label:'Inactive', icon:"st.motion.acceleration.inactive", backgroundColor:"#ffffff")
|
state("inactive", label:'${name}', icon:"st.motion.acceleration.inactive", backgroundColor:"#ffffff")
|
||||||
}
|
}
|
||||||
valueTile("temperature", "device.temperature", width: 2, height: 2) {
|
valueTile("temperature", "device.temperature", width: 2, height: 2) {
|
||||||
state("temperature", label:'${currentValue}°',
|
state("temperature", label:'${currentValue}°',
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
* MyQ (Connect)
|
|
||||||
*
|
|
||||||
* Copyright 2015 Jason Mok
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Last Updated : 03/08/2016
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
definition(
|
|
||||||
name: "MyQ (Connect)",
|
|
||||||
namespace: "copy-ninja",
|
|
||||||
author: "Jason Mok",
|
|
||||||
description: "Connect MyQ to control your devices",
|
|
||||||
category: "SmartThings Labs",
|
|
||||||
iconUrl: "http://smartthings.copyninja.net/icons/MyQ@1x.png",
|
|
||||||
iconX2Url: "http://smartthings.copyninja.net/icons/MyQ@2x.png",
|
|
||||||
iconX3Url: "http://smartthings.copyninja.net/icons/MyQ@3x.png"
|
|
||||||
)
|
|
||||||
|
|
||||||
preferences {
|
|
||||||
page(name: "prefLogIn", title: "MyQ")
|
|
||||||
page(name: "prefListDevices", title: "MyQ")
|
|
||||||
}
|
|
||||||
@@ -40,7 +40,6 @@ preferences {
|
|||||||
page name:"pageSetup"
|
page name:"pageSetup"
|
||||||
page name:"Setup"
|
page name:"Setup"
|
||||||
page name:"Settings"
|
page name:"Settings"
|
||||||
page name: "timeIntervalInput"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,8 +185,7 @@ def Settings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def timeIntervalInput() {
|
page(name: "timeIntervalInput", title: "Only during a certain time", refreshAfterSelection:true) {
|
||||||
dynamicPage(name: "timeIntervalInput") {
|
|
||||||
section {
|
section {
|
||||||
input "startTimeType", "enum", title: "Starting at", options: [["time": "A specific time"], ["sunrise": "Sunrise"], ["sunset": "Sunset"]], defaultValue: "time", submitOnChange: true
|
input "startTimeType", "enum", title: "Starting at", options: [["time": "A specific time"], ["sunrise": "Sunrise"], ["sunset": "Sunset"]], defaultValue: "time", submitOnChange: true
|
||||||
if (startTimeType in ["sunrise","sunset"]) {
|
if (startTimeType in ["sunrise","sunset"]) {
|
||||||
@@ -206,9 +204,8 @@ def timeIntervalInput() {
|
|||||||
input "ending", "time", title: "End time", required: false
|
input "ending", "time", title: "End time", required: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
def installed() {
|
def installed() {
|
||||||
initialize()
|
initialize()
|
||||||
|
|||||||
Reference in New Issue
Block a user