Turn on lights with doorbell ring

I’m trying to create a piston to control integration between my Ring doorbell and my front lights. What I’m looking for is:

  • Turn on lights when doorbell rings between sunset and sunrise (ie front hall and porch lights)
  • Wait X minutes
  • Turn off lights ONLY IF front door has not opened since doorbell ring

So far I’ve got the piston set to turn on the lights when the doorbell rings (between sunset and sunrise), and turn off X minutes later, but I’m not sure how to add the condition to leave the lights on if the door has opened. The thought behind this is that if the front door has opened, then someone answered the door I don’t want to automatically turn the light off on them. Using a home/away mode could work, but I want the light to turn off if I’m home but didn’t answer the door.

To make it a bit more fancy, I’m thinking of adding another random wait time into the piston to delay the light turn on (so it’s not instant and seems more like someone is home).

One more step of fancy-ness is that eventually it will also be changed to utilize the light sensors throughout the house such that the light only comes on if it’s dark enough (based on specific threshold) as opposed to tying it to sunrise/sunset.

I don’t use webcore (prefer to write apps) but what I did for this was to use the close event of the door sensor…
I.e. If the door is open don’t switch off and then switch off 1 minute after closing the door

I would use a boolean variable for this. To set a true state of the door

Define Variable Boolean (Door Closed)=True

If doorbell rings
and time is between…
Then using light turn on

If Door Changes to Open
Set Variable (Door Closed)=False

If Door Changes to Close
And Ring Motion is Inactive
Set Variable (Door Closed)=True

If Ring Motion Stays Inactive for X Minutes
And Door is Closed
Set Variable (Door Closed)=True

If Light changes to On
And
Variable (Door Closed)=True
Wait X Minutes
Turn Off

If Light changes to On
And
Variable (Door Closed)=False
Then
Do whatever you want here

You can tweak it to better suit your needs but this is how I would use a boolean variable for what you are trying to accomplish.

1 Like

EDIT: Played around, and might have it working without a variable:

Within the section containing the wait, I’ve changed the TCP to “cancel on condition state change”.

in webCoRE, you can have multiple If scenarios within the same Piston. Then-If in CoRE works too!

Maybe I missed something, but how are you determining if the door has been opened?
Do you have a sensor on the door?

Yes - there is a sensor on the door. I’m hoping that setting the task cancelation policy (TCP) to “cancel on condition state change” will do the trick since I’ve put the front door being closed as a condition for the then statement to execute.

Will be able to test in a few hours and will post results.

Unfortunately the piston isn’t working entirely as intended - the light turns on and off no problem, but the TCP isn’t canceling the turn off portion when the front door is opened.

Am I misunderstanding what the “cancel on condition state change” does? I was under the impression that it would cancel pending tasks (ie, the delay and turn off part) if one of the initial conditions (ie, doorbell pushed and door closed) was no longer true?

I’m working on a custom app for this, but would really prefer to not have to delve into custom coding.

Try Cancel on Piston State Change.

I would also consider using webCoRE and the rule script I posted above using the Variable…

I would echo this… WebCoRE is much more capable then the original CoRE… I waited a while to switch my Pistons over to WebCoRE but am really glad I finally did as it is much easier to use than the original CoRE.

It took a couple of weeks but I’ve got everything ported over and have things running smoothly… (although I do find the occasional bug in my pistons).

1 Like