Sure, I was asking in general, if there was some reason the same app could conflict with another instance.
Here is my code:
definition(
name: “Doorbell Flash Notification”,
namespace: “rjison9000”,
author: “Robert Ison”,
description: "When someone rings the bell of your Ring doorbell, a light of your choosing will flash. It will end up in the same state as it started. Enter 1 for flashes, it’ll just turn on and off over the time you’ve selected. Enter 0 for flashes, it’ll stay on for the number of minutes you select, then turn off regardless. ",
category: “My Apps”,
iconUrl: “http://cdn.device-icons.smartthings.com/Lighting/light11-icn.png”,
iconX2Url: “http://cdn.device-icons.smartthings.com/Lighting/light11-icn@2x.png”,
iconX3Url: “http://cdn.device-icons.smartthings.com/Lighting/light11-icn@2x.png”)
preferences {
section(“Ring Doorbell”) {
input “ringbutton”, “capability.button”, required: true, title: “Select your Ring doorbell?”
}
section("How many times do you want the light to flash?") {
input "flashes", "number", required: true, title: "Number of Flashes?"
}
section("How many minutes should the light flash?") {
input "minutes", "number", required: true, title: "Number of Minutes?"
}
section("Light to Flash") {
input "theswitch", "capability.switch", required: true
}
}
def installed() {
initialize()
}
def updated() {
unsubscribe()
initialize()
}
def initialize() {
subscribe(ringbutton, “button”, ringDetectedHandler)
log.debug “Initialize”
}
void ringDetectedHandler(evt) {
log.debug "ringDetectedHandler"
def switchState = theswitch.currentState(“switch”)
//log.debug "switchState.value $switchState.value"
def switchlevelState = theswitch.currentState(“level”)
//log.debug “switchlevelState.value $switchlevelState.value”
def currentTotalDelay = 0
def switchStartedOn = switchState.value == 'on'
if (flashes == 0){
flashes = 1
switchStartedOn = false;
}
// Let's calculate this AFTER we turn a values of 0 flashes to 1
def millisecondDelay = Math.round((minutes * 3000 ) / flashes)
if (evt && evt.value && evt.value == 'pushed'){
for (int i = 0; i < flashes; i++){
log.debug "Flash " + i + " of " + flashes + ". (Delay: " + currentTotalDelay + " ms)"
if (switchStartedOn){
log.debug "OFF"
theswitch.off([delay: currentTotalDelay])
currentTotalDelay += millisecondDelay
}
log.debug "ON"
theswitch.on([delay: currentTotalDelay])
currentTotalDelay += millisecondDelay
if (!switchStartedOn){
log.debug "OFF"
theswitch.off([delay: currentTotalDelay])
currentTotalDelay += millisecondDelay
}
}
}
}