Garage Light Control

Hello All -

Now that I have most of my switches in and things are stable, you’ll likely see a few of these annoying threads from me as I get the hang of programming events, etc.

I have a simple one and think there are a few ways of handling so I’m looking for input. While I love the work Richard has done with PLEG/PLTS/etc, I think this can just be done with normal Vera stuff.

Schedule:
During the “night”

Trigger:
Garage door opens (assuming it was closed before “night” happens but curious what might happen if the door is open and then “night” triggers) The sensor is a tilt sensor.

Event/Scene:
Turn on Garage and Laundry/Mudroom light for 10 minutes.

Can’t I just do this without plugins? Or is it impossible to do because I’m asking for “night” AND a “trigger”.

Is this a job for PLTS perhaps?

So, you can use a scene and control it with Lua to go at night:

this is a true statement at night, so add it to your Luup and hit save:

return luup.is_night()

thee are a lot of examples if you search the forum

Conditional Scene Execution…

Thanks Bulldog. I will continue to search. I see a lot of examples of just using some simple Lua.

Take care.

BTW, I did just use a normal scene (with a delay) and it works fine.

However, when I started to think about this one, I immediately said “PLTS!”. I guess I’m trying to figure out what I would use PLTS over this method. I guess I shouldn’t because it works! But I like understanding several ways of solving the same problem and knowing when to use which…

If you had people coming and going frequently then you would want to use PLEG or PLTS as opposed to a delay in a scene.

The reason:
If you open the garage door, close the door as you enter the house, and your wife enters about 9 minutes later. The light will be on for about 1 minute while she is walking to the house and the garage light will go out … why ? Because the second garage door does NOT restart the timer from running the first scene!

[quote=“RichardTSchaefer, post:5, topic:180149”]If you had people coming and going frequently then you would want to use PLEG or PLTS as opposed to a delay in a scene.

The reason:
If you open the garage door, close the door as you enter the house, and your wife enters about 9 minutes later. The light will be on for about 1 minute while she is walking to the house and the garage light will go out … why ? Because the second garage door does NOT restart the timer from running the first scene![/quote]

Thank you! Yes, this makes perfect sense and is actually a scenario that could happen. Let me try to implement this with a PLTS. (I assume that’d be the right thing to do here as opposed to a PLEG condition.)

You only need PLTS if you visually want to be able to see the STATE of the logic.
PLEG condition is fine!
Actually would be two PLEG conditions.
One to turn on the Light, and one to turn off the light.

Opening the door would start a timer.
The second condition would wait for the timer to expire.
Open the door while the timer is already running should restart the timer with the full time.

[quote=“RichardTSchaefer, post:7, topic:180149”]You only need PLTS if you visually want to be able to see the STATE of the logic.
PLEG condition is fine!
Actually would be two PLEG conditions.
One to turn on the Light, and one to turn off the light.

Opening the door would start a timer.
The second condition would wait for the timer to expire.
Open the door while the timer is already running should restart the timer with the full time.[/quote]

The only thing one would have to be careful with here (regardless of PLEG or PLTS) would be the condition if the door was already open when “night” hit. (For instance, working outside, etc)

So, the code may look like:

TurnOnLights = Nighttime AND (GarageOpen AND (GarageOpen;NOW < 1:00)) 'Makes sure the door just opened within the past 60 seconds. Maybe make this 90 seconds because of the “once every 60 second evaluation period”?

TurnOffLights = TurnOnLights AND (TurnOneLights:NOW > 10:00) 'Turns off lights after they’ve been on for 10 minutes

Close?

I try to not use NOW unless it’s needed. It’s usually needed when you are talking about an event that happens some time after a detected event.

In your case this can be:

TurnOnLights = Nighttime AND GarageOpen AND (NightTime;GarageOpen)

i.e. the Garage Door has to open after night time.

The TurnOffLights meets the requirements to need to use NOW.
However other parts of it’s logic need to be corrected.

TurnOffLighs = LightsAreOn And (TurnOnLighths;NOW > 10:00) and (TurnOnLights; LightsAreOn < 30)

This will only turn off the lights if they were auto turned on (the last sequence expression) and only if the lights are currently on.
You need an Input Trigger for LightsAreOn that indicate true if the garage lights are on.

Hello Everyone -

Replying to an old thread of mine. I’ve been having trouble with this logic for quite some time. It has been a while since I’ve “PLEG’d” and having trouble figuring this out. Tonight I came home to the garage lights on (windows on the garage door). So before I opened it, I grabbed a status report to beg for help here.

It looks like my wife was here around 18:00 and turned on the light (either by the switch or opening the entry door - can’t tell.) For some reason, the lights were never commanded off.

Can someone help me think through this? Status report attached.

Lights On Logic
Triggers

[ul][li]GarageLightOn[/li]
[li]GarageOpen[/li]
[li]NightArrived[/li]
[li]GarageEntryDoor[/li]
[li]MorningLeaveGarage[/li][/ul]

Conditions

[ul][li]GarageEntryDoorTurnOnLights - !GarageLightOn AND !GarageOpen AND NightArrived AND (GarageEntryDoor AND (!GarageLightOn; GarageEntryDoor > 15))[/li]
[li]GarageOpenTurnOnGrgAndLndryLights - !MorningLeaveGarage AND NightArrived AND GarageOpen AND (NightArrived;GarageOpen) [/li]
[li]GarageOpenTurnOnGrgLightsOnly - MorningLeaveGarage AND NightArrived AND GarageOpen AND (NightArrived;GarageOpen) [/li][/ul]

Lights Off Logic
Triggers

[ul][li]GarageLightOn[/li]
[li]“Above Conditions”[/li][/ul]

Condition

[ul][li]TurnOffGarageLights - GarageLightOn And ((GarageLightOn;NOW > 5:00) and ((GarageOpenTurnOnGrgAndLndryLights; GarageLightOn < 15) OR (GarageOpenTurnOnGrgLightsOnly; GarageLightOn < 15) OR (GarageEntryDoorTurnOnLights; GarageLightOn < 15)))[/li][/ul]

She must have turned it on manually.
You only turn the lights off if they are on and one of the 3 conditions automatically turned it on.

You can have a LONGer delay for when the lights are on manual with the following:

TurnOffManuallyTurnedOnLight GarageLightOn And ((GarageLightOn;NOW > 15:00) and !TurnOffGarageLights

I would also change your condition name for TurnOffGarageLights to TurnOffAutoTurnedOnGarageLights

Hey Richard! Long time no talk. Thanks for the response.

This is what I thought…especially because the GarageLightOn was at 18:00. However, this should be impossible unless she did it from an app or console (which she wouldn’t). The entry door opening should turn on the lights for her. Maybe that didn’t work for some reason causing her to hit the switch.

I think I will add the “manual” off. The only reason I was avoiding this was I do use the garage as a workshop, working on the cars, etc and don’t want the light going out on me. Maybe I just need to add a motion or two and add it to the manual off condition.

Just create another mode ( virtual state), say workshop in use, and set that to auto off in 4-5 hours… You could activate that from your phone or tablet.

Sent from my iPad using Tapatalk

[quote=“curiousB, post:13, topic:180149”]Just create another mode ( virtual state), say workshop in use, and set that to auto off in 4-5 hours… You could activate that from your phone or tablet.

Sent from my iPad using Tapatalk[/quote]

That is a great idea (temporary lock-out of normal timer logic) and something that could be used in countless other areas. Thanks for the suggestion.