Turn on lights with garage door


#1

1) Give a description of the problem
I’m trying to create a piston that turns on 2 lights when my garage door is activated and off after a few minutes of inactivity. This is pretty simple but one of the lights I want to stay on if it was already on.

2) What is the expected behavior?
Ultimately, I’d like to start a timer when the garage door is activated. I can turn the lights on easy enough, but when the time runs out, have the lights turn off, however, not the specific light if it were on before the timer started, and I would like the timer to reset if the garage is activated again before time runs out.

3) What is happening/not happening?
I created a basic on/5-minutes-later/off piston but wanted to take it a little further as I noticed if the garage were activated within a 5 minute period, the piston wouldn’t refire.

**4) Post a Green Snapshot of the piston!

Thank you as always!


#2

I’ll throw together an example now - if you continue to have troubles with it, we’ll figure it out and get it working.


#3

Great thanks! In thinking about it I can come up with bits and pieces of it but keep running into walls.


#4

Here you go - tried and true! Let me know if you have any questions on it.


#5

Looking for something like this ???

It looks @ the lights state (level and on/off) and saves them and restores them to that state when the timer finishes


#6

That will probably work, too. The only caveat being the “restore attributes”. I’ve had mixed luck with dimmer switches. The problem is you simultaneously restore the switch to “off” and the level to “XX%”, and the “XX%” is interpreted as an ON command by the dimmer.

We replied at the same time. Check out what I posted above yours… I think you’ll have better luck with it on a dimmer. I tried it across two dimmers and it worked perfectly. Just change the wait time from 30 seconds to 5 minutes… I had it shorter for testing and forgot to set it back.


#7

@JohnHoke & @michicago thank you both for your replies. The only issues I have with them is I’d want then to trigger on both opening and closing actions. This means if you open the garage then drive in and then close the garage, then the state of the light that changes, will always be on and it’ll never turn off.

If there’s no way to get it to work that way, I guess I really don’t need the outside light (which is the variable light) to turn on when the door is closing, but it would be nice.

On another note @JohnHoke, how did you get the “capture” action? I’ve been thinking of doing stuff that would require that but hadn’t seen it before.


#8

Just so I understand… when the door opens you want to turn on only the lights that were off, then wait 5 minutes, then only turn lights off that the piston turned on.

If the door closes… you want to leave all lights on? Not following the garage door trigger followed by “then the state of the light that changes will never turn off.”


#9

I’m looking for the following to happen when the door both opens and closes.

Turn on the inside light, then off 5 minutes later. Turn on the outside light, then off 5 minutes later, but leave it on if it was already on before the door was activated. Also, I don’t want this light to come on if the hub is in a certain mode (forgot to mention this)


#10

The piston I posted does that. Just add an AND mode is not xxxx to the IF condition.

Your latest post has nothing about the actions when the door closes - or the state of the light that changes never turning off - parts of your post #7 that I didn’t understand.

This piston you’re after is easy to do… just need to know everything you want it to do and what exceptions there are.

It’s 3am here though, so I’m going to sleep. I’ll take a crack at it tomorrow if you can post up some clear instructions.


#11

Thank you for staying up so late with me. I was able to edit in a green snapshot of my original piston. In that piston you’ll see I have it trigger on ANY change from the garage door (it’s an angle sensor so it can tell if the door is opening or closing). Basically, any time I press the button for the garage door, I want the inside light to turn on and then turn off 5 minutes later. At night (during night mode) I want the outside lights to turn on and turn off 5 minutes later BUT ONLY IF THEY WEREN’T ALREADY ON.

What I was saying in #7 is that using your piston where it stores the lights that aren’t on and turns the matching lights on, then off 5 minutes later, is that if I open the garage (piston runs) drive into the garage, then close it (piston runs again) the outside light is still on from the first time the piston ran and will not turn off, or might turn off 5 minutes after the piston ran the first time. This brings up another issue in that the inside light will turn off 5 minutes after the door is opened so theoretically (and this happens to me a lot actually) it can turn off while I’m still in the garage if I closed the door within 5 minutes of opening it.


