Ring Doorbell Motion Sensor with SmartLighting—infinite loop problem

So, I took the plunge and installed a Ring Pro doorbell on my house. As part of the install, I thought it would be nice to have Ring’s motion sensor set to turn on my porch lights when it detects motion at night. I used SmartLighting to set up the interaction and told it to turn off the lights after 15 minutes of no motion from the Ring.

Unfortunately, when the lights turn off after 15 minutes, the Ring interprets that as motion and turns the lights back on again. This puts the routine into a loop until I either turn the lights off manually as soon as they turn on or until morning comes, when the Smartlighting routine is set to go inactive. I have the motion sensitivity on the Ring turned down to the minimum. Any idea what I can do to get the lights and motion detector out of this loop?

I just installed one recently and I will be setting up rules in webCoRE. I’ll let you know how it goes tonight.

I had this same issue and created two core pistons. One piston I named ‘Porch Motion on’ to turn on the light when motion is active. That piston was straight forward. I created a second piston to turn off the light when motion stops. But the second piston does the following actions to prevent the looping actions:

Using Front Porch Light…
► Wait 2 minutes
► Pause piston 'Porch Motion on’
► Turn off
► Wait 3 seconds
► Resume piston ‘Porch Motion on’


As I am working my way through this, I see that there is no way of changing parameters of the ring via ST? I would like to setup something that says:

If these presence sensors are present
Then turn off motion for Ring Pro

I do not see a way of doing this in ST. Maybe the IFTTT channel offers this?

Essentially, I would like to make the motion on/off schedule not fixed (Ring App) but variable based on when we are or are not home…

If you use core pistons instead of the smartlighting smart app then you can add a condition in the pistons that checks the Location mode (Home, Away, Night, etc.). My pistons only fire when the house is in night mode.

I just went through this with my Ring doorbell. I wrote a smartapp to handle it. It’s pretty simple. Web core is probably easier but I just like writing my own stuff.

My app keeps the porch light on for 5 minutes after motion stops. Just before I turn off the light I unsubscribe from the motion sensor. I then turn motion back on 15 seconds after I shut off teh light. It runs from sunset to sunrise. Using a smartapp I could set it to only run based on presence, but I just want it running all the time when it’s dark.

1 Like

Any chance to have access at your smartapp?:slight_smile: I want to try it.

I would love to give your app a try. Any chance you would be willing to share your code?

This was written just for my use so you will need to update the zipcode, but your welcome to edit as you need. I started with one of the basic templates. For some reason the sunset sunrise event handlers that are commented out in the initialize sub don’t seem to fire as I understand they should that is why I am using the scheduled events. I just wrote this a few days ago but it seems to be working pretty well.


  • Copyright 2015 SmartThings
  • 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.
  • Front Door motion
  • Author: Me
    name: “Front Door Motion”,
    namespace: “Me”,
    author: “Me”,
    description: “Turn your front porch light when motion is detected, between sunset and sunrise.”,
    category: “Convenience”,
    iconUrl: “https://s3.amazonaws.com/smartapp-icons/Meta/light_motion-outlet.png”,
    iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Meta/light_motion-outlet@2x.png

preferences {
section(“When there’s movement…”) {
input “motion1”, “capability.motionSensor”, title: “Where?”, required: true, multiple: false
section(“Turn on a light…”) {
input “switch1”, “capability.switch”, required: true, multiple: false

def installed()

def updated()

def initialize() {
//subscribe(location, “sunset”, sunsetHandler)
//subscribe(location, “sunrise”, sunriseHandler)
subscribe(switch1, “switch.off”, switchHandler)
schedule(“0 0 12 * * ?”, sunriseSunsetHandler)
if (issunset()) {
subscribe(motion1, “motion.active”, motionActiveHandler)}

def motionActiveHandler(evt) {
log.debug “Motion detected”

def switchHandler(evt) {
log.debug “Switch turned off”

def OffTimeHandler() {
log.debug “OffTimeHandler”

def reupHandler() {
log.debug “reupHandler”
if (issunset()) {
subscribe(motion1, “motion.active”, motionActiveHandler)}

def sunsetHandler() {
subscribe(motion1, “motion.active”, motionActiveHandler)

def sunriseHandler() {
def issunset(){
def WRTimes = getSunriseAndSunset(zipCode: “31088”)
def between = timeOfDayIsBetween(WRTimes.sunset, WRTimes.sunrise, new Date(), location.timeZone)
log.debug “Sunset?:${between}”
return between

def sunriseSunsetHandler(){
log.debug “Setting Sunrise Sunset times”
def WRTimes = getSunriseAndSunset(zipCode: “31088”)
schedule(WRTimes.sunrise, sunriseHandler)
schedule(WRTimes.sunset, sunsetHandler)

1 Like

Thanks @Terminal.

@rontalley - I have created a routine in SmartThings that turns on two lamps in my house at sunset but only if I’m not in ‘Home’ or ‘Night’ mode. So basically it only runs if I’m away from the house. I haven’t tried this with the doorbell motion yet but I’m investigating that option.

@Terminal - (or anyone else who knows) how does one utilize your code? Please link to some instructions if you could. Thank you.

Start here perhaps.


Basically in “My smartapps” in the IDE you create a new smartapp from code.

Paste the code above in and save and publish. Then open it in the app and assign your doorbell and light.

1 Like

Thanks @Terminal. I figured it was something in the IDE but I haven’t touched that yet. Well, I think I might have had to activate my account for testing SmartTiles.

Ended up setting up motion zones in the Ring App but turning notifications for motion events off in the Ring App.

For all motion events, I use SmartThings and webCoRE. Turn On lights, send notifications, lock doors, etc…

Works great. Just can easily click the motion event notification to bring up the Ring App but it’s easy enough to do it since it’s right in my home page.

1 Like

Any updates on this issue, I’m a noob to this and started having this problem recently. Looking for any updates that may have fixed this problem. Seems like Ring may have pushed out an update that made the doorbell more sensitive to light level changes recently.

Hi Terminal,

I’m trying to paste the code above into the SmartThings IDE (create from Code into SmartApps) but getting errors when I try to create.

Can you repost the code that I need to paste in? I understand that I will have to assign my area code, Ring Door Bell Motion Detector, and Switch that turns on the Light but I can’t get to that point until I can create, save, and publish the SmartApp.

Thanks in Advance,


That code is correct. I haven’t used it it a few months. I have since moved and I left my Ring doorbell at my last house. Are you removing the [code] tags that are at the beginning and end. I guess that is something the forum sticks on there but it shouldn’t be pasted into the IDE editor.

I am an absolute greenhorn on this stuff but have the same issue. I have SmartThings and its IDE component. Any way you could point me to an explanation of what you used to fix this? I greatly appreciate the time and advice in advance.


@ThebigO use the below piston in webcore and it should get you up and working without the looping.