Turn on a light after i arrive and then a door opens

I want to make a piston that turns on a light if my presence changes to present and a door is opened.

Presence should be the first evaluation and then the door contact. I tried using And-If but it didn’t work. I thought about using Then-If but I don’t have the option of selecting “changes to” for the door contact.

I would think I’d want when presence changes to present and if contact changes to open then turn on light. Or if presence changes to present then if contact changes to open then turn on light.

These conditions don’t happen at the same time. I’m coming home, parking then coming in the door. I’d rather not be bound by a time span between presence and contact.

I do have a smart lighting app that turns on my outside lights when I come home. So when I used the “And-If” piston I knew the system knew I was home but the lights didn’t turn on when the door opened.

Thanks for the help.

You can use a variable to do this. Whenever you arrive set the variable to 1. When the variable is 1 and the contact opens the light turns ON. As soon as the door is opened, you can the. Set to change the variable to 0 after a 4-5 seconds.

If you are not comfortable using a variable then you can substitute the variable with a simulated switch as well.

The only ceveat is that if someone else opens the door as soon as you arrive then it turns on the light for them :slight_smile:

I thought about a very simple one.
Contact opens
Turn light on.
But then set a restriction to
Only when you are showing as present.

i’m new to CoRE so i’m trying to get used to configuring things. If it isn’t too much trouble could you tell me how to construct this with the variable method? I’m also unfamiliar with a simulated switch so i’m not sure how this could be used.

My goal is to restrict this to only occur when the hub is in night mode. The convenience is that when i get home and open the door the lights come on so i can see. I guess i’m not really concerned who actually opens the door. I think i like the variable method though but i’d also like to understand the simulated switch too.

I’m an IT guy and do a bunch with PowerShell so I understand variable and logic but I’m still learning the way of the CoRE Piston. :slight_smile:

I would say Simulated Switch will be an easier way since you are just implementing one scenario. To create a simulated switch, go to SmartThings IDE, then do to “My Devices” and then click on “+ New Device”… Then create a simulated switch like shown below.

You can then use this switch as follows,

Upon arrival, turn on “Arrival Switch”, wait 5 minutes and turn off
or if { arrival switch = “ON”} AND {Contact = open} AND { Mode = Night} , then turn ON Light

You can then leverage this switch for any other automations as well that you may want based on your arrival