#12

After thinking about it for a long time (it hurt, trust me) I came up with this piston…

The first “chunk” activates on any change of the door, stores any light that has been off for more than 5 minutes into a variable, turns on the inside light, then turns on the outside lights (only if mode is night). E seconds “chunk” is activated once the door has remained unchanged for 5 minutes and it turns off the lights in the variable mentioned above.

What do you think? The only problem I think I have with this is similar to the issue I had earlier. If the door activates again within 5 minutes of the first event, will it whipe the variable? If so I guess I could put a restriction to only set the variable if all lights have been off for 5+ minutes, then it won’t change when the door is activated multiple times (this happens daily as I leave for work in the morning literally minutes after someone else, but they insist on closing the door)

Thanks again for all your help!


#13

When setting up the actions its an option in the dropdown list

So I capture them to the local store IF NOT SET this way the door opening/closing wont reset the variable

eg: The interior light is on & @ 50% when the door opens, and the ext lights are off
it records each light to its own variable and holds that (IF NOT YET SET)

THen the light turns on 100% and the door opens/closes again - the variable is still @ 50% so after 5m the lights go back to where they were

Try it :slight_smile:


#14

Hey, sorry for the delay in getting back to you! I’ve been feeling like a dead man all day. I think some of the vegetables I ate in India weren’t thoroughly cooked… I haven’t been taken down like that for at least 10 years.

Feeling somewhat human again and have a decent layover here, so I’m going to take a crack at a new piston for you and try to explain what it’s doing.


#15

Just reviewed the piston you wrote above (vi9ja) and think you’re on the right path now. Good work! I know coming up with these can involve some aspirin, but once you get them working there’s a good amount of satisfaction seeing them in action.

You’re right about the piston firing on the door closing and overwriting your variables, too. That’s an easy fix though… change that first IF to “garage door changes to open”. That way, when the garage door closes it will evaluate false and the section of code with your variable setting will not run.

Speaking of variables, I think you might have that inverted… if I’m reading it right. Is “PreOn” supposed to store bulbs that were already on? Or that the piston turned on? Maybe the name PreOn is just throwing me off.

One last thing on the variable - I think the “was off for at least 5 minutes” isn’t buying you anything. If someone walked out to the garage and turned the lights on for some reason, then you came home, the lights wouldn’t turn on when you arrived. Maybe that’s not a concern though - just not sure what you’re trying to avoid there (maybe something the change to your first IF statement will resolve).

How are you setting your hub to night mode? Another way to achieve that would be “if time (under virtual devices” is between Sunset and Sunrise.

Hope that helps! Any questions, let me know but I think you’ve almost got this one beat.


#16

Yea I named that variable in a rush when I first started building the piston thinking maybe I was going to run it inverted or something. Then I came back to it hours later and left the name. It probably should be PreOff because that’s what the devices in the variable are, pre-trigger they are off.

I ran a real world test this morning. Someone opened the garage, drove out, then closed the garage, all in a space of about 2 minutes and the lights never turned off. I’m pretty sure this is because the second time the door was activated it overwrote my variable to be empty since all the lights were still on. I think what I’ll do is just put a restriction to fill the variable if the door hasn’t changed in 5 minutes.

As for my night mode, I have another piston that puts the hub in night mode. I have it set to change to night at sun down and back to home at sun rise. I have a lot of pistons that are centered around sunrise and sunset and it was just easier to use the mode as triggers and conditions than to keep putting in “30 minutes to sunset and 30 minutes after sunrise”


#17

You shouldn’t need a restriction the way it’s written (if you update your first IF statement).

Try changing that, run in again, and if it doesn’t work as you want it… post full logs and I’ll help you sort it out.


#18

What about triggering the lights to come on when the garage closes? That’s why I want to keep it as IF the garage door changes.


#19

Just put everything you want to happen when it closes in the ELSE part of your “if garage door opens” condition.


#20

Sorry it took so long to reply. I put it to a real world test again this morning and it seemed to work exactly how I wanted! Thank you both so much!