mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-09 13:21:53 +00:00
Compare commits
30 Commits
MSA-1900-9
...
MSA-1938-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbd11e8ad7 | ||
|
|
7e8baeeb0b | ||
|
|
62991f8d23 | ||
|
|
ad824a9dd8 | ||
|
|
11f2775568 | ||
|
|
83b65c0d87 | ||
|
|
e641759a47 | ||
|
|
7820b39b2b | ||
|
|
6a76a8ee39 | ||
|
|
980bef6879 | ||
|
|
120935f14e | ||
|
|
c864fc521e | ||
|
|
032f4a92d4 | ||
|
|
6d528683e6 | ||
|
|
8bcbe7b924 | ||
|
|
69dd13f333 | ||
|
|
016425b7c8 | ||
|
|
c164b201ca | ||
|
|
030dd47b69 | ||
|
|
cc68534b47 | ||
|
|
5e07494dff | ||
|
|
573630232f | ||
|
|
29c7049d60 | ||
|
|
03a79b8bb5 | ||
|
|
d91fc1c9d1 | ||
|
|
db7288f245 | ||
|
|
b59d979fbf | ||
|
|
fc32031555 | ||
|
|
f445ffc67c | ||
|
|
95c383a2ea |
2
devicetypes/drzwave/ezmultipli.src/.st-ignore
Normal file
2
devicetypes/drzwave/ezmultipli.src/.st-ignore
Normal file
@@ -0,0 +1,2 @@
|
||||
.st-ignore
|
||||
README.md
|
||||
44
devicetypes/drzwave/ezmultipli.src/README.md
Normal file
44
devicetypes/drzwave/ezmultipli.src/README.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# Express Controls EZMultiPli
|
||||
|
||||
Works with:
|
||||
|
||||
* [Express Controls EZMultiPli](https://www.smartthings.com/works-with-smartthings/)
|
||||
|
||||
## Table of contents
|
||||
|
||||
* [Release Notes](#release-notes)
|
||||
* [Capabilities](#capabilities)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
|
||||
## Release Notes
|
||||
|
||||
* **2017-04-19** - _dkirker_ - Update default config values in config value range check functions, use lux if lum option is null, fix NullPointerException on initial pairing when color data has not been set (and set the default color data!)
|
||||
* **2017-04-10** - _DrZwave_ (with help from Donald Kirker) - changed fingerprint to the new format, lowered the OnTime and other parameters to be "more in line with ST user expectations", get the luminance in LUX so it reports in lux all the time.
|
||||
* **2016-10-06** - _erocm1231_ - Added "updated" method to run when configuration options are changed. Depending on model of unit, luminance is being reported as a relative percentace or as a lux value. Added the option to configure this in the handler.
|
||||
* **2016-01-28** - _erocm1231_ - Changed the configuration method to use scaledConfiguration so that it properly formatted negative numbers. Also, added configurationGet and a configurationReport method so that config values can be verified.
|
||||
* **2015-12-04** - _erocm1231_ - added range value to preferences as suggested by @Dela-Rick.
|
||||
* **2015-11-26** - _erocm1231_ - Fixed null condition error when adding as a new device.
|
||||
* **2015-11-24** - _erocm1231_ - Added refresh command. Made a few changes to how the handler maps colors to the LEDs. Fixed the device not having its on/off status updated when colors are changed.
|
||||
* **2015-11-23** - _erocm1231_ - Changed the look to match SmartThings v2 devices.
|
||||
* **2015-11-21** - _erocm1231_ - Made code much more efficient. Also made it compatible when setColor is passed a hex value. Mapping of special colors: Soft White - Default - Yellow, White - Concentrate - White, Daylight - Energize - Teal, Warm White - Relax - Yellow
|
||||
* **2015-11-19** - _erocm1231_ - Fixed a couple incorrect colors, changed setColor to be more compatible with other apps
|
||||
* **2015-11-18** - _erocm1231_ - Added to setColor for compatibility with Smart Lighting
|
||||
* **v0.1.0** - _DrZWave_ - chose better icons, Got color LED to work - first fully functional version
|
||||
* **v0.0.9** - _jrs_ - got the temp and luminance to work. Motion works. Debugging the color wheel.
|
||||
* **v0.0.8** - _DrZWave_ 2/25/2015 - change the color control to be tiles since there are only 8 colors.
|
||||
* **v0.0.7** - _jrs_ - 02/23/2015 - Jim Sulin
|
||||
|
||||
## Capabilities
|
||||
|
||||
* **Actuator** - represents that a Device has commands
|
||||
* **Sensor** - detects sensor events
|
||||
* **Motion Sensor** - can detect motion
|
||||
* **Temperature Measurement** - defines device measures current temperature
|
||||
* **Illuminance Measurement** - gives the illuminance reading from devices that support it
|
||||
* **Switch** - can detect state (possible values: on/off)
|
||||
* **Color Control** - represents that the color attributes of a device can be controlled (hue, saturation, color value
|
||||
* **Configuration** - configure() command called when device is installed or device preferences updated
|
||||
* **Refresh** - refresh() command for status updates
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -2,27 +2,6 @@
|
||||
// Motion Sensor - Temperature - Light level - 8 Color Indicator LED - Z-Wave Range Extender - Wall Powered
|
||||
// driver for SmartThings
|
||||
// The EZMultiPli is also known as the HSM200 from HomeSeer.com
|
||||
//
|
||||
// 2017-04-10 - DrZwave (with help from Don Kirker) - changed fingerprint to the new format, lowered the OnTime
|
||||
// and other parameters to be "more in line with ST user expectations", get the luminance in LUX so it reports in lux all the time.
|
||||
// 2016-10-06 - erocm1231 - Added "updated" method to run when configuration options are changed. Depending on model of unit, luminance is being
|
||||
// reported as a relative percentace or as a lux value. Added the option to configure this in the handler.
|
||||
// 2016-01-28 - erocm1231 - Changed the configuration method to use scaledConfiguration so that it properly formatted negative numbers.
|
||||
// Also, added configurationGet and a configurationReport method so that config values can be verified.
|
||||
// 2015-12-04 - erocm1231 - added range value to preferences as suggested by @Dela-Rick.
|
||||
// 2015-11-26 - erocm1231 - Fixed null condition error when adding as a new device.
|
||||
// 2015-11-24 - erocm1231 - Added refresh command. Made a few changes to how the handler maps colors to the LEDs. Fixed
|
||||
// the device not having its on/off status updated when colors are changed.
|
||||
// 2015-11-23 - erocm1231 - Changed the look to match SmartThings v2 devices.
|
||||
// 2015-11-21 - erocm1231 - Made code much more efficient. Also made it compatible when setColor is passed a hex value.
|
||||
// Mapping of special colors: Soft White - Default - Yellow, White - Concentrate - White,
|
||||
// Daylight - Energize - Teal, Warm White - Relax - Yellow
|
||||
// 2015-11-19 - erocm1231 - Fixed a couple incorrect colors, changed setColor to be more compatible with other apps
|
||||
// 2015-11-18 - erocm1231 - Added to setColor for compatibility with Smart Lighting
|
||||
// v0.1.0 - DrZWave - chose better icons, Got color LED to work - first fully functional version
|
||||
// v0.0.9 - jrs - got the temp and luminance to work. Motion works. Debugging the color wheel.
|
||||
// v0.0.8 - DrZWave 2/25/2015 - change the color control to be tiles since there are only 8 colors.
|
||||
// v0.0.7 - jrs - 02/23/2015 - Jim Sulin
|
||||
|
||||
metadata {
|
||||
definition (name: "EZmultiPli", namespace: "DrZWave", author: "Eric Ryherd", oauth: true) {
|
||||
@@ -131,7 +110,6 @@ metadata {
|
||||
|
||||
} // end metadata
|
||||
|
||||
|
||||
// Parse incoming device messages from device to generate events
|
||||
def parse(String description){
|
||||
//log.debug "==> New Zwave Event: ${description}"
|
||||
@@ -145,7 +123,7 @@ def parse(String description){
|
||||
|
||||
def statusTextmsg = ""
|
||||
if (device.currentState('temperature') != null && device.currentState('illuminance') != null) {
|
||||
statusTextmsg = "${device.currentState('temperature').value} ° - ${device.currentState('illuminance').value} ${(lum == "" || lum == null || lum == 1) ? "%" : "LUX"}"
|
||||
statusTextmsg = "${device.currentState('temperature').value} ° - ${device.currentState('illuminance').value} ${(lum == 1) ? "%" : "LUX"}"
|
||||
sendEvent("name":"statusText", "value":statusTextmsg, displayed:false)
|
||||
}
|
||||
if (result != [null] && result != []) log.debug "Parse returned ${result}"
|
||||
@@ -168,7 +146,7 @@ def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv5.SensorMultilevelR
|
||||
break;
|
||||
case 0x03 : // SENSOR_TYPE_LUMINANCE_VERSION_1
|
||||
map.value = cmd.scaledSensorValue.toInteger().toString()
|
||||
if(lum == "" || lum == null || lum == 1) map.unit = "%"
|
||||
if(lum == 1) map.unit = "%"
|
||||
else map.unit = "lux"
|
||||
map.name = "illuminance"
|
||||
log.debug "Luminance report"
|
||||
@@ -203,7 +181,8 @@ def zwaveEvent(physicalgraph.zwave.commands.notificationv3.NotificationReport cm
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
|
||||
if (cmd.value == 0 && device.latestState("color").value != "#ffffff") {
|
||||
// The EZMultiPli sets the color back to #ffffff on "off" or at init, so update the ST device to reflect this.
|
||||
if (device.latestState("color") == null || (cmd.value == 0 && device.latestState("color").value != "#ffffff")) {
|
||||
sendEvent(name: "color", value: "#ffffff", displayed: true)
|
||||
}
|
||||
[name: "switch", value: cmd.value ? "on" : "off", type: "digital"]
|
||||
@@ -296,12 +275,12 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
||||
// ensure we are passing acceptable param values for LiteMin & TempMin configs
|
||||
def checkLiteTempInput(value) {
|
||||
if (value == null) {
|
||||
value=60
|
||||
value=6
|
||||
}
|
||||
def liteTempVal = value.toInteger()
|
||||
switch (liteTempVal) {
|
||||
case { it < 0 }:
|
||||
return 60 // bad value, set to default
|
||||
return 6 // bad value, set to default
|
||||
break
|
||||
case { it > 127 }:
|
||||
return 127 // bad value, greater then MAX, set to MAX
|
||||
@@ -314,12 +293,12 @@ def checkLiteTempInput(value) {
|
||||
// ensure we are passing acceptable param value for OnTime config
|
||||
def checkOnTimeInput(value) {
|
||||
if (value == null) {
|
||||
value=10
|
||||
value=2
|
||||
}
|
||||
def onTimeVal = value.toInteger()
|
||||
switch (onTimeVal) {
|
||||
case { it < 0 }:
|
||||
return 10 // bad value set to default
|
||||
return 2 // bad value set to default
|
||||
break
|
||||
case { it > 127 }:
|
||||
return 127 // bad value, greater then MAX, set to MAX
|
||||
|
||||
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
|
||||
}
|
||||
2
devicetypes/osotech/plantlink.src/.st-ignore
Normal file
2
devicetypes/osotech/plantlink.src/.st-ignore
Normal file
@@ -0,0 +1,2 @@
|
||||
.st-ignore
|
||||
README.md
|
||||
33
devicetypes/osotech/plantlink.src/README.md
Normal file
33
devicetypes/osotech/plantlink.src/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Osotech Plant Link
|
||||
|
||||
Cloud Execution
|
||||
|
||||
Works with:
|
||||
|
||||
* [OSO Technologies PlantLink Soil Moisture Sensor](https://www.smartthings.com/works-with-smartthings/oso-technologies/oso-technologies-plantlink-soil-moisture-sensor)
|
||||
|
||||
## Table of contents
|
||||
|
||||
* [Capabilities](#capabilities)
|
||||
* [Health](#device-health)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
|
||||
## Capabilities
|
||||
|
||||
* **Sensor** - detects sensor events
|
||||
* **Health Check** - indicates ability to get device health notifications
|
||||
|
||||
## Device Health
|
||||
|
||||
Plant Link sensor is a ZigBee sleepy device and checks in every 15 minutes.
|
||||
Device-Watch allows 2 check-in misses from device plus some lag time. So Check-in interval = (2*15 + 2)mins = 32 mins.
|
||||
|
||||
* __32min__ checkInterval
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If the device doesn't pair when trying from the SmartThings mobile app, it is possible that the sensor is out of range.
|
||||
Pairing needs to be tried again by placing the sensor closer to the hub.
|
||||
Instructions related to pairing, resetting and removing the different motion sensors from SmartThings can be found in the following links
|
||||
for the different models:
|
||||
* [OSO Technologies PlantLink Soil Moisture Sensor Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/206868986-PlantLink-Soil-Moisture-Sensor)
|
||||
@@ -24,6 +24,7 @@ import groovy.json.JsonBuilder
|
||||
metadata {
|
||||
definition (name: "PlantLink", namespace: "OsoTech", author: "Oso Technologies") {
|
||||
capability "Sensor"
|
||||
capability "Health Check"
|
||||
|
||||
command "setStatusIcon"
|
||||
command "setPlantFuelLevel"
|
||||
@@ -70,6 +71,16 @@ metadata {
|
||||
}
|
||||
}
|
||||
|
||||
def updated() {
|
||||
// Device-Watch allows 2 check-in misses from device
|
||||
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||
}
|
||||
|
||||
def installed() {
|
||||
// Device-Watch allows 2 check-in misses from device
|
||||
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||
}
|
||||
|
||||
def setStatusIcon(value){
|
||||
def status = ''
|
||||
switch (value) {
|
||||
@@ -161,4 +172,4 @@ def parseDescriptionAsMap(description) {
|
||||
map += []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
devicetypes/smartthings/arrival-sensor-ha.src/.st-ignore
Normal file
2
devicetypes/smartthings/arrival-sensor-ha.src/.st-ignore
Normal file
@@ -0,0 +1,2 @@
|
||||
.st-ignore
|
||||
README.md
|
||||
50
devicetypes/smartthings/arrival-sensor-ha.src/README.md
Normal file
50
devicetypes/smartthings/arrival-sensor-ha.src/README.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Arrival Sensor HA (2016+ Model)
|
||||
|
||||
Cloud Execution
|
||||
|
||||
Works with:
|
||||
|
||||
* [Samsung SmartThings Arrival Sensor](https://support.smartthings.com/hc/en-us/articles/212417083-Samsung-SmartThings-Arrival-Sensor)
|
||||
|
||||
## Table of contents
|
||||
|
||||
* [Capabilities](#capabilities)
|
||||
* [Health](#device-health)
|
||||
* [Battery](#battery)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
|
||||
|
||||
## Capabilities
|
||||
|
||||
* **Tone** - beep command to allow an audible tone
|
||||
* **Actuator** - device has commands
|
||||
* **Presence Sensor** - device tells presence with enum - {present, not present}
|
||||
* **Sensor** - device has attributes
|
||||
* **Battery** - defines device uses a battery
|
||||
* **Configuration** - _configure()_ command called when device is installed or device preferences updated
|
||||
* **Health Check** - indicates ability to get device health notifications
|
||||
|
||||
|
||||
## Device Health
|
||||
|
||||
Arrival Sensor ZigBee is an untracked device. Sends broadcast of battery level every 20 seconds.
|
||||
Disconnects when Hub goes OFFLINE.
|
||||
|
||||
|
||||
## Battery
|
||||
|
||||
Uses 1 CR2032 Battery
|
||||
|
||||
* [Changing the Battery](https://support.smartthings.com/hc/en-us/articles/200907400-How-to-change-the-battery-in-the-SmartSense-Presence-Sensor-and-Samsung-SmartThings-Arrival-Sensor)
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If the device doesn't pair when trying from the SmartThings mobile app, it is possible that the arrival sensor is out of range.
|
||||
Pairing needs to be tried again by placing the sensor closer to the hub.
|
||||
|
||||
* [Samsung SmartThings Arrival Sensor Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/205382134-Samsung-SmartThings-Arrival-Sensor-2015-model-)
|
||||
|
||||
If the arrival sensor doesn't update its status, here are a few things you can try to debug.
|
||||
|
||||
* [Troubleshooting: Samsung SmartThings Arrival Sensor won't update its status](https://support.smartthings.com/hc/en-us/articles/200846514-Troubleshooting-Samsung-SmartThings-Arrival-Sensor-won-t-update-its-status)
|
||||
@@ -1,3 +1,5 @@
|
||||
import groovy.json.JsonOutput
|
||||
|
||||
/**
|
||||
* Copyright 2017 SmartThings
|
||||
*
|
||||
@@ -19,6 +21,7 @@ metadata {
|
||||
capability "Sensor"
|
||||
capability "Battery"
|
||||
capability "Configuration"
|
||||
capability "Health Check"
|
||||
|
||||
fingerprint inClusters: "0000,0001,0003,000F,0020", outClusters: "0003,0019",
|
||||
manufacturer: "SmartThings", model: "tagv4", deviceJoinName: "Arrival Sensor"
|
||||
@@ -58,6 +61,11 @@ def updated() {
|
||||
startTimer()
|
||||
}
|
||||
|
||||
def installed() {
|
||||
// Arrival sensors only goes OFFLINE when Hub is off
|
||||
sendEvent(name: "DeviceWatch-Enroll", value: JsonOutput.toJson([protocol: "zigbee", scheme:"untracked"]), displayed: false)
|
||||
}
|
||||
|
||||
def configure() {
|
||||
def cmds = zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020) + zigbee.batteryConfig(20, 20, 0x01)
|
||||
log.debug "configure -- cmds: ${cmds}"
|
||||
|
||||
2
devicetypes/smartthings/arrival-sensor.src/.st-ignore
Normal file
2
devicetypes/smartthings/arrival-sensor.src/.st-ignore
Normal file
@@ -0,0 +1,2 @@
|
||||
.st-ignore
|
||||
README.md
|
||||
49
devicetypes/smartthings/arrival-sensor.src/README.md
Normal file
49
devicetypes/smartthings/arrival-sensor.src/README.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Arrival Sensor (2015 Model)
|
||||
|
||||
Cloud Execution
|
||||
|
||||
Works with:
|
||||
|
||||
* [Arrival Sensor](https://www.smartthings.com/products/samsung-smartthings-arrival-sensor)
|
||||
|
||||
## Table of contents
|
||||
|
||||
* [Capabilities](#capabilities)
|
||||
* [Health](#device-health)
|
||||
* [Battery](#battery)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
|
||||
|
||||
## Capabilities
|
||||
|
||||
* **Tone** - beep command to allow an audible tone
|
||||
* **Actuator** - device has commands
|
||||
* **Signal Strength** - device can read the strength of signal- lqi: Link Quality Indication, rssi: Received Signal Strength Indication
|
||||
* **Presence Sensor** - device tells presence with enum - {present, not present}
|
||||
* **Sensor** - device has attributes
|
||||
* **Battery** - defines device uses a battery
|
||||
* **Health Check** - indicates ability to get device health notifications
|
||||
|
||||
|
||||
## Device Health
|
||||
|
||||
Arrival Sensor ZigBee is an untracked device. Disconnects when Hub goes OFFLINE.
|
||||
|
||||
|
||||
## Battery
|
||||
|
||||
Uses 1 CR2032 Battery
|
||||
|
||||
* [Changing the Battery](https://support.smartthings.com/hc/en-us/articles/200907400-How-to-change-the-battery-in-the-SmartSense-Presence-Sensor-and-Samsung-SmartThings-Arrival-Sensor)
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If the device doesn't pair when trying from the SmartThings mobile app, it is possible that the arrival sensor is out of range.
|
||||
Pairing needs to be tried again by placing the sensor closer to the hub.
|
||||
|
||||
* [Samsung SmartThings Arrival Sensor Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/205382134-Samsung-SmartThings-Arrival-Sensor-2015-model-)
|
||||
|
||||
If the arrival sensor doesn't update its status, here are a few things you can try to debug.
|
||||
|
||||
* [Troubleshooting: Samsung SmartThings Arrival Sensor won't update its status](https://support.smartthings.com/hc/en-us/articles/200846514-Troubleshooting-Samsung-SmartThings-Arrival-Sensor-won-t-update-its-status)
|
||||
@@ -1,3 +1,5 @@
|
||||
import groovy.json.JsonOutput
|
||||
|
||||
/**
|
||||
* Copyright 2015 SmartThings
|
||||
*
|
||||
@@ -19,6 +21,7 @@ metadata {
|
||||
capability "Presence Sensor"
|
||||
capability "Sensor"
|
||||
capability "Battery"
|
||||
capability "Health Check"
|
||||
|
||||
fingerprint profileId: "FC01", deviceId: "019A"
|
||||
fingerprint profileId: "FC01", deviceId: "0131", inClusters: "0000,0003", outClusters: "0003"
|
||||
@@ -111,6 +114,11 @@ def beep() {
|
||||
]
|
||||
}
|
||||
|
||||
def installed() {
|
||||
// Arrival sensors only goes OFFLINE when Hub is off
|
||||
sendEvent(name: "DeviceWatch-Enroll", value: JsonOutput.toJson([protocol: "zigbee", scheme:"untracked"]), displayed: false)
|
||||
}
|
||||
|
||||
def parse(String description) {
|
||||
def results
|
||||
if (isBatteryMessage(description)) {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
*/
|
||||
metadata {
|
||||
definition (name: "Dimmer Switch", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch") {
|
||||
definition (name: "Dimmer Switch", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||
capability "Switch Level"
|
||||
capability "Actuator"
|
||||
capability "Indicator"
|
||||
|
||||
@@ -21,7 +21,7 @@ Works with:
|
||||
|
||||
## Device Health
|
||||
|
||||
Plant Link sensor is a Z-wave sleepy device and checks in every 15 minutes.
|
||||
Plant Link sensor is a ZigBee sleepy device and checks in every 15 minutes.
|
||||
Device-Watch allows 2 check-in misses from device plus some lag time. So Check-in interval = (2*15 + 2)mins = 32 mins.
|
||||
|
||||
* __32min__ checkInterval
|
||||
|
||||
2
devicetypes/smartthings/smartalert-siren.src/.st-ignore
Normal file
2
devicetypes/smartthings/smartalert-siren.src/.st-ignore
Normal file
@@ -0,0 +1,2 @@
|
||||
.st-ignore
|
||||
README.md
|
||||
39
devicetypes/smartthings/smartalert-siren.src/README.md
Normal file
39
devicetypes/smartthings/smartalert-siren.src/README.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Smartalert Siren
|
||||
|
||||
Cloud Execution
|
||||
|
||||
Works with:
|
||||
|
||||
* [FortrezZ Siren Strobe Alarm](https://www.smartthings.com/works-with-smartthings/other/fortrezz-water-valve)
|
||||
|
||||
## Table of contents
|
||||
|
||||
* [Capabilities](#capabilities)
|
||||
* [Health](#device-health)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
|
||||
## Capabilities
|
||||
|
||||
* **Actuator** - represents that a Device has commands
|
||||
* **Switch** - can detect state (possible values: on/off)
|
||||
* **Sensor** - detects sensor events
|
||||
* **Alarm** - allows for interacting with devices that serve as alarms
|
||||
* **Health Check** - indicates ability to get device health notifications
|
||||
|
||||
## Device Health
|
||||
|
||||
FortrezZ Siren Strobe Alarm is polled by the hub.
|
||||
As of hubCore version 0.14.38 the hub sends up reports every 15 minutes regardless of whether the state changed.
|
||||
Device-Watch allows 2 check-in misses from device plus some lag time. So Check-in interval = (2*15 + 2)mins = 32 mins.
|
||||
Not to mention after going OFFLINE when the device is plugged back in, it might take a considerable amount of time for
|
||||
the device to appear as ONLINE again. This is because if this listening device does not respond to two poll requests in a row,
|
||||
it is not polled for 5 minutes by the hub. This can delay up the process of being marked ONLINE by quite some time.
|
||||
|
||||
* __32min__ checkInterval
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If the device doesn't pair when trying from the SmartThings mobile app, it is possible that the device is out of range.
|
||||
Pairing needs to be tried again by placing the device closer to the hub.
|
||||
Instructions related to pairing, resetting and removing the device from SmartThings can be found in the following link:
|
||||
* [FortrezZ Siren Strobe Alarm Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/202294760-FortrezZ-Siren-Strobe-Alarm)
|
||||
@@ -21,10 +21,12 @@ metadata {
|
||||
capability "Switch"
|
||||
capability "Sensor"
|
||||
capability "Alarm"
|
||||
capability "Health Check"
|
||||
|
||||
command "test"
|
||||
|
||||
fingerprint deviceId: "0x1100", inClusters: "0x26,0x71"
|
||||
fingerprint mfr:"0084", prod:"0313", model:"010B", deviceJoinName: "FortrezZ Siren Strobe Alarm"
|
||||
}
|
||||
|
||||
simulator {
|
||||
@@ -68,6 +70,16 @@ metadata {
|
||||
}
|
||||
}
|
||||
|
||||
def installed() {
|
||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
||||
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||
}
|
||||
|
||||
def updated() {
|
||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
||||
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||
}
|
||||
|
||||
def on() {
|
||||
[
|
||||
zwave.basicV1.basicSet(value: 0xFF).format(),
|
||||
@@ -149,3 +161,10 @@ def createEvents(physicalgraph.zwave.commands.basicv1.BasicReport cmd)
|
||||
def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
||||
log.warn "UNEXPECTED COMMAND: $cmd"
|
||||
}
|
||||
|
||||
/**
|
||||
* PING is used by Device-Watch in attempt to reach the Device
|
||||
* */
|
||||
def ping() {
|
||||
secure(zwave.basicV1.basicGet())
|
||||
}
|
||||
@@ -33,7 +33,6 @@ metadata {
|
||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05,FC02", outClusters: "0019", manufacturer: "CentraLite", model: "3320"
|
||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05,FC02", outClusters: "0019", manufacturer: "CentraLite", model: "3321"
|
||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05,FC02", outClusters: "0019", manufacturer: "CentraLite", model: "3321-S", deviceJoinName: "Multipurpose Sensor"
|
||||
fingerprint inClusters: "0000,0001,0003,0020,0402,0500,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3323-G", deviceJoinName: "Centralite Micro Door Sensor"
|
||||
fingerprint inClusters: "0000,0001,0003,000F,0020,0402,0500,FC02", outClusters: "0019", manufacturer: "SmartThings", model: "multiv4", deviceJoinName: "Multipurpose Sensor"
|
||||
|
||||
attribute "status", "string"
|
||||
@@ -192,6 +191,10 @@ private List<Map> parseAxis(List<Map> attrData) {
|
||||
def y = hexToSignedInt(attrData.find { it.attrInt == 0x0013 }?.value)
|
||||
def z = hexToSignedInt(attrData.find { it.attrInt == 0x0014 }?.value)
|
||||
|
||||
if ([x, y ,z].any { it == null }) {
|
||||
return []
|
||||
}
|
||||
|
||||
def xyzResults = [:]
|
||||
if (device.getDataValue("manufacturer") == "SmartThings") {
|
||||
// This mapping matches the current behavior of the Device Handler for the Centralite sensors
|
||||
@@ -372,6 +375,10 @@ def updated() {
|
||||
}
|
||||
|
||||
private hexToSignedInt(hexVal) {
|
||||
if (!hexVal) {
|
||||
return null
|
||||
}
|
||||
|
||||
def unsignedVal = hexToInt(hexVal)
|
||||
unsignedVal > 32767 ? unsignedVal - 65536 : unsignedVal
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ metadata {
|
||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3300-S"
|
||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3300"
|
||||
fingerprint inClusters: "0000,0001,0003,0020,0402,0500,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3320-L", deviceJoinName: "Iris Contact Sensor"
|
||||
fingerprint inClusters: "0000,0001,0003,0020,0402,0500,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3323-G", deviceJoinName: "Centralite Micro Door Sensor"
|
||||
}
|
||||
|
||||
simulator {
|
||||
|
||||
@@ -70,19 +70,27 @@ def parse(String description) {
|
||||
else {
|
||||
sendEvent(event)
|
||||
}
|
||||
}
|
||||
else {
|
||||
def cluster = zigbee.parse(description)
|
||||
if (cluster && cluster.clusterId == 0x0006 && cluster.command == 0x07) {
|
||||
if (cluster.data[0] == 0x00){
|
||||
} else {
|
||||
def descMap = zigbee.parseDescriptionAsMap(description)
|
||||
if (descMap && descMap.clusterInt == 0x0006 && descMap.commandInt == 0x07) {
|
||||
if (descMap.data[0] == "00") {
|
||||
log.debug "ON/OFF REPORTING CONFIG RESPONSE: " + cluster
|
||||
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
log.warn "ON/OFF REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else if (device.getDataValue("manufacturer") == "sengled" && descMap && descMap.clusterInt == 0x0008 && descMap.attrInt == 0x0000) {
|
||||
// This is being done because the sengled element touch incorrectly uses the value 0xFF for the max level.
|
||||
// Per the ZCL spec for the UINT8 data type 0xFF is an invalid value, and 0xFE should be the max. Here we
|
||||
// manually handle the invalid attribute value since it will be ignored by getEvent as an invalid value.
|
||||
// We also set the level of the bulb to 0xFE so future level reports will be 0xFE until it is changed by
|
||||
// something else.
|
||||
if (descMap.value.toUpperCase() == "FF") {
|
||||
descMap.value = "FE"
|
||||
}
|
||||
sendHubCommand(zigbee.command(zigbee.LEVEL_CONTROL_CLUSTER, 0x00, "FE0000").collect { new physicalgraph.device.HubAction(it) }, 0)
|
||||
sendEvent(zigbee.getEventFromAttrData(descMap.clusterInt, descMap.attrInt, descMap.encoding, descMap.value))
|
||||
} else {
|
||||
log.warn "DID NOT PARSE MESSAGE for description : $description"
|
||||
log.debug zigbee.parseDescriptionAsMap(description)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Z-Wave Switch
|
||||
# Z-Wave Lock
|
||||
|
||||
Cloud Execution
|
||||
|
||||
@@ -6,7 +6,6 @@ Works with:
|
||||
|
||||
* [Yale Key Free Touchscreen Deadbolt (YRD240)](https://www.smartthings.com/works-with-smartthings/yale/yale-key-free-touchscreen-deadbolt-yrd240)
|
||||
|
||||
|
||||
## Table of contents
|
||||
|
||||
* [Capabilities](#capabilities)
|
||||
@@ -41,5 +40,3 @@ If the device doesn't pair when trying from the SmartThings mobile app, it is po
|
||||
Pairing needs to be tried again by placing the device closer to the hub.
|
||||
Instructions related to pairing, resetting and removing the device from SmartThings can be found in the following link:
|
||||
* [General Z-Wave/ZigBee Yale Lock Troubleshooting](https://support.smartthings.com/hc/en-us/articles/205138400-How-to-connect-Yale-locks)
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
*/
|
||||
metadata {
|
||||
definition (name: "Z-Wave Metering Dimmer", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch") {
|
||||
definition (name: "Z-Wave Metering Dimmer", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||
capability "Switch"
|
||||
capability "Polling"
|
||||
capability "Power Meter"
|
||||
|
||||
@@ -1,711 +0,0 @@
|
||||
definition(
|
||||
name: "app.home.ai",
|
||||
namespace: "app.home.ai",
|
||||
author: "Eric Greer",
|
||||
description: "SmartThings SmartApp for app.home.ai.",
|
||||
category: "Fun & Social",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
|
||||
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
|
||||
)
|
||||
|
||||
// These are preferences displayed in the smart phone app
|
||||
preferences {
|
||||
// we need a settings section to enable subscriptions
|
||||
section("Pick which devices home.ai will help you automate:"){
|
||||
input "motion", "capability.motionSensor", title: "Choose motion sensors", required: false, multiple: true
|
||||
input "contact", "capability.contactSensor", title: "Choose contact sensors", required: false, multiple: true
|
||||
input "lightswitch", "capability.switch", title: "Choose normal power switches", required: false, multiple: true
|
||||
input "lightswitchlevel", "capability.switchLevel", title: "Choose dimmer power switches", required: false, multiple: true
|
||||
input "presence", "capability.presenceSensor", title: "Choose presence sensors", required: false, multiple: true
|
||||
// removed in prod until dual-signal devices are supported
|
||||
//input "tempSensor", "capability.temperatureMeasurement", title: "Choose temperature sensors", required: false, multiple: true
|
||||
//input "humidity", "capability.relativeHumidityMeasurement", title: "Choose humidity sensors", required: false, multiple: true
|
||||
input "waterSensor", "capability.waterSensor", title: "Choose water sensors", required: false, multiple: true
|
||||
input "lock", "capability.lock", title: "Pick Door Locks", required: false, multiple: true
|
||||
input "garagedoor", "capability.garageDoorControl", title: "Pick garage doors", required: false, multiple: true
|
||||
input "touchsensor", "capability.touchSensor", title: "Pick touch sensors", required: false, multiple: true
|
||||
input "speechparser", "capability.speechRecognition", title: "Pick speech recognizers", required: false, multiple: true
|
||||
input "soundsensor", "capability.soundSensor", title: "Pick sound sensors", required: false, multiple: true
|
||||
input "smokedetector", "capability.smokeDetector", title: "Pick smoke detectors", required: false, multiple: true
|
||||
input "sleepsensor", "capability.sleepSensor", title: "Pick sleep sensors", required: false, multiple: true
|
||||
input "carbonsensor", "capability.carbonMonoxideDetector", title: "Pick carbon monoxide detectors", required: false, multiple: true
|
||||
input "button", "capability.button", title: "Pick buttons", required: false, multiple: true
|
||||
input "beacon", "capability.beacon", title: "Pick beacons", required: false, multiple: true
|
||||
input "alarm", "capability.alarm", title: "Pick alarms", required: false, multiple: true
|
||||
input "thermostat", "capability.thermostat", title: "Pick thermostats", required: false, multiple: true
|
||||
input "voltage", "capability.voltageMeasurement", title: "Pick voltage sensors", required: false, multiple: true
|
||||
input "windowshade", "capability.windowShade", title: "Pick window shades", required: false, multiple: true
|
||||
input "powermeter", "capability.powerMeter", title: "Pick power meters", required: false, multiple: true
|
||||
}
|
||||
}
|
||||
|
||||
// vlaues for security system are 'away', 'stay', or 'off'
|
||||
// off security
|
||||
def offSecurity() {
|
||||
sendLocationEvent(
|
||||
name: "alarmSystemStatus",
|
||||
value: "off",
|
||||
displayed: false,
|
||||
isStateChange: true)
|
||||
}
|
||||
|
||||
// stay security
|
||||
def staySecurity() {
|
||||
sendLocationEvent(
|
||||
name: "alarmSystemStatus",
|
||||
value: "stay",
|
||||
displayed: false,
|
||||
isStateChange: true)
|
||||
}
|
||||
|
||||
// away security
|
||||
def awaySecurity() {
|
||||
sendLocationEvent(
|
||||
name: "alarmSystemStatus",
|
||||
value: "away",
|
||||
displayed: false,
|
||||
isStateChange: true)
|
||||
}
|
||||
|
||||
// sets window shade open temperature
|
||||
def setWindowShadeOpen() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setWindowShadeOpen command recieved ${deviceID}")
|
||||
windowshade.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating window shade because it is the one specified: ${deviceID}");
|
||||
it.open()
|
||||
} else {
|
||||
log.debug("NOT operting window shade because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets window shade close temperature
|
||||
def setWindowShadeClosed() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setWindowShadeClosed command recieved ${deviceID}")
|
||||
windowshade.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating window shade because it is the one specified: ${deviceID}");
|
||||
it.close()
|
||||
} else {
|
||||
log.debug("NOT operting window shade because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat heating temperature
|
||||
def setThermostatHeatTemp() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatHeat command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setHeatingSetpoint(params.temp)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat cooling temperature
|
||||
def setThermostatCoolTemp() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatCool command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setCoolingSetpoint(params.temp)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat off
|
||||
def setThermostatOff() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatOff command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.off()
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat to heat
|
||||
def setThermostatHeat() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatHeat command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.heat()
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat to cool
|
||||
def setThermostatCool() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatCool command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.cool()
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat mode
|
||||
def setThermostatMode() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatMode command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setThermostatMode(params.mode)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat fan mode
|
||||
def setThermostatFanMode() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatFanMode command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setThermostatFanMode(params.mode)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sends an alarm strobe
|
||||
def strobeAlarm() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Alarm strobe command recieved ${deviceID}")
|
||||
alarm.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating alarm because it is the one specified: ${deviceID}");
|
||||
it.strobe()
|
||||
} else {
|
||||
log.debug("NOT operting alarm because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sends an alarm siren
|
||||
def sirenAlarm() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Alarm siren command recieved ${deviceID}")
|
||||
alarm.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating alarm because it is the one specified: ${deviceID}");
|
||||
it.siren()
|
||||
} else {
|
||||
log.debug("NOT operting alarm because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// disables an alarm siren
|
||||
def silenceAlarm() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Alarm silence command recieved ${deviceID}")
|
||||
alarm.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating alarm because it is the one specified: ${deviceID}");
|
||||
it.off()
|
||||
} else {
|
||||
log.debug("NOT operting alarm because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// opens a garage door
|
||||
def openGarage() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Open Garage command recieved ${deviceID}")
|
||||
garagedoor.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating garage door because it is the one specified: ${deviceID}");
|
||||
it.open()
|
||||
} else {
|
||||
log.debug("NOT operting garage door device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// closes a garage door
|
||||
def closeGarage() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Close Garage command recieved ${deviceID}")
|
||||
garagedoor.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating garage door because it is the one specified: ${deviceID}");
|
||||
it.close()
|
||||
} else {
|
||||
log.debug("NOT operting garage door device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// lock locks a door lock
|
||||
def lockDoor() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Lock command recieved ${deviceID}")
|
||||
lock.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating lock device because it is the one specified: ${deviceID}");
|
||||
it.lock()
|
||||
} else {
|
||||
log.debug("NOT operting lock device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unlock unlocks a door lock
|
||||
def unlockDoor() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Unlock command recieved ${deviceID}")
|
||||
lock.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating lock device because it is the one specified: ${deviceID}");
|
||||
it.unlock()
|
||||
} else {
|
||||
log.debug("NOT operting lock device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// turns on a wall switch as instructed from the homeai webservice
|
||||
def switchOn() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Switch on command recieved ${deviceID}")
|
||||
lightswitch.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating switch device because it is the one specified: ${deviceID}");
|
||||
it.on()
|
||||
} else {
|
||||
log.debug("Skipping switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// turns off a wall switch as instructed from the homeai webservice
|
||||
def switchOff() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Switch off desired for ${deviceID}")
|
||||
lightswitch.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating switch device because it is the one specified: ${deviceID}");
|
||||
it.off()
|
||||
} else {
|
||||
log.debug("Skipping switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fetch the id of this smartthings hub
|
||||
def hubId() {
|
||||
log.debug("hub id requested.")
|
||||
def response = [hubId: location.hubs.id[0]]
|
||||
}
|
||||
|
||||
// This handles requests for device inventories
|
||||
def inventory() {
|
||||
def response = []
|
||||
|
||||
lightswitch.each {
|
||||
response << [name: it.displayName, value: it.currentValue("switch"), deviceId: it.id, type: "lightSwitch"]
|
||||
}
|
||||
|
||||
contact.each {
|
||||
response << [name: it.displayName, value: it.currentValue("contact"), deviceId: it.id, type: "contact"]
|
||||
}
|
||||
|
||||
|
||||
motion.each {
|
||||
response << [name: it.displayName, value: it.currentValue("motion"), deviceId: it.id, type: "motion"]
|
||||
}
|
||||
|
||||
presence.each {
|
||||
response << [name: it.displayName, value: it.currentValue("presence"), deviceId: it.id, type: "presence"]
|
||||
}
|
||||
|
||||
// removed until dual device functions are supported on the backend
|
||||
//tempSensor.each {
|
||||
// response << [name: it.displayName, value: it.currentValue("temperature"), deviceId: it.id, type: "tempSensor"]
|
||||
//}
|
||||
|
||||
//humidity.each {
|
||||
// response << [name: it.displayName, value: it.currentValue("humidity"), deviceId: it.id, type: "humiditySensor"]
|
||||
//}
|
||||
|
||||
|
||||
waterSensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("water"), deviceId: it.id, type: "waterSensor"]
|
||||
}
|
||||
|
||||
lock.each {
|
||||
response << [name: it.displayName, value: it.currentValue("lock"), deviceId: it.id, type: "lock"]
|
||||
}
|
||||
|
||||
|
||||
garagedoor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("door"), deviceId: it.id, type: "garagedoor"]
|
||||
}
|
||||
|
||||
|
||||
touchsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("touch"), deviceId: it.id, type: "touchsensor"]
|
||||
}
|
||||
|
||||
|
||||
speechparser.each {
|
||||
response << [name: it.displayName, value: it.currentValue("phraseSpoken"), deviceId: it.id, type: "speechparser"]
|
||||
}
|
||||
|
||||
|
||||
soundsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("sound"), deviceId: it.id, type: "sound"]
|
||||
}
|
||||
|
||||
|
||||
smokedetector.each {
|
||||
response << [name: it.displayName, value: it.currentValue("smoke"), deviceId: it.id, type: "smoke"]
|
||||
}
|
||||
|
||||
|
||||
sleepsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("sleeping"), deviceId: it.id, type: "sleepsensor"]
|
||||
}
|
||||
|
||||
|
||||
carbonsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("carbonMonoxide"), deviceId: it.id, type: "carbonsensor"]
|
||||
}
|
||||
|
||||
|
||||
button.each {
|
||||
response << [name: it.displayName, value: it.currentValue("button"), deviceId: it.id, type: "button"]
|
||||
}
|
||||
|
||||
|
||||
beacon.each {
|
||||
response << [name: it.displayName, value: it.currentValue("presence"), deviceId: it.id, type: "beacon"]
|
||||
}
|
||||
|
||||
|
||||
alarm.each {
|
||||
response << [name: it.displayName, value: it.currentValue("alarm"), deviceId: it.id, type: "alarm"]
|
||||
}
|
||||
|
||||
|
||||
thermostat.each {
|
||||
response << [name: it.displayName, value: it.currentValue("thermostatMode"), deviceId: it.id, type: "thermostat"]
|
||||
}
|
||||
|
||||
|
||||
voltage.each {
|
||||
response << [name: it.displayName, value: it.currentValue("voltage"), deviceId: it.id, type: "voltage"]
|
||||
}
|
||||
|
||||
|
||||
windowshade.each {
|
||||
response << [name: it.displayName, value: it.currentValue("windowShade"), deviceId: it.id, type: "windowshade"]
|
||||
}
|
||||
|
||||
|
||||
powermeter.each {
|
||||
response << [name: it.displayName, value: it.currentValue("power"), deviceId: it.id, type: "powermeter"]
|
||||
}
|
||||
|
||||
|
||||
lightswitchlevel.each {
|
||||
response << [name: it.displayName, value: it.currentValue("level"), deviceId: it.id, type: "lightswitchlevel"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
log.debug("Inventory request processed. Response: " + response)
|
||||
return response
|
||||
}
|
||||
|
||||
// After the user hits the 'install' button in the mobile app
|
||||
def installed() {
|
||||
initialize()
|
||||
}
|
||||
|
||||
// After app settings are changed. All subscriptions are wiped before this is invoked by smartthings.
|
||||
def updated() {
|
||||
unsubscribe()
|
||||
initialize()
|
||||
}
|
||||
|
||||
// This appears to be what the tutorials meant to use in the examples
|
||||
def initialize() {
|
||||
|
||||
// SHM subscription
|
||||
// evt.value will be "off", "stay", or "away"
|
||||
subscribe(location, "alarmSystemStatus", eventForwarder)
|
||||
|
||||
|
||||
// motion sensor subscription
|
||||
subscribe(motion, "motion", eventForwarder)
|
||||
|
||||
|
||||
// Contact sensor subscription
|
||||
subscribe(contact, "contact", eventForwarder)
|
||||
|
||||
|
||||
// power plug subscription
|
||||
subscribe(lightswitch, "switch", eventForwarder)
|
||||
|
||||
|
||||
// presence sensor subscription
|
||||
subscribe(presence, "presence", eventForwarder)
|
||||
|
||||
|
||||
// temperature sensor subscription
|
||||
subscribe(tempSensor, "temperature", eventForwarder)
|
||||
|
||||
|
||||
// water sensor subscription
|
||||
subscribe(waterSensor, "water", eventForwarder)
|
||||
|
||||
|
||||
// humidity sensor subscription
|
||||
subscribe(humidity, "humidity", eventForwarder)
|
||||
|
||||
|
||||
// lock subscription
|
||||
subscribe(lock, "lock", eventForwarder)
|
||||
|
||||
|
||||
// garage door subscription
|
||||
subscribe(garagedoor, "garagedoor", eventForwarder)
|
||||
|
||||
|
||||
// touch sensor subscription
|
||||
subscribe(touchsensor, "touchsensor", eventForwarder)
|
||||
|
||||
|
||||
// speech parser subscription
|
||||
subscribe(speechparser, "phraseSpoken", eventForwarder)
|
||||
|
||||
|
||||
// sound sensor subscription
|
||||
subscribe(soundsensor, "sound", eventForwarder)
|
||||
|
||||
|
||||
// smoke detector subscription
|
||||
subscribe(smokedetector, "smoke", eventForwarder)
|
||||
|
||||
|
||||
// sleep sensor subscription
|
||||
subscribe(sleepsensor, "sleeping", eventForwarder)
|
||||
|
||||
|
||||
// carbon monoxide sensor subscription
|
||||
subscribe(carbonsensor, "carbonMonoxide", eventForwarder)
|
||||
|
||||
|
||||
// button subscription
|
||||
subscribe(button, "button", eventForwarder)
|
||||
|
||||
|
||||
// beacon subscription
|
||||
subscribe(beacon, "presence", eventForwarder)
|
||||
|
||||
|
||||
// alarm subscription
|
||||
subscribe(alarm, "alarm", eventForwarder)
|
||||
|
||||
// thermostat subscriptions
|
||||
subscribe(thermostat, "temperature", eventForwarder)
|
||||
subscribe(thermostat, "heatingSetpoint", eventForwarder)
|
||||
subscribe(thermostat, "coolingSetpoint", eventForwarder)
|
||||
subscribe(thermostat, "thermostatSetpoint", eventForwarder)
|
||||
subscribe(thermostat, "thermostatMode", eventForwarder)
|
||||
subscribe(thermostat, "thermostatFanMode", eventForwarder)
|
||||
subscribe(thermostat, "thermostatOperatingState", eventForwarder)
|
||||
|
||||
// voltage subscription
|
||||
subscribe(voltage, "voltage", eventForwarder)
|
||||
|
||||
// window shade subscription
|
||||
subscribe(windowshade, "windowShade", eventForwarder)
|
||||
|
||||
// shm events
|
||||
subscribe(location, "alarmSystemStatus", shmEventForwarder)
|
||||
|
||||
// power meter subscription
|
||||
subscribe(powermeter, "power", eventForwarder)
|
||||
|
||||
// level switch (dimmer switch)
|
||||
subscribe(lightswitchlevel, "level", eventForwarder)
|
||||
|
||||
}
|
||||
|
||||
def shmEventForwarder(evt) {
|
||||
// evt.value will be "off", "stay", or "away"
|
||||
log.debug("FORWARDING SHM CHANGE" + evt.value + " " + evt.hub.id)
|
||||
|
||||
def deviceState = evt.value
|
||||
def deviceId = "smarthomemonitor"
|
||||
def hubId = hubId()
|
||||
def params = [
|
||||
uri: "https://app.home.ai",
|
||||
path: "/smartThingsPostback/shmStateChange/${hubId}/${deviceId}/${deviceState}"
|
||||
]
|
||||
log.info(params)
|
||||
httpGet(params)
|
||||
}
|
||||
|
||||
// This is used to forward events to the home.ai webservice
|
||||
def eventForwarder(evt) {
|
||||
|
||||
def hubId = location.hubs.id[0]
|
||||
|
||||
log.debug(params.uri + " " + params.path)
|
||||
log.debug("FORWARDING EVENT" + evt.deviceId + " " + evt.value + " " + hubId)
|
||||
|
||||
def deviceId = evt.deviceId
|
||||
def deviceState = evt.value
|
||||
def params = [
|
||||
uri: "https://app.home.ai",
|
||||
path: "/smartThingsPostback/stateChange/${hubId}/${deviceId}/${deviceState}"
|
||||
]
|
||||
log.info(params)
|
||||
httpGet(params)
|
||||
}
|
||||
|
||||
// Mappings that serve web requests against our smart app
|
||||
mappings {
|
||||
path("/inventory") {
|
||||
action: [
|
||||
GET: "inventory"
|
||||
]
|
||||
}
|
||||
path("/hubId") {
|
||||
action: [
|
||||
GET: "hubId"
|
||||
]
|
||||
}
|
||||
path("/switchOn/:deviceID") {
|
||||
action: [
|
||||
GET: "switchOn"
|
||||
]
|
||||
}
|
||||
path("/switchOff/:deviceID") {
|
||||
action: [
|
||||
GET: "switchOff"
|
||||
]
|
||||
}
|
||||
path("/lock/:deviceID") {
|
||||
action: [
|
||||
GET: "lockDoor"
|
||||
]
|
||||
}
|
||||
path("/unlock/:deviceID") {
|
||||
action: [
|
||||
GET: "unlockDoor"
|
||||
]
|
||||
}
|
||||
path("/opengarage/:deviceID") {
|
||||
action: [
|
||||
GET: "openGarage"
|
||||
]
|
||||
}
|
||||
path("/closegarage/:deviceID") {
|
||||
action: [
|
||||
GET: "closeGarage"
|
||||
]
|
||||
}
|
||||
path("/strobeAlarm/:deviceID") {
|
||||
action: [
|
||||
GET: "strobeAlarm"
|
||||
]
|
||||
}
|
||||
path("/sirenAlarm/:deviceID") {
|
||||
action: [
|
||||
GET: "sirenAlarm"
|
||||
]
|
||||
}
|
||||
path("/silenceAlarm/:deviceID") {
|
||||
action: [
|
||||
GET: "silenceAlarm"
|
||||
]
|
||||
}
|
||||
path("/setThermostatHeatTemp/:deviceID/:temp") {
|
||||
action: [
|
||||
GET: "setThermostatHeatTemp"
|
||||
]
|
||||
}
|
||||
path("/setThermostatCoolTemp/:deviceID/:temp") {
|
||||
action: [
|
||||
GET: "setThermostatCoolTemp"
|
||||
]
|
||||
}
|
||||
path("/setThermostatHeat/:deviceID") {
|
||||
action: [
|
||||
GET: "setThermostatHeat"
|
||||
]
|
||||
}
|
||||
path("/setThermostatCool/:deviceID") {
|
||||
action: [
|
||||
GET: "setThermostatCool"
|
||||
]
|
||||
}
|
||||
path("/setThermostatMode/:deviceID/:mode") {
|
||||
action: [
|
||||
GET: "setThermostatMode"
|
||||
]
|
||||
}
|
||||
path("/setThermostatFanMode/:deviceID/:mode") {
|
||||
action: [
|
||||
GET: "setThermostatFanMode"
|
||||
]
|
||||
}
|
||||
path("/closeWindowShade/:deviceID") {
|
||||
action: [
|
||||
GET: "setWindowShadeClosed"
|
||||
]
|
||||
}
|
||||
path("/openWindowShade/:deviceID") {
|
||||
action: [
|
||||
GET: "setWindowShadeOpen"
|
||||
]
|
||||
}
|
||||
path("/awaySecurity") {
|
||||
action: [
|
||||
GET: "awaySecurity"
|
||||
]
|
||||
}
|
||||
path("/staySecurity") {
|
||||
action: [
|
||||
GET: "staySecurity"
|
||||
]
|
||||
}
|
||||
path("/offSecurity") {
|
||||
action: [
|
||||
GET: "offSecurity"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,829 +0,0 @@
|
||||
definition(
|
||||
name: "demo.home.ai",
|
||||
namespace: "demo.home.ai",
|
||||
author: "Eric Greer",
|
||||
description: "SmartThings demo SmartApp for home.ai.",
|
||||
category: "Fun & Social",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
|
||||
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
|
||||
)
|
||||
|
||||
// These are preferences displayed in the smart phone app
|
||||
preferences {
|
||||
// we need a settings section to enable subscriptions
|
||||
section("Pick which devices home.ai will help you automate:"){
|
||||
input "motion", "capability.motionSensor", title: "Choose motion sensors", required: false, multiple: true
|
||||
input "contact", "capability.contactSensor", title: "Choose contact sensors", required: false, multiple: true
|
||||
input "lightswitch", "capability.switch", title: "Choose normal power switches", required: false, multiple: true
|
||||
input "lightswitchlevel", "capability.switchLevel", title: "Choose dimmer power switches", required: false, multiple: true
|
||||
input "presence", "capability.presenceSensor", title: "Choose presence sensors", required: false, multiple: true
|
||||
input "tempSensor", "capability.temperatureMeasurement", title: "Choose temperature sensors", required: false, multiple: true
|
||||
input "humidity", "capability.relativeHumidityMeasurement", title: "Choose humidity sensors", required: false, multiple: true
|
||||
input "waterSensor", "capability.waterSensor", title: "Choose water sensors", required: false, multiple: true
|
||||
input "lock", "capability.lock", title: "Pick Door Locks", required: false, multiple: true
|
||||
input "garagedoor", "capability.garageDoorControl", title: "Pick garage doors", required: false, multiple: true
|
||||
input "touchsensor", "capability.touchSensor", title: "Pick touch sensors", required: false, multiple: true
|
||||
input "speechparser", "capability.speechRecognition", title: "Pick speech recognizers", required: false, multiple: true
|
||||
input "soundsensor", "capability.soundSensor", title: "Pick sound sensors", required: false, multiple: true
|
||||
input "smokedetector", "capability.smokeDetector", title: "Pick smoke detectors", required: false, multiple: true
|
||||
input "sleepsensor", "capability.sleepSensor", title: "Pick sleep sensors", required: false, multiple: true
|
||||
input "carbonsensor", "capability.carbonMonoxideDetector", title: "Pick carbon monoxide detectors", required: false, multiple: true
|
||||
input "button", "capability.button", title: "Pick buttons", required: false, multiple: true
|
||||
input "beacon", "capability.beacon", title: "Pick beacons", required: false, multiple: true
|
||||
input "alarm", "capability.alarm", title: "Pick alarms", required: false, multiple: true
|
||||
input "thermostat", "capability.thermostat", title: "Pick thermostats", required: false, multiple: true
|
||||
input "voltage", "capability.voltageMeasurement", title: "Pick voltage sensors", required: false, multiple: true
|
||||
input "windowshade", "capability.windowShade", title: "Pick window shades", required: false, multiple: true
|
||||
input "powermeter", "capability.powerMeter", title: "Pick power meters", required: false, multiple: true
|
||||
}
|
||||
}
|
||||
|
||||
// vlaues for security system are 'away', 'stay', or 'off'
|
||||
// off security
|
||||
def offSecurity() {
|
||||
sendLocationEvent(
|
||||
name: "alarmSystemStatus",
|
||||
value: "off",
|
||||
displayed: false,
|
||||
isStateChange: true)
|
||||
}
|
||||
|
||||
// stay security
|
||||
def staySecurity() {
|
||||
sendLocationEvent(
|
||||
name: "alarmSystemStatus",
|
||||
value: "stay",
|
||||
displayed: false,
|
||||
isStateChange: true)
|
||||
}
|
||||
|
||||
// away security
|
||||
def awaySecurity() {
|
||||
sendLocationEvent(
|
||||
name: "alarmSystemStatus",
|
||||
value: "away",
|
||||
displayed: false,
|
||||
isStateChange: true)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// sets window shade open temperature
|
||||
def setWindowShadeOpen() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setWindowShadeOpen command recieved ${deviceID}")
|
||||
windowshade.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating window shade because it is the one specified: ${deviceID}");
|
||||
it.open()
|
||||
} else {
|
||||
log.debug("NOT operting window shade because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets window shade close temperature
|
||||
def setWindowShadeClosed() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setWindowShadeClosed command recieved ${deviceID}")
|
||||
windowshade.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating window shade because it is the one specified: ${deviceID}");
|
||||
it.close()
|
||||
} else {
|
||||
log.debug("NOT operting window shade because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// sets thermostat heating temperature
|
||||
def setThermostatHeatTemp() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatHeat command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setHeatingSetpoint(params.temp)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat cooling temperature
|
||||
def setThermostatCoolTemp() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatCool command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setCoolingSetpoint(params.temp)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat off
|
||||
def setThermostatOff() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatOff command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.off()
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sets thermostat to heat
|
||||
def setThermostatHeat() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatHeat command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.heat()
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sets thermostat to cool
|
||||
def setThermostatCool() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatCool command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.cool()
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sets thermostat mode
|
||||
def setThermostatMode() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatMode command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setThermostatMode(params.mode)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
// sets thermostat fan mode
|
||||
def setThermostatFanMode() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatFanMode command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setThermostatFanMode(params.mode)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// sends an alarm strobe
|
||||
def strobeAlarm() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Alarm strobe command recieved ${deviceID}")
|
||||
alarm.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating alarm because it is the one specified: ${deviceID}");
|
||||
it.strobe()
|
||||
} else {
|
||||
log.debug("NOT operting alarm because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sends an alarm siren
|
||||
def sirenAlarm() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Alarm siren command recieved ${deviceID}")
|
||||
alarm.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating alarm because it is the one specified: ${deviceID}");
|
||||
it.siren()
|
||||
} else {
|
||||
log.debug("NOT operting alarm because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// disables an alarm siren
|
||||
def silenceAlarm() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Alarm silence command recieved ${deviceID}")
|
||||
alarm.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating alarm because it is the one specified: ${deviceID}");
|
||||
it.off()
|
||||
} else {
|
||||
log.debug("NOT operting alarm because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// opens a garage door
|
||||
def openGarage() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Open Garage command recieved ${deviceID}")
|
||||
garagedoor.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating garage door because it is the one specified: ${deviceID}");
|
||||
it.open()
|
||||
} else {
|
||||
log.debug("NOT operting garage door device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// closes a garage door
|
||||
def closeGarage() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Close Garage command recieved ${deviceID}")
|
||||
garagedoor.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating garage door because it is the one specified: ${deviceID}");
|
||||
it.close()
|
||||
} else {
|
||||
log.debug("NOT operting garage door device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// lock locks a door lock
|
||||
def lockDoor() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Lock command recieved ${deviceID}")
|
||||
lock.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating lock device because it is the one specified: ${deviceID}");
|
||||
it.lock()
|
||||
} else {
|
||||
log.debug("NOT operting lock device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unlock unlocks a door lock
|
||||
def unlockDoor() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Unlock command recieved ${deviceID}")
|
||||
lock.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating lock device because it is the one specified: ${deviceID}");
|
||||
it.unlock()
|
||||
} else {
|
||||
log.debug("NOT operting lock device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// turns on a wall switch as instructed from the homeai webservice
|
||||
def switchOn() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Switch on command recieved ${deviceID}")
|
||||
lightswitch.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating switch device because it is the one specified: ${deviceID}");
|
||||
it.on()
|
||||
} else {
|
||||
log.debug("Skipping switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// turns off a wall switch as instructed from the homeai webservice
|
||||
def switchOff() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Switch off desired for ${deviceID}")
|
||||
lightswitch.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating switch device because it is the one specified: ${deviceID}");
|
||||
it.off()
|
||||
} else {
|
||||
log.debug("Skipping switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sets a level switch to off
|
||||
def setLevelSwitch0() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Level switch off desired for ${deviceID}")
|
||||
lightswitchlevel.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating level switch device because it is the one specified: ${deviceID}");
|
||||
it.setLevel(0)
|
||||
} else {
|
||||
log.debug("Skipping level switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sets a level switch to 25%
|
||||
def setLevelSwitch25() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Level switch 25 desired for ${deviceID}")
|
||||
lightswitchlevel.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating level switch device because it is the one specified: ${deviceID}");
|
||||
it.setLevel(25)
|
||||
} else {
|
||||
log.debug("Skipping level switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sets a level switch to 50%
|
||||
def setLevelSwitch50() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Level switch 50 desired for ${deviceID}")
|
||||
lightswitchlevel.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating level switch device because it is the one specified: ${deviceID}");
|
||||
it.setLevel(50)
|
||||
} else {
|
||||
log.debug("Skipping level switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sets a level switch to 75%
|
||||
def setLevelSwitch75() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Level switch 75 desired for ${deviceID}")
|
||||
lightswitchlevel.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating level switch device because it is the one specified: ${deviceID}");
|
||||
it.setLevel(75)
|
||||
} else {
|
||||
log.debug("Skipping level switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sets a level switch to 100%
|
||||
def setLevelSwitch100() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Level switch 100 desired for ${deviceID}")
|
||||
lightswitchlevel.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating level switch device because it is the one specified: ${deviceID}");
|
||||
it.setLevel(100)
|
||||
} else {
|
||||
log.debug("Skipping level switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// fetch the id of this smartthings hub
|
||||
def hubId() {
|
||||
log.debug("hub id requested.")
|
||||
def response = [hubId: location.hubs.id[0]]
|
||||
}
|
||||
|
||||
// This handles requests for device inventories
|
||||
def inventory() {
|
||||
def response = []
|
||||
|
||||
lightswitch.each {
|
||||
response << [name: it.displayName, value: it.currentValue("switch"), deviceId: it.id, type: "lightSwitch"]
|
||||
}
|
||||
|
||||
contact.each {
|
||||
response << [name: it.displayName, value: it.currentValue("contact"), deviceId: it.id, type: "contact"]
|
||||
}
|
||||
|
||||
|
||||
motion.each {
|
||||
response << [name: it.displayName, value: it.currentValue("motion"), deviceId: it.id, type: "motion"]
|
||||
}
|
||||
|
||||
|
||||
presence.each {
|
||||
response << [name: it.displayName, value: it.currentValue("presence"), deviceId: it.id, type: "presence"]
|
||||
}
|
||||
|
||||
|
||||
tempSensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("temperature"), deviceId: it.id, type: "tempSensor"]
|
||||
}
|
||||
|
||||
|
||||
waterSensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("water"), deviceId: it.id, type: "waterSensor"]
|
||||
}
|
||||
|
||||
|
||||
humidity.each {
|
||||
response << [name: it.displayName, value: it.currentValue("humidity"), deviceId: it.id, type: "humiditySensor"]
|
||||
}
|
||||
|
||||
|
||||
lock.each {
|
||||
response << [name: it.displayName, value: it.currentValue("lock"), deviceId: it.id, type: "lock"]
|
||||
}
|
||||
|
||||
|
||||
garagedoor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("door"), deviceId: it.id, type: "garagedoor"]
|
||||
}
|
||||
|
||||
|
||||
touchsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("touch"), deviceId: it.id, type: "touchsensor"]
|
||||
}
|
||||
|
||||
|
||||
speechparser.each {
|
||||
response << [name: it.displayName, value: it.currentValue("phraseSpoken"), deviceId: it.id, type: "speechparser"]
|
||||
}
|
||||
|
||||
|
||||
soundsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("sound"), deviceId: it.id, type: "sound"]
|
||||
}
|
||||
|
||||
|
||||
smokedetector.each {
|
||||
response << [name: it.displayName, value: it.currentValue("smoke"), deviceId: it.id, type: "smoke"]
|
||||
}
|
||||
|
||||
|
||||
sleepsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("sleeping"), deviceId: it.id, type: "sleepsensor"]
|
||||
}
|
||||
|
||||
|
||||
carbonsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("carbonMonoxide"), deviceId: it.id, type: "carbonsensor"]
|
||||
}
|
||||
|
||||
|
||||
button.each {
|
||||
response << [name: it.displayName, value: it.currentValue("button"), deviceId: it.id, type: "button"]
|
||||
}
|
||||
|
||||
|
||||
beacon.each {
|
||||
response << [name: it.displayName, value: it.currentValue("presence"), deviceId: it.id, type: "beacon"]
|
||||
}
|
||||
|
||||
|
||||
alarm.each {
|
||||
response << [name: it.displayName, value: it.currentValue("alarm"), deviceId: it.id, type: "alarm"]
|
||||
}
|
||||
|
||||
|
||||
thermostat.each {
|
||||
response << [name: it.displayName, value: it.currentValue("thermostatMode"), deviceId: it.id, type: "thermostat"]
|
||||
}
|
||||
|
||||
|
||||
voltage.each {
|
||||
response << [name: it.displayName, value: it.currentValue("voltage"), deviceId: it.id, type: "voltage"]
|
||||
}
|
||||
|
||||
|
||||
windowshade.each {
|
||||
response << [name: it.displayName, value: it.currentValue("windowShade"), deviceId: it.id, type: "windowshade"]
|
||||
}
|
||||
|
||||
|
||||
powermeter.each {
|
||||
response << [name: it.displayName, value: it.currentValue("power"), deviceId: it.id, type: "powermeter"]
|
||||
}
|
||||
|
||||
|
||||
lightswitchlevel.each {
|
||||
response << [name: it.displayName, value: it.currentValue("level"), deviceId: it.id, type: "lightswitchlevel"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
log.debug("Inventory request processed. Response: " + response)
|
||||
return response
|
||||
}
|
||||
|
||||
// After the user hits the 'install' button in the mobile app
|
||||
def installed() {
|
||||
initialize()
|
||||
|
||||
|
||||
}
|
||||
|
||||
// After app settings are changed. All subscriptions are wiped before this is invoked by smartthings.
|
||||
def updated() {
|
||||
unsubscribe()
|
||||
initialize()
|
||||
|
||||
}
|
||||
|
||||
// This appears to be what the tutorials meant to use in the examples
|
||||
def initialize() {
|
||||
|
||||
// motion sensor subscription
|
||||
subscribe(motion, "motion", eventForwarder)
|
||||
|
||||
|
||||
// Contact sensor subscription
|
||||
subscribe(contact, "contact", eventForwarder)
|
||||
|
||||
|
||||
// power plug subscription
|
||||
subscribe(lightswitch, "switch", eventForwarder)
|
||||
|
||||
|
||||
// presence sensor subscription
|
||||
subscribe(presence, "presence", eventForwarder)
|
||||
|
||||
|
||||
// temperature sensor subscription
|
||||
subscribe(tempSensor, "temperature", eventForwarder)
|
||||
|
||||
|
||||
// water sensor subscription
|
||||
subscribe(waterSensor, "water", eventForwarder)
|
||||
|
||||
|
||||
// humidity sensor subscription
|
||||
subscribe(humidity, "humidity", eventForwarder)
|
||||
|
||||
|
||||
// lock subscription
|
||||
subscribe(lock, "lock", eventForwarder)
|
||||
|
||||
|
||||
// garage door subscription
|
||||
subscribe(garagedoor, "garagedoor", eventForwarder)
|
||||
|
||||
|
||||
// touch sensor subscription
|
||||
subscribe(touchsensor, "touchsensor", eventForwarder)
|
||||
|
||||
|
||||
// speech parser subscription
|
||||
subscribe(speechparser, "phraseSpoken", eventForwarder)
|
||||
|
||||
|
||||
// sound sensor subscription
|
||||
subscribe(soundsensor, "sound", eventForwarder)
|
||||
|
||||
|
||||
// smoke detector subscription
|
||||
subscribe(smokedetector, "smoke", eventForwarder)
|
||||
|
||||
|
||||
// sleep sensor subscription
|
||||
subscribe(sleepsensor, "sleeping", eventForwarder)
|
||||
|
||||
|
||||
// carbon monoxide sensor subscription
|
||||
subscribe(carbonsensor, "carbonMonoxide", eventForwarder)
|
||||
|
||||
|
||||
// button subscription
|
||||
subscribe(button, "button", eventForwarder)
|
||||
|
||||
|
||||
// beacon subscription
|
||||
subscribe(beacon, "presence", eventForwarder)
|
||||
|
||||
|
||||
// alarm subscription
|
||||
subscribe(alarm, "alarm", eventForwarder)
|
||||
|
||||
// thermostat subscriptions
|
||||
subscribe(thermostat, "temperature", eventForwarder)
|
||||
subscribe(thermostat, "heatingSetpoint", eventForwarder)
|
||||
subscribe(thermostat, "coolingSetpoint", eventForwarder)
|
||||
subscribe(thermostat, "thermostatSetpoint", eventForwarder)
|
||||
subscribe(thermostat, "thermostatMode", eventForwarder)
|
||||
subscribe(thermostat, "thermostatFanMode", eventForwarder)
|
||||
subscribe(thermostat, "thermostatOperatingState", eventForwarder)
|
||||
|
||||
// voltage subscription
|
||||
subscribe(voltage, "voltage", eventForwarder)
|
||||
|
||||
// window shade subscription
|
||||
subscribe(windowshade, "windowShade", eventForwarder)
|
||||
|
||||
// shm events
|
||||
subscribe(location, "alarmSystemStatus", shmEventForwarder)
|
||||
|
||||
// power meter subscription
|
||||
subscribe(powermeter, "power", eventForwarder)
|
||||
|
||||
// level switch (dimmer switch)
|
||||
subscribe(lightswitchlevel, "level", eventForwarder)
|
||||
}
|
||||
|
||||
// This is used to forward events to the home.ai webservice
|
||||
def eventForwarder(evt) {
|
||||
|
||||
|
||||
log.debug(params.uri + " " + params.path)
|
||||
|
||||
log.debug("FORWARDING EVENT" + evt.deviceId + " " + evt.value + " " + evt.hub.id)
|
||||
|
||||
def deviceId = evt.deviceId
|
||||
def deviceState = evt.value
|
||||
def hubId = evt.hub.id
|
||||
def params = [
|
||||
uri: "https://demo.home.ai",
|
||||
path: "/smartThingsPostback/stateChange/${hubId}/${deviceId}/${deviceState}"
|
||||
]
|
||||
log.info(params)
|
||||
httpGet(params)
|
||||
}
|
||||
|
||||
// Mappings that serve web requests against our smart app
|
||||
mappings {
|
||||
path("/inventory") {
|
||||
action: [
|
||||
GET: "inventory"
|
||||
]
|
||||
}
|
||||
path("/hubId") {
|
||||
action: [
|
||||
GET: "hubId"
|
||||
]
|
||||
}
|
||||
path("/switchOn/:deviceID") {
|
||||
action: [
|
||||
GET: "switchOn"
|
||||
]
|
||||
}
|
||||
path("/switchOff/:deviceID") {
|
||||
action: [
|
||||
GET: "switchOff"
|
||||
]
|
||||
}
|
||||
path("/lock/:deviceID") {
|
||||
action: [
|
||||
GET: "lockDoor"
|
||||
]
|
||||
}
|
||||
path("/unlock/:deviceID") {
|
||||
action: [
|
||||
GET: "unlockDoor"
|
||||
]
|
||||
}
|
||||
path("/opengarage/:deviceID") {
|
||||
action: [
|
||||
GET: "openGarage"
|
||||
]
|
||||
}
|
||||
path("/closegarage/:deviceID") {
|
||||
action: [
|
||||
GET: "closeGarage"
|
||||
]
|
||||
}
|
||||
|
||||
path("/strobeAlarm/:deviceID") {
|
||||
action: [
|
||||
GET: "strobeAlarm"
|
||||
]
|
||||
}
|
||||
path("/sirenAlarm/:deviceID") {
|
||||
action: [
|
||||
GET: "sirenAlarm"
|
||||
]
|
||||
}
|
||||
path("/silenceAlarm/:deviceID") {
|
||||
action: [
|
||||
GET: "silenceAlarm"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
path("/setThermostatHeatTemp/:deviceID/:temp") {
|
||||
action: [
|
||||
GET: "setThermostatHeatTemp"
|
||||
]
|
||||
}
|
||||
path("/setThermostatCoolTemp/:deviceID/:temp") {
|
||||
action: [
|
||||
GET: "setThermostatCoolTemp"
|
||||
]
|
||||
}
|
||||
path("/setThermostatHeat/:deviceID") {
|
||||
action: [
|
||||
GET: "setThermostatHeat"
|
||||
]
|
||||
}
|
||||
path("/setThermostatCool/:deviceID") {
|
||||
action: [
|
||||
GET: "setThermostatCool"
|
||||
]
|
||||
}
|
||||
path("/setThermostatMode/:deviceID/:mode") {
|
||||
action: [
|
||||
GET: "setThermostatMode"
|
||||
]
|
||||
}
|
||||
path("/setThermostatFanMode/:deviceID/:mode") {
|
||||
action: [
|
||||
GET: "setThermostatFanMode"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
path("/closeWindowShade/:deviceID") {
|
||||
action: [
|
||||
GET: "setWindowShadeClosed"
|
||||
]
|
||||
}
|
||||
path("/openWindowShade/:deviceID") {
|
||||
action: [
|
||||
GET: "setWindowShadeOpen"
|
||||
]
|
||||
}
|
||||
|
||||
// level switch setting endpoints
|
||||
path("/levelSwitch0/:deviceID") {
|
||||
action: [
|
||||
GET: "setLevelSwitch0"
|
||||
]
|
||||
}
|
||||
path("/levelSwitch25/:deviceID") {
|
||||
action: [
|
||||
GET: "setLevelSwitch25"
|
||||
]
|
||||
}
|
||||
path("/levelSwitch50/:deviceID") {
|
||||
action: [
|
||||
GET: "setLevelSwitch50"
|
||||
]
|
||||
}
|
||||
path("/levelSwitch75/:deviceID") {
|
||||
action: [
|
||||
GET: "setLevelSwitch75"
|
||||
]
|
||||
}
|
||||
path("/levelSwitch100/:deviceID") {
|
||||
action: [
|
||||
GET: "setLevelSwitch100"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Smart home monitor controls
|
||||
path("/awaySecurity") {
|
||||
action: [
|
||||
GET: "awaySecurity"
|
||||
]
|
||||
}
|
||||
path("/staySecurity") {
|
||||
action: [
|
||||
GET: "staySecurity"
|
||||
]
|
||||
}
|
||||
path("/offSecurity") {
|
||||
action: [
|
||||
GET: "offSecurity"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ def getCallbackUrl() { return "${getServerUrl()}/oauth/callback" }
|
||||
def apiURL(path = '/') { return "https://api.lifx.com/v1${path}" }
|
||||
def getSecretKey() { return appSettings.secretKey }
|
||||
def getClientId() { return appSettings.clientId }
|
||||
private getVendorName() { "LIFX" }
|
||||
|
||||
def authPage() {
|
||||
log.debug "authPage test1"
|
||||
@@ -76,6 +77,7 @@ def authPage() {
|
||||
return dynamicPage(name:"Credentials", title:"", nextPage:"", install:true, uninstall: true) {
|
||||
section("Select your location") {
|
||||
input "selectedLocationId", "enum", required:true, title:"Select location ({{count}} found)", messageArgs: [count: count], multiple:false, options:options, submitOnChange: true
|
||||
paragraph "Devices will be added automatically from your ${vendorName} account. To add or delete devices please use the Official ${vendorName} App."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,10 +136,20 @@ def getDataForChild(child, startDate, endDate) {
|
||||
|
||||
def wattvisionURL = wattvisionURL(child.deviceNetworkId, startDate, endDate)
|
||||
if (wattvisionURL) {
|
||||
httpGet(uri: wattvisionURL) { response ->
|
||||
def json = new org.json.JSONObject(response.data.toString())
|
||||
child.addWattvisionData(json)
|
||||
return "success"
|
||||
try {
|
||||
httpGet(uri: wattvisionURL) { response ->
|
||||
def json = new org.json.JSONObject(response.data.toString())
|
||||
child.addWattvisionData(json)
|
||||
return "success"
|
||||
}
|
||||
} catch (groovyx.net.http.HttpResponseException httpE) {
|
||||
log.error "Wattvision getDataForChild HttpResponseException: ${httpE} -> ${httpE.response.data}"
|
||||
//log.debug "wattvisionURL = ${wattvisionURL}"
|
||||
return "fail"
|
||||
} catch (e) {
|
||||
log.error "Wattvision getDataForChild General Exception: ${e}"
|
||||
//log.debug "wattvisionURL = ${wattvisionURL}"
|
||||
return "fail"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,9 +174,14 @@ def wattvisionURL(senorId, startDate, endDate) {
|
||||
if (diff > 259200000) { // 3 days in milliseconds
|
||||
// Wattvision only allows pulling 3 hours of data at a time
|
||||
startDate = new Date(hours: endDate.hours - 3)
|
||||
} else if (diff < 10000) { // 10 seconds in milliseconds
|
||||
// Wattvision throws errors when the difference between start_time and end_time is 5 seconds or less
|
||||
// So we are going to make sure that we have a few more seconds of breathing room
|
||||
use (groovy.time.TimeCategory) {
|
||||
startDate = endDate - 10.seconds
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def params = [
|
||||
"sensor_id" : senorId,
|
||||
"api_id" : wattvisionApiAccess.id,
|
||||
@@ -480,4 +495,3 @@ def connectionSuccessful(deviceName, iconSrc) {
|
||||
|
||||
render contentType: 'text/html', data: html
|
||||
}
|
||||
|
||||
|
||||
@@ -1,713 +0,0 @@
|
||||
definition(
|
||||
name: "stage.app.home.ai",
|
||||
namespace: "stage.app.home.ai",
|
||||
author: "Eric Greer",
|
||||
description: "SmartThings SmartApp for stage.app.home.ai.",
|
||||
category: "Fun & Social",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
|
||||
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
|
||||
)
|
||||
|
||||
// These are preferences displayed in the smart phone app
|
||||
preferences {
|
||||
// we need a settings section to enable subscriptions
|
||||
section("Pick which devices home.ai will help you automate:"){
|
||||
input "motion", "capability.motionSensor", title: "Choose motion sensors", required: false, multiple: true
|
||||
input "contact", "capability.contactSensor", title: "Choose contact sensors", required: false, multiple: true
|
||||
input "lightswitch", "capability.switch", title: "Choose normal power switches", required: false, multiple: true
|
||||
input "lightswitchlevel", "capability.switchLevel", title: "Choose dimmer power switches", required: false, multiple: true
|
||||
input "presence", "capability.presenceSensor", title: "Choose presence sensors", required: false, multiple: true
|
||||
input "tempSensor", "capability.temperatureMeasurement", title: "Choose temperature sensors", required: false, multiple: true
|
||||
input "humidity", "capability.relativeHumidityMeasurement", title: "Choose humidity sensors", required: false, multiple: true
|
||||
input "waterSensor", "capability.waterSensor", title: "Choose water sensors", required: false, multiple: true
|
||||
input "lock", "capability.lock", title: "Pick Door Locks", required: false, multiple: true
|
||||
input "garagedoor", "capability.garageDoorControl", title: "Pick garage doors", required: false, multiple: true
|
||||
input "touchsensor", "capability.touchSensor", title: "Pick touch sensors", required: false, multiple: true
|
||||
input "speechparser", "capability.speechRecognition", title: "Pick speech recognizers", required: false, multiple: true
|
||||
input "soundsensor", "capability.soundSensor", title: "Pick sound sensors", required: false, multiple: true
|
||||
input "smokedetector", "capability.smokeDetector", title: "Pick smoke detectors", required: false, multiple: true
|
||||
input "sleepsensor", "capability.sleepSensor", title: "Pick sleep sensors", required: false, multiple: true
|
||||
input "carbonsensor", "capability.carbonMonoxideDetector", title: "Pick carbon monoxide detectors", required: false, multiple: true
|
||||
input "button", "capability.button", title: "Pick buttons", required: false, multiple: true
|
||||
input "beacon", "capability.beacon", title: "Pick beacons", required: false, multiple: true
|
||||
input "alarm", "capability.alarm", title: "Pick alarms", required: false, multiple: true
|
||||
input "thermostat", "capability.thermostat", title: "Pick thermostats", required: false, multiple: true
|
||||
input "voltage", "capability.voltageMeasurement", title: "Pick voltage sensors", required: false, multiple: true
|
||||
input "windowshade", "capability.windowShade", title: "Pick window shades", required: false, multiple: true
|
||||
input "powermeter", "capability.powerMeter", title: "Pick power meters", required: false, multiple: true
|
||||
}
|
||||
}
|
||||
|
||||
// vlaues for security system are 'away', 'stay', or 'off'
|
||||
// off security
|
||||
def offSecurity() {
|
||||
sendLocationEvent(
|
||||
name: "alarmSystemStatus",
|
||||
value: "off",
|
||||
displayed: false,
|
||||
isStateChange: true
|
||||
)
|
||||
}
|
||||
|
||||
// stay security
|
||||
def staySecurity() {
|
||||
sendLocationEvent(
|
||||
name: "alarmSystemStatus",
|
||||
value: "stay",
|
||||
displayed: false,
|
||||
isStateChange: true
|
||||
)
|
||||
}
|
||||
|
||||
// away security
|
||||
def awaySecurity() {
|
||||
sendLocationEvent(
|
||||
name: "alarmSystemStatus",
|
||||
value: "away",
|
||||
displayed: false,
|
||||
isStateChange: true
|
||||
)
|
||||
}
|
||||
|
||||
// sets window shade open temperature
|
||||
def setWindowShadeOpen() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setWindowShadeOpen command recieved ${deviceID}")
|
||||
windowshade.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating window shade because it is the one specified: ${deviceID}");
|
||||
it.open()
|
||||
} else {
|
||||
log.debug("NOT operting window shade because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets window shade close temperature
|
||||
def setWindowShadeClosed() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setWindowShadeClosed command recieved ${deviceID}")
|
||||
windowshade.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating window shade because it is the one specified: ${deviceID}");
|
||||
it.close()
|
||||
} else {
|
||||
log.debug("NOT operting window shade because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat heating temperature
|
||||
def setThermostatHeatTemp() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatHeat command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setHeatingSetpoint(params.temp)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat cooling temperature
|
||||
def setThermostatCoolTemp() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatCool command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setCoolingSetpoint(params.temp)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat off
|
||||
def setThermostatOff() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatOff command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.off()
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat to heat
|
||||
def setThermostatHeat() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatHeat command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.heat()
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat to cool
|
||||
def setThermostatCool() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatCool command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.cool()
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat mode
|
||||
def setThermostatMode() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatMode command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setThermostatMode(params.mode)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sets thermostat fan mode
|
||||
def setThermostatFanMode() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("setThermostatFanMode command recieved ${deviceID}")
|
||||
thermostat.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating thermostat because it is the one specified: ${deviceID}");
|
||||
it.setThermostatFanMode(params.mode)
|
||||
} else {
|
||||
log.debug("NOT operting thermostat because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sends an alarm strobe
|
||||
def strobeAlarm() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Alarm strobe command recieved ${deviceID}")
|
||||
alarm.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating alarm because it is the one specified: ${deviceID}");
|
||||
it.strobe()
|
||||
} else {
|
||||
log.debug("NOT operting alarm because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sends an alarm siren
|
||||
def sirenAlarm() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Alarm siren command recieved ${deviceID}")
|
||||
alarm.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating alarm because it is the one specified: ${deviceID}");
|
||||
it.siren()
|
||||
} else {
|
||||
log.debug("NOT operting alarm because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// disables an alarm siren
|
||||
def silenceAlarm() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Alarm silence command recieved ${deviceID}")
|
||||
alarm.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating alarm because it is the one specified: ${deviceID}");
|
||||
it.off()
|
||||
} else {
|
||||
log.debug("NOT operting alarm because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// opens a garage door
|
||||
def openGarage() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Open Garage command recieved ${deviceID}")
|
||||
garagedoor.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating garage door because it is the one specified: ${deviceID}");
|
||||
it.open()
|
||||
} else {
|
||||
log.debug("NOT operting garage door device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// closes a garage door
|
||||
def closeGarage() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Close Garage command recieved ${deviceID}")
|
||||
garagedoor.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating garage door because it is the one specified: ${deviceID}");
|
||||
it.close()
|
||||
} else {
|
||||
log.debug("NOT operting garage door device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// lock locks a door lock
|
||||
def lockDoor() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Lock command recieved ${deviceID}")
|
||||
lock.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating lock device because it is the one specified: ${deviceID}");
|
||||
it.lock()
|
||||
} else {
|
||||
log.debug("NOT operting lock device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unlock unlocks a door lock
|
||||
def unlockDoor() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Unlock command recieved ${deviceID}")
|
||||
lock.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating lock device because it is the one specified: ${deviceID}");
|
||||
it.unlock()
|
||||
} else {
|
||||
log.debug("NOT operting lock device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// turns on a wall switch as instructed from the homeai webservice
|
||||
def switchOn() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Switch on command recieved ${deviceID}")
|
||||
lightswitch.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating switch device because it is the one specified: ${deviceID}");
|
||||
it.on()
|
||||
} else {
|
||||
log.debug("Skipping switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// turns off a wall switch as instructed from the homeai webservice
|
||||
def switchOff() {
|
||||
def deviceID = params.deviceID
|
||||
log.debug("Switch off desired for ${deviceID}")
|
||||
lightswitch.each {
|
||||
if (it.id == deviceID) {
|
||||
log.debug("Operating switch device because it is the one specified: ${deviceID}");
|
||||
it.off()
|
||||
} else {
|
||||
log.debug("Skipping switch device because it is not the one specified: ${deviceID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fetch the id of this smartthings hub
|
||||
def hubId() {
|
||||
log.debug("hub id requested.")
|
||||
def response = [hubId: location.hubs.id[0]]
|
||||
}
|
||||
|
||||
// This handles requests for device inventories
|
||||
def inventory() {
|
||||
def response = []
|
||||
|
||||
lightswitch.each {
|
||||
response << [name: it.displayName, value: it.currentValue("switch"), deviceId: it.id, type: "lightSwitch"]
|
||||
}
|
||||
|
||||
contact.each {
|
||||
response << [name: it.displayName, value: it.currentValue("contact"), deviceId: it.id, type: "contact"]
|
||||
}
|
||||
|
||||
|
||||
motion.each {
|
||||
response << [name: it.displayName, value: it.currentValue("motion"), deviceId: it.id, type: "motion"]
|
||||
}
|
||||
|
||||
presence.each {
|
||||
response << [name: it.displayName, value: it.currentValue("presence"), deviceId: it.id, type: "presence"]
|
||||
}
|
||||
|
||||
// removed until dual device functions are supported on the backend
|
||||
//tempSensor.each {
|
||||
// response << [name: it.displayName, value: it.currentValue("temperature"), deviceId: it.id, type: "tempSensor"]
|
||||
//}
|
||||
|
||||
//humidity.each {
|
||||
// response << [name: it.displayName, value: it.currentValue("humidity"), deviceId: it.id, type: "humiditySensor"]
|
||||
//}
|
||||
|
||||
|
||||
waterSensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("water"), deviceId: it.id, type: "waterSensor"]
|
||||
}
|
||||
|
||||
lock.each {
|
||||
response << [name: it.displayName, value: it.currentValue("lock"), deviceId: it.id, type: "lock"]
|
||||
}
|
||||
|
||||
|
||||
garagedoor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("door"), deviceId: it.id, type: "garagedoor"]
|
||||
}
|
||||
|
||||
|
||||
touchsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("touch"), deviceId: it.id, type: "touchsensor"]
|
||||
}
|
||||
|
||||
|
||||
speechparser.each {
|
||||
response << [name: it.displayName, value: it.currentValue("phraseSpoken"), deviceId: it.id, type: "speechparser"]
|
||||
}
|
||||
|
||||
|
||||
soundsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("sound"), deviceId: it.id, type: "sound"]
|
||||
}
|
||||
|
||||
|
||||
smokedetector.each {
|
||||
response << [name: it.displayName, value: it.currentValue("smoke"), deviceId: it.id, type: "smoke"]
|
||||
}
|
||||
|
||||
|
||||
sleepsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("sleeping"), deviceId: it.id, type: "sleepsensor"]
|
||||
}
|
||||
|
||||
|
||||
carbonsensor.each {
|
||||
response << [name: it.displayName, value: it.currentValue("carbonMonoxide"), deviceId: it.id, type: "carbonsensor"]
|
||||
}
|
||||
|
||||
|
||||
button.each {
|
||||
response << [name: it.displayName, value: it.currentValue("button"), deviceId: it.id, type: "button"]
|
||||
}
|
||||
|
||||
|
||||
beacon.each {
|
||||
response << [name: it.displayName, value: it.currentValue("presence"), deviceId: it.id, type: "beacon"]
|
||||
}
|
||||
|
||||
|
||||
alarm.each {
|
||||
response << [name: it.displayName, value: it.currentValue("alarm"), deviceId: it.id, type: "alarm"]
|
||||
}
|
||||
|
||||
|
||||
thermostat.each {
|
||||
response << [name: it.displayName, value: it.currentValue("thermostatMode"), deviceId: it.id, type: "thermostat"]
|
||||
}
|
||||
|
||||
|
||||
voltage.each {
|
||||
response << [name: it.displayName, value: it.currentValue("voltage"), deviceId: it.id, type: "voltage"]
|
||||
}
|
||||
|
||||
|
||||
windowshade.each {
|
||||
response << [name: it.displayName, value: it.currentValue("windowShade"), deviceId: it.id, type: "windowshade"]
|
||||
}
|
||||
|
||||
|
||||
powermeter.each {
|
||||
response << [name: it.displayName, value: it.currentValue("power"), deviceId: it.id, type: "powermeter"]
|
||||
}
|
||||
|
||||
|
||||
lightswitchlevel.each {
|
||||
response << [name: it.displayName, value: it.currentValue("level"), deviceId: it.id, type: "lightswitchlevel"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
log.debug("Inventory request processed. Response: " + response)
|
||||
return response
|
||||
}
|
||||
|
||||
// After the user hits the 'install' button in the mobile app
|
||||
def installed() {
|
||||
initialize()
|
||||
}
|
||||
|
||||
// After app settings are changed. All subscriptions are wiped before this is invoked by smartthings.
|
||||
def updated() {
|
||||
unsubscribe()
|
||||
initialize()
|
||||
}
|
||||
|
||||
// This appears to be what the tutorials meant to use in the examples
|
||||
def initialize() {
|
||||
|
||||
// SHM subscription
|
||||
// evt.value will be "off", "stay", or "away"
|
||||
subscribe(location, "alarmSystemStatus", eventForwarder)
|
||||
|
||||
|
||||
// motion sensor subscription
|
||||
subscribe(motion, "motion", eventForwarder)
|
||||
|
||||
|
||||
// Contact sensor subscription
|
||||
subscribe(contact, "contact", eventForwarder)
|
||||
|
||||
|
||||
// power plug subscription
|
||||
subscribe(lightswitch, "switch", eventForwarder)
|
||||
|
||||
|
||||
// presence sensor subscription
|
||||
subscribe(presence, "presence", eventForwarder)
|
||||
|
||||
|
||||
// temperature sensor subscription
|
||||
subscribe(tempSensor, "temperature", eventForwarder)
|
||||
|
||||
|
||||
// water sensor subscription
|
||||
subscribe(waterSensor, "water", eventForwarder)
|
||||
|
||||
|
||||
// humidity sensor subscription
|
||||
subscribe(humidity, "humidity", eventForwarder)
|
||||
|
||||
|
||||
// lock subscription
|
||||
subscribe(lock, "lock", eventForwarder)
|
||||
|
||||
|
||||
// garage door subscription
|
||||
subscribe(garagedoor, "garagedoor", eventForwarder)
|
||||
|
||||
|
||||
// touch sensor subscription
|
||||
subscribe(touchsensor, "touchsensor", eventForwarder)
|
||||
|
||||
|
||||
// speech parser subscription
|
||||
subscribe(speechparser, "phraseSpoken", eventForwarder)
|
||||
|
||||
|
||||
// sound sensor subscription
|
||||
subscribe(soundsensor, "sound", eventForwarder)
|
||||
|
||||
|
||||
// smoke detector subscription
|
||||
subscribe(smokedetector, "smoke", eventForwarder)
|
||||
|
||||
|
||||
// sleep sensor subscription
|
||||
subscribe(sleepsensor, "sleeping", eventForwarder)
|
||||
|
||||
|
||||
// carbon monoxide sensor subscription
|
||||
subscribe(carbonsensor, "carbonMonoxide", eventForwarder)
|
||||
|
||||
|
||||
// button subscription
|
||||
subscribe(button, "button", eventForwarder)
|
||||
|
||||
|
||||
// beacon subscription
|
||||
subscribe(beacon, "presence", eventForwarder)
|
||||
|
||||
|
||||
// alarm subscription
|
||||
subscribe(alarm, "alarm", eventForwarder)
|
||||
|
||||
// thermostat subscriptions
|
||||
subscribe(thermostat, "temperature", eventForwarder)
|
||||
subscribe(thermostat, "heatingSetpoint", eventForwarder)
|
||||
subscribe(thermostat, "coolingSetpoint", eventForwarder)
|
||||
subscribe(thermostat, "thermostatSetpoint", eventForwarder)
|
||||
subscribe(thermostat, "thermostatMode", eventForwarder)
|
||||
subscribe(thermostat, "thermostatFanMode", eventForwarder)
|
||||
subscribe(thermostat, "thermostatOperatingState", eventForwarder)
|
||||
|
||||
// voltage subscription
|
||||
subscribe(voltage, "voltage", eventForwarder)
|
||||
|
||||
// window shade subscription
|
||||
subscribe(windowshade, "windowShade", eventForwarder)
|
||||
|
||||
// shm events
|
||||
subscribe(location, "alarmSystemStatus", shmEventForwarder)
|
||||
|
||||
// power meter subscription
|
||||
subscribe(powermeter, "power", eventForwarder)
|
||||
|
||||
// level switch (dimmer switch)
|
||||
subscribe(lightswitchlevel, "level", eventForwarder)
|
||||
}
|
||||
|
||||
def shmEventForwarder(evt) {
|
||||
// evt.value will be "off", "stay", or "away"
|
||||
log.debug("FORWARDING SHM CHANGE" + evt.value + " " + evt.hub.id)
|
||||
|
||||
def deviceState = evt.value
|
||||
def deviceId = "smarthomemonitor"
|
||||
def hubId = hubId()
|
||||
def params = [
|
||||
uri: "https://stage.app.home.ai",
|
||||
path: "/smartThingsPostback/shmStateChange/${hubId}/${deviceId}/${deviceState}"
|
||||
]
|
||||
log.info(params)
|
||||
httpGet(params)
|
||||
|
||||
}
|
||||
|
||||
// This is used to forward events to the home.ai webservice
|
||||
def eventForwarder(evt) {
|
||||
|
||||
def hubId = location.hubs.id[0]
|
||||
|
||||
log.debug(params.uri + " " + params.path)
|
||||
log.debug("FORWARDING EVENT" + evt.deviceId + " " + evt.value + " " + hubId)
|
||||
|
||||
def deviceId = evt.deviceId
|
||||
def deviceState = evt.value
|
||||
def params = [
|
||||
uri: "https://stage.app.home.ai",
|
||||
path: "/smartThingsPostback/stateChange/${hubId}/${deviceId}/${deviceState}"
|
||||
]
|
||||
log.info(params)
|
||||
httpGet(params)
|
||||
}
|
||||
|
||||
// Mappings that serve web requests against our smart app
|
||||
mappings {
|
||||
path("/inventory") {
|
||||
action: [
|
||||
GET: "inventory"
|
||||
]
|
||||
}
|
||||
path("/hubId") {
|
||||
action: [
|
||||
GET: "hubId"
|
||||
]
|
||||
}
|
||||
path("/switchOn/:deviceID") {
|
||||
action: [
|
||||
GET: "switchOn"
|
||||
]
|
||||
}
|
||||
path("/switchOff/:deviceID") {
|
||||
action: [
|
||||
GET: "switchOff"
|
||||
]
|
||||
}
|
||||
path("/lock/:deviceID") {
|
||||
action: [
|
||||
GET: "lockDoor"
|
||||
]
|
||||
}
|
||||
path("/unlock/:deviceID") {
|
||||
action: [
|
||||
GET: "unlockDoor"
|
||||
]
|
||||
}
|
||||
path("/opengarage/:deviceID") {
|
||||
action: [
|
||||
GET: "openGarage"
|
||||
]
|
||||
}
|
||||
path("/closegarage/:deviceID") {
|
||||
action: [
|
||||
GET: "closeGarage"
|
||||
]
|
||||
}
|
||||
path("/strobeAlarm/:deviceID") {
|
||||
action: [
|
||||
GET: "strobeAlarm"
|
||||
]
|
||||
}
|
||||
path("/sirenAlarm/:deviceID") {
|
||||
action: [
|
||||
GET: "sirenAlarm"
|
||||
]
|
||||
}
|
||||
path("/silenceAlarm/:deviceID") {
|
||||
action: [
|
||||
GET: "silenceAlarm"
|
||||
]
|
||||
}
|
||||
path("/setThermostatHeatTemp/:deviceID/:temp") {
|
||||
action: [
|
||||
GET: "setThermostatHeatTemp"
|
||||
]
|
||||
}
|
||||
path("/setThermostatCoolTemp/:deviceID/:temp") {
|
||||
action: [
|
||||
GET: "setThermostatCoolTemp"
|
||||
]
|
||||
}
|
||||
path("/setThermostatHeat/:deviceID") {
|
||||
action: [
|
||||
GET: "setThermostatHeat"
|
||||
]
|
||||
}
|
||||
path("/setThermostatCool/:deviceID") {
|
||||
action: [
|
||||
GET: "setThermostatCool"
|
||||
]
|
||||
}
|
||||
path("/setThermostatMode/:deviceID/:mode") {
|
||||
action: [
|
||||
GET: "setThermostatMode"
|
||||
]
|
||||
}
|
||||
path("/setThermostatFanMode/:deviceID/:mode") {
|
||||
action: [
|
||||
GET: "setThermostatFanMode"
|
||||
]
|
||||
}
|
||||
path("/closeWindowShade/:deviceID") {
|
||||
action: [
|
||||
GET: "setWindowShadeClosed"
|
||||
]
|
||||
}
|
||||
path("/openWindowShade/:deviceID") {
|
||||
action: [
|
||||
GET: "setWindowShadeOpen"
|
||||
]
|
||||
}
|
||||
path("/awaySecurity") {
|
||||
action: [
|
||||
GET: "awaySecurity"
|
||||
]
|
||||
}
|
||||
path("/staySecurity") {
|
||||
action: [
|
||||
GET: "staySecurity"
|
||||
]
|
||||
}
|
||||
path("/offSecurity") {
|
||||
action: [
|
||||
GET: "offSecurity"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user