mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-14 13:11:52 +00:00
Compare commits
1 Commits
MSA-1227-1
...
MSA-1214-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1b796491a |
@@ -31,7 +31,6 @@ metadata {
|
||||
capability "Configuration"
|
||||
capability "Refresh"
|
||||
capability "Sensor"
|
||||
capability "Health Check"
|
||||
|
||||
// indicates that device keeps track of heartbeat (in state.heartbeat)
|
||||
attribute "heartbeat", "string"
|
||||
|
||||
@@ -31,7 +31,6 @@ metadata {
|
||||
capability "Refresh"
|
||||
capability "Temperature Measurement"
|
||||
capability "Water Sensor"
|
||||
capability "Health Check"
|
||||
|
||||
command "enrollResponse"
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ metadata {
|
||||
capability "Battery"
|
||||
capability "Temperature Measurement"
|
||||
capability "Refresh"
|
||||
capability "Health Check"
|
||||
|
||||
command "enrollResponse"
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ metadata {
|
||||
capability "Acceleration Sensor"
|
||||
capability "Refresh"
|
||||
capability "Temperature Measurement"
|
||||
capability "Health Check"
|
||||
|
||||
command "enrollResponse"
|
||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05,FC02", outClusters: "0019", manufacturer: "CentraLite", model: "3320"
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
capability "Acceleration Sensor"
|
||||
capability "Refresh"
|
||||
capability "Temperature Measurement"
|
||||
capability "Health Check"
|
||||
command "enrollResponse"
|
||||
|
||||
command "enrollResponse"
|
||||
}
|
||||
|
||||
simulator {
|
||||
|
||||
@@ -20,7 +20,6 @@ metadata {
|
||||
capability "Refresh"
|
||||
capability "Temperature Measurement"
|
||||
capability "Relative Humidity Measurement"
|
||||
capability "Health Check"
|
||||
|
||||
fingerprint endpointId: "01", inClusters: "0001,0003,0020,0402,0B05,FC45", outClusters: "0019,0003"
|
||||
}
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/**
|
||||
* Copyright 2016 EyXAR
|
||||
*
|
||||
* All rights reserved. No part of this code may be reproduced, distributed, or modified in any form or by any means,
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
*
|
||||
* For ST app: https://play.google.com/store/apps/details?id=eyxar.com.forst
|
||||
* http://www.eyxar.com
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* EyXAr Notifications
|
||||
*
|
||||
* Author: EyXAr
|
||||
* Published: 2016-02-14
|
||||
*/
|
||||
|
||||
|
||||
definition(
|
||||
name: "EyXAr Notifications",
|
||||
namespace: "eyxar",
|
||||
author: "EyXAr",
|
||||
description: "Enable SmartThings the capability to add voice notifications to your Phones or Tablet anywhere in conjuction with For ST app. https://play.google.com/store/apps/details?id=eyxar.com.forst",
|
||||
category: "SmartThings Labs",
|
||||
iconUrl: "https://s3.amazonaws.com/for-st/For_ST_60px.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/for-st/For_ST_120px.png",
|
||||
iconX3Url: "https://s3.amazonaws.com/for-st/For_ST_256px.png"
|
||||
)
|
||||
|
||||
/* For ST will only work if EyXAr Notification is installed and set-up first. */
|
||||
|
||||
preferences {
|
||||
section("EyXAr Auto Notifications - For Voice Notification, Install the app 'FOR ST' in Google Play")
|
||||
{
|
||||
input "door", "capability.contactSensor", title: "Monitor Contact Sensor When Nobody's Home", required: false, multiple: true
|
||||
}
|
||||
|
||||
section("Send Notifications by Text or use below option?") {
|
||||
input("recipients", "contact", title: "Send notifications to"){
|
||||
input "phone", "phone", title: "Phone Number (optional, text charges may apply)",
|
||||
description: "Phone Number", required: false
|
||||
}
|
||||
}
|
||||
|
||||
section("If combine with 'For ST' android app, this will add features of voice notifications.") {
|
||||
input "sendPush", "bool", required: false,
|
||||
title: "Phone/Tablet Auto Notification (Must be set to On =>>)"
|
||||
}
|
||||
}
|
||||
|
||||
/* Presense */
|
||||
|
||||
section("Arriving and Leaving Auto Notifications - For Voice notifications install 'FOR ST' in Google Play") {
|
||||
input "presence", "capability.presenceSensor", title: "Select Phone/Tablet to Detect (Set Specific Mode Below to Minimize Notifications)", required: false, multiple: true
|
||||
}
|
||||
|
||||
def installed() {
|
||||
initialize()
|
||||
/* Presense */
|
||||
subscribe(door, "contact.open", doorOpenHandler)
|
||||
subscribe(door, "contact.closed", doorClosedHandler)
|
||||
subscribe(presence, "presence", myHandler)
|
||||
subscribe(presence, "presence", presenceHandler)
|
||||
}
|
||||
|
||||
def updated() {
|
||||
initialize()
|
||||
}
|
||||
|
||||
def initialize() {
|
||||
subscribe(door, "contact.open", doorOpenHandler)
|
||||
subscribe(door, "contact.closed", doorClosedHandler)
|
||||
subscribe(presence, "presence", myHandler)
|
||||
subscribe(presence, "presence", presenceHandler)
|
||||
|
||||
}
|
||||
|
||||
def doorOpenHandler(evt) {
|
||||
def message = "EyXAr Detected the ${evt.displayName} is ${evt.value}!"
|
||||
if (sendPush) {
|
||||
sendPush(message)
|
||||
}
|
||||
if (phone) {
|
||||
sendSms(phone, message)
|
||||
}
|
||||
}
|
||||
|
||||
def doorClosedHandler(evt) {
|
||||
def message = "EyXAr Detected the ${evt.displayName} is ${evt.value}!"
|
||||
if (sendPush) {
|
||||
sendPush(message)
|
||||
}
|
||||
if (phone) {
|
||||
sendSms(phone, message)
|
||||
}
|
||||
}
|
||||
|
||||
def contactHandler(evt) {
|
||||
if("open" == evt.value)
|
||||
|
||||
// contact was opened, turn on a light maybe?
|
||||
log.debug "Contact is in ${evt.value} state"
|
||||
|
||||
if("closed" == evt.value)
|
||||
// contact was closed, turn off the light?
|
||||
log.debug "Contact is in ${evt.value} state"
|
||||
}
|
||||
|
||||
/* Presense */
|
||||
def myHandler(evt) {
|
||||
if("present" == evt.value)
|
||||
def message = "EyXAr Detected ${evt.displayName} is ${evt.value}!"
|
||||
if (sendPush) {
|
||||
sendPush(message)
|
||||
}
|
||||
if (phone) {
|
||||
sendSms(phone, message)
|
||||
}
|
||||
}
|
||||
|
||||
def presenceHandler(evt) {
|
||||
|
||||
if (evt.value == "present") {
|
||||
log.debug "EyXAr ${evt.displayName} has arrived at the ${location}!"
|
||||
sendPush("EyXAr ${evt.displayName} has arrived at the ${location}!")
|
||||
} else if (evt.value == "not present") {
|
||||
|
||||
log.debug "EyXAr ${evt.displayName} has left the ${location}!"
|
||||
|
||||
sendPush("EyXAr ${evt.displayName} has left the ${location}!")
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* Simulated Device Manager
|
||||
*
|
||||
* Author: SmartThings (Juan Risso - juan@smartthings.com)
|
||||
*/
|
||||
|
||||
definition(
|
||||
name: "Simulated Device Manager",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Allows you to create virtual devices to populate your account.",
|
||||
category: "SmartThings Labs",
|
||||
iconUrl: "https://d3abxbgmpfhmxi.cloudfront.net/assets/downloads/smartthings-logo-ring.7311e9df.png",
|
||||
iconX2Url: "https://d3abxbgmpfhmxi.cloudfront.net/assets/downloads/smartthings-logo-ring.7311e9df.png",
|
||||
singleInstance: true
|
||||
)
|
||||
|
||||
preferences {
|
||||
page(name:"selectDevices", title:"Simulated Device Manager")
|
||||
}
|
||||
|
||||
//PAGES
|
||||
def selectDevices() {
|
||||
return dynamicPage(name:"selectDevices", title:"Simulated Device Manager", nextPage:"", install:true, uninstall: true) {
|
||||
def options = [1,2,3,4,5]
|
||||
section("Please select the number of virtual devices you want to install") {
|
||||
input "selectedswitch", "enum", required:false, title:"Select number of Simulated Switches", multiple:false, options:options
|
||||
input "selectedmotion", "enum", required:false, title:"Select number of Simulated Motion Sensors", multiple:false, options:options
|
||||
input "selectedpresence", "enum", required:false, title:"Select number of Simulated Presence Sensors", multiple:false, options:options
|
||||
input "selectedsmoke", "enum", required:false, title:"Select number of Simulated Smoke Alarms", multiple:false, options:options
|
||||
input "selectedleak", "enum", required:false, title:"Select number of Simulated Water Sensors", multiple:false, options:options
|
||||
input "selectedalarm", "enum", required:false, title:"Select number of Simulated Alarms", multiple:false, options:options
|
||||
input "selectedbutton", "enum", required:false, title:"Select number of Simulated Buttons", multiple:false, options:options
|
||||
input "selectedcontact", "enum", required:false, title:"Select number of Simulated Contact Sensors", multiple:false, options:options
|
||||
input "selectedlock", "enum", required:false, title:"Select number of Simulated Locks", multiple:false, options:options
|
||||
input "selectedtemperature", "enum", required:false, title:"Select number of Simulated Temperature Sensors", multiple:false, options:options
|
||||
input "selectedthermostat", "enum", required:false, title:"Select number of Simulated Thermostats", multiple:false, options:options
|
||||
input "selectedvalve", "enum", required:false, title:"Select number of Simulated Valves", multiple:false, options:options
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def installed() {
|
||||
log.trace "Installed with settings: ${settings}"
|
||||
initialize()
|
||||
}
|
||||
|
||||
def updated() {
|
||||
log.trace "Updated with settings: ${settings}"
|
||||
initialize()
|
||||
}
|
||||
|
||||
def uninstalled() {
|
||||
def devices = getChildDevices()
|
||||
log.trace "deleting ${devices.size()} device"
|
||||
devices.each {
|
||||
deleteChildDevice(it.deviceNetworkId)
|
||||
}
|
||||
}
|
||||
|
||||
def initialize() {
|
||||
addDevice()
|
||||
}
|
||||
|
||||
//CHILD DEVICE METHODS
|
||||
def addDevice(){
|
||||
log.trace "addDevice()"
|
||||
def type = [selectedswitch: selectedswitch,selectedmotion: selectedmotion,selectedpresence: selectedpresence,selectedsmoke: selectedsmoke,selectedleak: selectedleak,selectedalarm: selectedalarm,selectedbutton: selectedbutton,selectedcontact: selectedcontact,selectedlock: selectedlock,selectedtemperature: selectedtemperature,selectedthermostat: selectedthermostat,selectedvalve: selectedvalve]
|
||||
type.each {key, value ->
|
||||
if (value > 0) {
|
||||
def deviceName = getDeviceName(key)
|
||||
log.trace "Adding ${deviceName}"
|
||||
def aux
|
||||
for (aux = 1; aux <= value; aux++) {
|
||||
def dni = "$key$aux"
|
||||
def d = getChildDevice(dni)
|
||||
if(!d) {
|
||||
d = addChildDevice("smartthings/testing", deviceName, dni, null, [label:"${deviceName} ${aux}"])
|
||||
log.trace "Created ${deviceName} with id ${dni}"
|
||||
} else {
|
||||
log.trace "${dni} already exists"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def getDeviceName(type) {
|
||||
def result
|
||||
switch (type) {
|
||||
case 'selectedswitch':
|
||||
result = 'Simulated Switch'
|
||||
break
|
||||
case 'selectedmotion':
|
||||
result = 'Simulated Motion Sensor'
|
||||
break
|
||||
case 'selectedpresence':
|
||||
result = 'Simulated Presence Sensor'
|
||||
break
|
||||
case 'selectedsmoke':
|
||||
result = 'Simulated Smoke Alarm'
|
||||
break
|
||||
case 'selectedleak':
|
||||
result = 'Simulated Water Sensor'
|
||||
break
|
||||
case 'selectedalarm':
|
||||
result = 'Simulated Alarm'
|
||||
break
|
||||
case 'selectedbutton':
|
||||
result = 'Simulated Button'
|
||||
break
|
||||
case 'selectedcontact':
|
||||
result = 'Simulated Contact Sensor'
|
||||
break
|
||||
case 'selectedlock':
|
||||
result = 'Simulated Lock'
|
||||
break
|
||||
case 'selectedtemperature':
|
||||
result = 'Simulated Temperature Sensor'
|
||||
break
|
||||
case 'selectedthermostat':
|
||||
result = 'Simulated Thermostat'
|
||||
break
|
||||
case 'selectedvalve':
|
||||
result = 'Simulated Water Valve'
|
||||
break
|
||||
default:
|
||||
result = ''
|
||||
break
|
||||
}
|
||||
result
|
||||
}
|
||||
Reference in New Issue
Block a user