How to record Open/close as action to use later stage to turn of Light?


#1

Hello,

I have a bathroom downstairs with a light that turns on automatically when the door contact sensor opens.
I also have a timer to turn off the light after 10 minutes.

My knowledge is limited as i’m new to Webcore, but is there a smart way to detect if the door is opens/close within a X time, the state will change that someone being present in the bathroom.
Then after X time, if the door opens/closes again, the state will change to non present then i can turn off the light. save waiting 10 minutes to turn off automatically.

Is this the best way of doing this and if so, how do the program it?

Thanks all


#2

This should work


#3

So I open door, light on
Close door, light off correct?

So this means when I open door walk in and close door behind me. The light will be off then no? :slight_smile:


#4

Ahh yes, my fault. Let me try again


#5

Try that one… I think this will work for what you are looking for


#6

thanks for the reply, how did you set up the time and boolean condition.
It looks different to your setup.

image


#7

You don’t need to set up anything initially. Just import the piston, and try to open and close your door. It should populate those variables on each event that happens

If that doesn’t work, open your piston view and scroll down to the variables section. Find the variable named FirstOpen and click on the edit little square. From there you can change it to false so the piston will fire correctly. See photo below:


#8

Are you trying to use this as an occupancy variable to determine if someone is inside if the door has opened or not. Let me just tell you, this doesn’t work in the long run because it’s never that orderly. If you open the door but don’t walk in, the light will be on. Then when you open the door to walk in the light will turn off. What if you open the door and one person walks out and another walks in? When that person closes the door, the lights will turn off. I’ve seen a lot of people try to use open close sensors to termine if a room is occupied and in the long run, a motion sensor is more reliable.


#9

That’s brilliant, it’s working perfectly.
Thank you!


#10

Starting to have some issues with this, sometimes the ‘‘FirstOpen’’ stays in a True state and screws up everything.
I have to manually go into webcore and things it to a false statement.
Any suggestions?