Garade door open (via Presence or not) and also the lights only if is night

light
presence

#1

Hi

I have create a piston with this piston i want to open my garage door when me or my wife come to home and also if garage door open and is afternoon or night an other switch that is light will be turn on for 90sec this with light i want to happen also if open garage door by ST app even if i am inside to the home and open the garage door from the app

working when i am arrive to home the garage door open but the light does not turn on or if i open the garage door via app again the lights does not turn on

my 2nd try without succsess

New problem at post #13

When arrive together me and my wife at the same time with my presence start open garage door and a second after with my wife presence change so the door stop in the middle

So can make a rule if a 2nd person arrived in Window 2min do not run piston 2nd time?


#2

Change this line:

image

To

image

Time is a “Virtual device”


#3

thanks for your quick reply but this does not working for me
i test it by using the app and open the garage door (i am already in the home)


#4

Line 22 means that the whole thing only executes when someone arrives home - “presence changes to present” is a singular event. If you are already home, the presence does not change; no event, no piston execution. Also, once it executes on the presence change, it checks line 30 for the conditions at that time. It does not sit around waiting for lines 31 -33 to become true.


#5

can you help me how can write the right code?

i do some change but does not working…


#6

Your second IF is nested inside the first, so start by moving that (lines 34-50) after the END IF that is currently line 51. That will allow the second IF to execute the piston even if PS1 and PS2 do not change state (i.e. already home).

As for the rest of it, I’m not entirely sure what you’re trying to do. It reads as if you want to open the garage door and have it open all night but I don’t think that’s your true intention. It appears that Switch 2 opens the garage door, but I can’t tell when you want to close it, if ever. Can you try describing what each of these devices is and what you want them to do in more detail? For example:
Switch 2 is a momentary button- one press to open the garage door, a second press to close it. I want the garage door to open when either person comes home and I want it closed at sunset or 90 seconds after someone comes home. WB1, RGB3, and O2 are lights that I want to come on at sunset and for 90 seconds when someone comes home, and I want them off 200 seconds after sunrise.

It looks like English is not your first language, but don’t worry about that. It just may take us a bit longer to solve this puzzle as I do not speak Greek!


#7

There was nothing wrong with your first piston other than you need to use “time”…and then leave the house and come back so that your Presence changes to present. It won’t work if you’re already present.


#8

thank you for your reply

the real button for my garage door work like this: when you push the button (turn on) when release the button (trun off) the door with press/release start opening then when completle open stay open for 30 sec and then start close again
so in device Switch 2 (GARAGE DOOR) i have set the switch goes automatically off after 3sec (to simulate the release of phisical button)
WB1,RGB3 and O2 is lights that i want to open when the door open for 90 sec to have time to enter to my house or to get in my car when i am in to my house… of course i do not want to open light at the day only for sunset to sunrise…


#9

Mike what myst add to work not only with presence but also when i am at home

when turn on the switch check if is between sunset to sunrise and also open the light with the garage door?


#10

i fix my problem when i am inside of my home
i hope this is will be working when i am return to home

here is my last working code


#11

Just so you understand…with what you have here, any time that Switch 2 changes to ON, this entire piston will run.

image

Also, when I want to test a condition that is based on Presence, I use a virtual (or simulated) presence sensor that I made in the Smart Things IDE. I think there are docs on here somewhere on how to make a virtual device. Then you can just use the app and toggle it Present/Away. Works well…


#12

Thanks everyone


#13

Mike can you help me in my new problem

When will arrive together me and my wife at the same time with my presence start open garage door and a second after with my wife presence the door stop in the middle

So can make a rule if arrive in Window 2min do not run piston 2nd time?


#14

Yeah, take a look at this thread. In it they describe a way to make a lockout based on time. It’s in the middle of the thread (around reply #10) where they start to show LastRun as a datetime value which you can then use to so that the piston does not rerun until the timeout has expired. Shout out to @michicago for his idea on that one.


#15

i fix my problem with that way (Variable)