AlarmThing app

Hey guys, I happened to have found this AlarmThing app. I wanted to test it out on my phone, but it is plain weird to me.
Does anybody know how this app could subscribe to “contact” and “motion” events, while it’s using the alarm capability?
Is it that this app might have its own specialized device handler that can generate contact and motion events from a device that integrates alarm, contact, and motion capabilities? Or, is it that we need some other app/device that can send the events to this app? Thanks everyone!

/**

  • AlarmThing AlertAll
  • Copyright 2014 ObyCode
  • 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: “AlarmThing AlertAll”,
namespace: “com.obycode”,
author: “ObyCode”,
description: “Send a message whenever any sensor changes on the alarm.”,
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
)

preferences {
section(“Notify me when there is any activity on this alarm:”) {
input “theAlarm”, “capability.alarm”, multiple: false, required: true
}
}

def installed() {
log.debug “Installed with settings: ${settings}”

initialize()

}

def updated() {
log.debug “Updated with settings: ${settings}”

unsubscribe()
initialize()

}

def initialize() {
log.debug “in initialize”
subscribe(theAlarm, “contact”, contactTriggered)
subscribe(theAlarm, “motion”, motionTriggered)
}

def contactTriggered(evt) {
if (evt.value == “open”) {
sendPush(“A door was opened”)
} else {
sendPush(“A door was closed”)
}
}

def motionTriggered(evt) {
if (evt.value == “active”) {
sendPush(“Alarm motion detected”)
}// else {
//sendPush(“Motion stopped”)
//}
}

Tagging @obycode . :wink:

Thank you @JDRoberts. I happened to visit the Obycode Github and I’ve found out that they are using the groovy code here for the AlarmThing-AlertAll.groovy: https://github.com/obycode/DSCAlarmSmartThings

I think what’s happening is that it uses the AlarmThing.groovy as a device handler that talks to a DSC alarm. We need to install AlarmThingManager.groovy that would generate child devices in the form of Virtual Motion Sensor, Virtual Contact Sensor, etc. Then these virtual device handlers would generate events when there are zone changes.

Here, I have another confusion. The above app (AlarmThing-AlertAll), would wait for motion and contact events right, and they should come from the virtual device handlers created as the children of the AlarmThingManager.groovy. But, how is this even possible, because the events are generated by the children of the AlarmThingManager app and they are not generated by the AlarmThing device handler directly. The AlarmThing-AlertAll and AlarmThingManager both subscribe to the AlarmThing device handler. How does this event/subscription model in SmartThings really work?

You’re right. That app was designed to be used for that DSC alarm device type. To be honest, I don’t remember exactly how that was working, and I don’t have this alarm in place anymore to test it. Looking at the code now, it does seem that it should not work. My apologies for apparently outdated code. It looks like you could subscribe to the “zoneChanged” event if you wanted to trigger something on all changes in state of your alarm zones.

Can someone show me the settings of one of their working child contact sensor? The AlarmThingManager is not creating any child devices automatically for some unknown reason. I’m trying to create them manually.

Here’s what I have created but it doesn’t work:

FrontDoor Device FrontDoor

Name FrontDoor
Label FrontDoor
Type Virtual Contact Sensor
Version Published
Device Network Id zone001
Status ACTIVE
Hub CastleHub
Last Activity At 2018-12-19 4:16 PM PST
Date Created 2018-12-19 4:16 PM PST
Last Updated 2018-12-19 4:16 PM PST
Data No data found for device
Current States No states found
Execution Location Cloud
Events List Events
In Use By

Perhaps try contacting @obycode through the website? http://obycode.com/
I think last time that’s what I did and that’s what brought @obycode to check out this message. :slight_smile: