mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
MSA-2121: SHIC REST gate v.1 connects SHIC and ST. This app gives SHIC access to ST smoke and water sensors.
This commit is contained in:
53
smartapps/shic/shic-v-1.src/shic-v-1.groovy
Normal file
53
smartapps/shic/shic-v-1.src/shic-v-1.groovy
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* SHICREST
|
||||||
|
*
|
||||||
|
* Copyright 2017 Unitedthings Inc.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
definition(
|
||||||
|
name: "SHIC v.1",
|
||||||
|
namespace: "SHIC",
|
||||||
|
author: "Unitedthings Inc. (incorporated in Delaware)",
|
||||||
|
description: "SHIC REST gate",
|
||||||
|
category: "Safety & Security",
|
||||||
|
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")
|
||||||
|
|
||||||
|
|
||||||
|
preferences {
|
||||||
|
section("Allow SHIC to access these things") {
|
||||||
|
input "waterSensor", "capability.waterSensor", multiple: true
|
||||||
|
input "smokeDetector", "capability.smokeDetector", multiple: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mappings {
|
||||||
|
path("/waterSensor") {
|
||||||
|
action: [
|
||||||
|
GET: "listwaterSensor"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
mappings {
|
||||||
|
path("/smokeDetector") {
|
||||||
|
action: [
|
||||||
|
GET: "listsmokeDetector"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
def listwaterSensor() { def resp = []
|
||||||
|
waterSensor.each {
|
||||||
|
resp << [name: it.getDisplayName(), lastactivity: it.getLastActivity(), status: it.getStatus(), value: it.currentState("water"), bat: it.currentState("battery") ]
|
||||||
|
}
|
||||||
|
return resp}
|
||||||
|
|
||||||
|
def listsmokeDetector() { def resp = []
|
||||||
|
smokeDetector.each {
|
||||||
|
resp << [name: it.getDisplayName(), lastactivity: it.getLastActivity(), status: it.getStatus(), value: it.currentState("smoke"), bat: it.currentState("battery") ]
|
||||||
|
}
|
||||||
|
return resp}
|
||||||
|
|
||||||
|
// TODO: implement event handlers
|
||||||
Reference in New Issue
Block a user