My solution to this was a man in the middle virtual alarm with a smart app running that relays its state based on a configurable delay. I have this virtual “Alarm Relay” device tied to SHM, which will receive the appropriate alarms, the smartapp watches for state changes and forwards them on to the actual hardware after some preset time.
The smartapp will instantly relay the “off” command so you’re not stuck with the alarm sounding if you disarm SHM. Additionally, there is a configurable setting to ignore the delay (and instantly sound) during specific modes.
Code for the smartapp is below. If you are trying to install it and have any issues/questions let me know.
/**
* Alarm Relay
*
* Copyright 2016 SneakingBuffalo
*
* 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: "Alarm Relay",
namespace: "SneakBuff",
author: "SneakingBuffalo",
description: "This smartapp will relay the conditions of one alarm to another with a specified time delay in between.",
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("Preferences") {
input "parentAlarm", "capability.alarm", title: "Parent Alarm", multiple: false, required: true
input "relayAlarm", "capability.alarm", title: "Relay Alarm", multiple: false, required: true
input "delayTime", "number", title: "Delay Seconds", description: "", required: true
input "modes", "mode", title: "Ignore Delay in mode(s)", 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() {
state.delay = (delayTime != null && delayTime != "") ? delayTime : 5
subscribe(parentAlarm, "alarm", "alarmHandler")
}
def alarmHandler(evt) {
if(evt.value == "siren" || evt.value == "both" || evt.value == "strobe")
{
// If we're in an ignore mode, relay immediately
if(modes?.find{it == location.mode})
{
log.debug "Relay running now due to ignore delay mode: ${location.mode}"
relayHandler()
}
// Otherwise, schedule for later
else
{
log.debug "Relay Scheduled in ${state.delay} seconds"
runIn(state.delay, relayHandler)
}
}else if(evt.value == "off"){
log.debug "Relaying Off Immediately"
relayAlarm.off()
}
}
def relayHandler() {
def curState = parentAlarm.currentValue("alarm")
if(curState != "off")
{
if(curState == "strobe")
{
log.debug "Relaying Strobe"
relayAlarm.strobe()
}else if(curState == "siren"){
log.debug "Relaying Siren"
relayAlarm.siren()
}else if(curState == "both"){
log.debug "Relaying Both"
relayAlarm.both()
}
}
}