mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-29 06:13:07 +01:00
Compare commits
1 Commits
MSA-1849-1
...
MSA-1845-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a001fa409b |
@@ -1,2 +0,0 @@
|
|||||||
.st-ignore
|
|
||||||
README.md
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
# Aeon Siren
|
|
||||||
|
|
||||||
Cloud Execution
|
|
||||||
|
|
||||||
Works with:
|
|
||||||
|
|
||||||
* [Aeon Labs Siren (Gen 5)](https://www.smartthings.com/works-with-smartthings/aeon-labs/aeon-labs-siren-gen-5)
|
|
||||||
|
|
||||||
## Table of contents
|
|
||||||
|
|
||||||
* [Capabilities](#capabilities)
|
|
||||||
* [Health](#device-health)
|
|
||||||
|
|
||||||
## Capabilities
|
|
||||||
|
|
||||||
* **Actuator** - represents that a Device has commands
|
|
||||||
* **Alarm** - allows for interacting with devices that serve as alarms
|
|
||||||
* **Switch** - can detect state (possible values: on/off)
|
|
||||||
* **Health Check** - indicates ability to get device health notifications
|
|
||||||
|
|
||||||
## Device Health
|
|
||||||
|
|
||||||
Aeon Labs Siren (Gen 5) 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:
|
|
||||||
* [Aeon Labs Siren (Gen 5) Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/204555240-Aeon-Labs-Siren-Gen-5-)
|
|
||||||
@@ -20,11 +20,10 @@ metadata {
|
|||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Alarm"
|
capability "Alarm"
|
||||||
capability "Switch"
|
capability "Switch"
|
||||||
capability "Health Check"
|
|
||||||
|
|
||||||
command "test"
|
command "test"
|
||||||
|
|
||||||
fingerprint deviceId: "0x1005", inClusters: "0x5E,0x98", deviceJoinName: "Aeon Labs Siren (Gen 5)"
|
fingerprint deviceId: "0x1005", inClusters: "0x5E,0x98"
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
@@ -59,9 +58,6 @@ metadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def updated() {
|
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])
|
|
||||||
|
|
||||||
if(!state.sound) state.sound = 1
|
if(!state.sound) state.sound = 1
|
||||||
if(!state.volume) state.volume = 3
|
if(!state.volume) state.volume = 3
|
||||||
|
|
||||||
@@ -152,10 +148,3 @@ def test() {
|
|||||||
private secure(physicalgraph.zwave.Command cmd) {
|
private secure(physicalgraph.zwave.Command cmd) {
|
||||||
zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format()
|
zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* PING is used by Device-Watch in attempt to reach the Device
|
|
||||||
* */
|
|
||||||
def ping() {
|
|
||||||
secure(zwave.basicV1.basicGet())
|
|
||||||
}
|
|
||||||
@@ -106,12 +106,6 @@ def parse(String description) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (map.name == "temperature") {
|
|
||||||
if (tempOffset) {
|
|
||||||
map.value = (int) map.value + (int) tempOffset
|
|
||||||
}
|
|
||||||
map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
|
|
||||||
map.translatable = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug "Parse returned $map"
|
log.debug "Parse returned $map"
|
||||||
|
|||||||
@@ -112,12 +112,6 @@ def parse(String description) {
|
|||||||
map = getMotionResult(value)
|
map = getMotionResult(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (map.name == "temperature") {
|
|
||||||
if (tempOffset) {
|
|
||||||
map.value = (int) map.value + (int) tempOffset
|
|
||||||
}
|
|
||||||
map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
|
|
||||||
map.translatable = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug "Parse returned $map"
|
log.debug "Parse returned $map"
|
||||||
|
|||||||
@@ -95,12 +95,6 @@ def parse(String description) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (map.name == "temperature") {
|
|
||||||
if (tempOffset) {
|
|
||||||
map.value = (int) map.value + (int) tempOffset
|
|
||||||
}
|
|
||||||
map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
|
|
||||||
map.translatable = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug "Parse returned $map"
|
log.debug "Parse returned $map"
|
||||||
|
|||||||
@@ -88,12 +88,6 @@ def parse(String description) {
|
|||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code: ${descMap.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code: ${descMap.data[0]}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (map.name == "temperature") {
|
|
||||||
if (tempOffset) {
|
|
||||||
map.value = (int) map.value + (int) tempOffset
|
|
||||||
}
|
|
||||||
map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
|
|
||||||
map.translatable = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug "Parse returned $map"
|
log.debug "Parse returned $map"
|
||||||
|
|||||||
@@ -1,113 +0,0 @@
|
|||||||
/**
|
|
||||||
* Double Presence
|
|
||||||
*
|
|
||||||
* Copyright 2014 Matt Nohr
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
definition(
|
|
||||||
name: "Linked Presence",
|
|
||||||
namespace: "mrnohr",
|
|
||||||
author: "Matt Nohr",
|
|
||||||
description: "Send an alert of one presence sensor leaves without the other",
|
|
||||||
category: "My Apps",
|
|
||||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/text_presence.png",
|
|
||||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/text_presence@2x.png")
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Based on the discussion here: http://community.smartthings.com/t/linking-presence-sensors-in-pairs-for-seniors/4915
|
|
||||||
*
|
|
||||||
* Get an alert if one presence sensor leaves without the other one. The alert could be turning on a light, or sending
|
|
||||||
* a push/text message. The original idea was to monitor aging parents where one parent shouldn't be leaving the house
|
|
||||||
* without the other one. Could also work with parents and children, making sure a child doesn't leave without a parent.
|
|
||||||
*
|
|
||||||
* It works by subscribing to "not present" events for the "dependant" presence sensor. If the "main" sensor hasn't also
|
|
||||||
* recently left (in the past minute), then send the alert.
|
|
||||||
*/
|
|
||||||
preferences {
|
|
||||||
section("Presence Sensors") {
|
|
||||||
input "sensorDependant", "capability.presenceSensor", title: "When this person leaves alone"
|
|
||||||
input "sensorMain", "capability.presenceSensor", title: "Without this person"
|
|
||||||
input "timeDelay", "number", title: "With this delay (minutes)", default: 1
|
|
||||||
}
|
|
||||||
section("Alerts") {
|
|
||||||
input "switches", "capability.switch", title: "Turn on some lights?", required: false, multiple: true
|
|
||||||
input "sendPushMessage", "enum", title: "Send a push notification?", options: ["Yes", "No"], required: false
|
|
||||||
input "phoneNumber", "phone", title: "Send a text message?", required: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def installed() {
|
|
||||||
log.debug "Installed with settings: ${settings}"
|
|
||||||
|
|
||||||
initialize()
|
|
||||||
}
|
|
||||||
|
|
||||||
def updated() {
|
|
||||||
log.debug "Updated with settings: ${settings}"
|
|
||||||
|
|
||||||
unsubscribe()
|
|
||||||
unschedule()
|
|
||||||
initialize()
|
|
||||||
}
|
|
||||||
|
|
||||||
def initialize() {
|
|
||||||
subscribe(sensorDependant, "presence.not present", "leavingHandler")
|
|
||||||
}
|
|
||||||
|
|
||||||
//this will just handle scheduling/calling the checkOtherPresence method to handle the delay
|
|
||||||
def leavingHandler(evt) {
|
|
||||||
if(timeDelay > 0) {
|
|
||||||
log.debug "scheduling presence check for $timeDelay minute(s)"
|
|
||||||
runIn(timeDelay * 60, "checkOtherPresence")
|
|
||||||
} else {
|
|
||||||
checkOtherPresence()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def checkOtherPresence() {
|
|
||||||
log.debug "checking other presence sensor"
|
|
||||||
def dependantEvent = sensorDependant.latestState("presence")
|
|
||||||
|
|
||||||
//first make sure the dependant is still away
|
|
||||||
if(dependantEvent.value == "not present") {
|
|
||||||
//make sure there is an event first, just in the rare case there are no events
|
|
||||||
def mainEvent = sensorMain.latestState("presence")
|
|
||||||
if(mainEvent) {
|
|
||||||
//compare latest events from both devices
|
|
||||||
def eventTimeDifference = Math.abs(dependantEvent.date.time - mainEvent.date.time) / (1000 * 60) //minutes
|
|
||||||
def allowedTimeDifference = 1 //maybe use same timeDelay?
|
|
||||||
|
|
||||||
//make sure dependant left with main
|
|
||||||
if(mainEvent != "not present" || eventTimeDifference > allowedTimeDifference) {
|
|
||||||
def message = "$sensorDependant left without $sensorMain"
|
|
||||||
log.warn message
|
|
||||||
send(message) // send push/text
|
|
||||||
switches.on() // turn on lights
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//this should only happen if sensorMain is brand new and has never had any events
|
|
||||||
log.warn "$sensorDependant left but no events for $sensorMain"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private send(msg) {
|
|
||||||
if(sendPushMessage != "No") {
|
|
||||||
log.debug "Sending push notification: $msg"
|
|
||||||
sendPush(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
if(phoneNumber) {
|
|
||||||
log.debug "Sending text notification: $msg"
|
|
||||||
sendSms(phoneNumber, msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
/**
|
||||||
|
* smartelligynt smartthings event collector
|
||||||
|
*
|
||||||
|
* Copyright 2017 Rahul
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
definition(
|
||||||
|
name: "smartelligynt smartthings event collector",
|
||||||
|
namespace: "smartelligynt",
|
||||||
|
author: "Rahul",
|
||||||
|
description: "samsung smartthings event collector",
|
||||||
|
category: "SmartThings Labs",
|
||||||
|
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",
|
||||||
|
oauth: [displayName: "smartelligynt", displayLink: "http://www.smartelligynt.com"])
|
||||||
|
|
||||||
|
import groovy.json.JsonSlurper
|
||||||
|
|
||||||
|
preferences {
|
||||||
|
section("Select your devices to monitor with smartelligynt") {
|
||||||
|
input "switches", "capability.switch", title: "Switches", multiple: true, required: false
|
||||||
|
input "contacts", "capability.contactSensor", title: "Contact Sensors", multiple: true, required: false
|
||||||
|
input "accelerometers", "capability.accelerationSensor", title: "Accelerometers", multiple: true, required: false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
log.debug "Installed with settings: ${settings}"
|
||||||
|
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "Updated with settings: ${settings}"
|
||||||
|
|
||||||
|
unsubscribe()
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
|
// TODO: subscribe to attributes, devices, locations, etc.
|
||||||
|
log.debug "Updated with settings: ${settings}"
|
||||||
|
|
||||||
|
subscribeToDeviceEvents()
|
||||||
|
}
|
||||||
|
|
||||||
|
def subscribeToDeviceEvents() {
|
||||||
|
log.debug "Updated with settings: ${switches}"
|
||||||
|
if (null != accelerometers) {
|
||||||
|
subscribe(accelerometers, "acceleration", handleEvents)
|
||||||
|
}
|
||||||
|
if (null != switches) {
|
||||||
|
subscribe(switches, "switches", handleEvents)
|
||||||
|
}
|
||||||
|
if (null != contacts) {
|
||||||
|
subscribe(contacts, "contacts", handleEvents)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def handleEvents(evt) {
|
||||||
|
log.debug "$evt.displayName($evt.name:$evt.unit) $evt.value"
|
||||||
|
|
||||||
|
if (evt.unit != null) {
|
||||||
|
eventName = "$evt.displayName(${evt.name}_$evt.unit)"
|
||||||
|
}
|
||||||
|
def eventValue = "$evt.value"
|
||||||
|
|
||||||
|
postEvents(eventName, eventValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
def postEvents(eventName, eventValue)
|
||||||
|
{
|
||||||
|
def epoch = now() / 1000
|
||||||
|
|
||||||
|
def jsonSlurper = new JsonSlurper()
|
||||||
|
def txt = "{ \"en\": \"$eventName\", \"ev\" : \"$eventValue\", \"et\" : $epoch }"
|
||||||
|
def object = jsonSlurper.parseText(txt)
|
||||||
|
|
||||||
|
def params = [
|
||||||
|
uri: "http://collect.smartelligynt.com/api/events/",
|
||||||
|
body:
|
||||||
|
object
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
try {
|
||||||
|
httpPostJson(params) { resp ->
|
||||||
|
resp.headers.each {
|
||||||
|
log.debug "${it.name} : ${it.value}"
|
||||||
|
}
|
||||||
|
log.debug "response status code: ${resp.status}"
|
||||||
|
log.debug "response data: ${resp.data}"
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log.debug "something went wrong: $e"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : Implement mappings
|
||||||
|
// TODO: implement event handlers
|
||||||
Reference in New Issue
Block a user