Example Program Logic Generator

Hi,

Can someone provides me some step by step screenshot of the Program Logic Generator so I have an idea how it is used? I have two scenario in mind, but not sure how to distinguish between it in the PLG

Scenario #1

  • Trigger: Schlage Bolt Unlock (TF_Door_UNLOCK)
  • Condition: C1 (blank)
  • Action: GUI - Turn Lights #1 On, Lights #2 On, Lights #3 On

Scenario #2

  • Trigger: T1_Lamp ON
  • Trigger: T2_Outdoor On
  • Trigger: T3_Garage On
  • Condition: C2 (LightsOn; NOW > 3:00)
  • Action: GUI - Turn Lights #1 Off, Lights #2 Off, Lights #3 Off

I am not really sure how to structure the condition

Here is what I created, not sure if it is correct based upon what stated above.

To take Scenario above one step further, I want light to turn on only at NIGHT using the DAY/NIGHT plugin. How do I call it as a condition?

Hi Smilepak

Great you are asking for some screenshot eksampels !!!
I also need some more to understand the use of this app.
I have been lycky mine works, but I do not quite now why.
Regards
CE

@smilepak

I’m not sure I know what questions you are asking. Your conditions are fine if what you want is:

[ol][li]c1 actions will fire when TF1_Unlock becomes true[/li]
[li]c2 action will fire 3:00 to 3:59 after t1_Outdoor_2 becomes true[/li]
[li]c3 action will fire 3:00 to 3:59 after T1_Outdoor_1 becomes true[/li]
[li]c4 action will fire 5:00 to 5:59 after T1_Lamp becomes true[/li][/ol]

To add the Day or Night plugin as a trigger, select the plugin in the PLEG Inputs, Triggers, Device list then select Event Type as Day or Night has arrived then select the Mode as either Device indicates Day time or Device indicates Night time depending on how you want your trigger. E.g. If you name your trigger ItsNight, select Device indicates Night time

If you change your c1 condition to: TF1_Unlock and ItsNight then the actions will only fire when TF1_Unlock becomes true and Day or Night indicates that it is night. The condition could fire when either of the terms becomes true if the other one is already true. So, if the lock is unlocked, the actions would fire when it becomes night. If you don’t want this to happen you could use a sequence expression like: (ItsNight; TF1_Unlocked) and ItsNight so that the condition will fire only if the lock is unlocked after it becomes night time - and it is still night. The last part stops the condition firing based on the previous night’s ItsNight event.

Thanks that helped

[quote=“smilepak, post:5, topic:174470”]Thanks that helped[/quote]I’m very happy to hear it. :slight_smile:

Hi,

A couple of follow up questions

  1. What is the difference between “ItsDay AND (TG_Door1_Open;ItsDay)” vs "(ItsDay ; TG_Door1_Open) and ItsDay

[ul][li]Condition I am Looking For Is - It is Day AND TG_Door_1 triggered OPEN - DO THIS[/li]
[li][/li][/ul]

  1. Can I nest multiple AND? "ItsDay AND ItsArmed AND TG_Door1_Open?

[ul][li]Basically I am looking use the Day and Night Plugin and take advantage of the ARM/BYPASS function. So I setup trigger ARMED on the PLG and trigger ARMED on Door/windows sensor[/li]
[li][/li][/ul]

See attachment, this is how I have things now…

What is the difference between "ItsDay AND (TG_Door1_Open;ItsDay)" vs "(ItsDay ; TG_Door1_Open) and ItsDay"

The order of ItsDay and ( …; … ) makes no difference at all. The order of the terms in a sequence (xxx; yyy) make a big difference. (ItsDay ; TG_Door1_Open) becomes true when TG Door1_Open becomes true after ItsDay becomes true. b[/b] becomes true when ItsDay becomes true after TG_Door1 Open becomes true.

If you want a condition to fire when the door is opened at night then ItsNight and TG_Door Open should work.

Can I nest multiple AND? "ItsDay AND ItsArmed AND TG_Door1_Open?

Yes. You can string and clauses to your heart’s desire. The order doesn’t matter.

I’m not sure that your c1, c5, c6, c7 and c8 conditions are what you want. A sequence expression like c7 will fire when it becomes daytime (sunrise) after the door was opened - and its still open. So it fires at dawn if you opened the door before dawn and it’s still open. Is that what you wanted?

Hi…

I think I get it, but then I don’t. In programming, isn’t the “AND” condition requires both to be TRUE before execution?

(ItsDay ; TG_Door1_Open) vs (TG_Door1_Open;ItsDay) should be the same, regardless of which one become true first. Wouldn’t the “AND” requires it to both become true.

So IF i am looking for

WHEN DOOR IS OPEN AND IT IS NIGHT
THEN
TURN ON MY LIGHTS

OR

IF DOOR=OPEN AND ITsNight=TRUE
THEN
TURN ON MY LIGHTS
ELSE
DO NOTHING

In programming, isn't the "AND" condition requires both to be TRUE before execution?
That's correct. The expression will be true only when all the [i]and-ed[/i] terms are true.
(ItsDay ; TG_Door1_Open) vs (TG_Door1_Open;ItsDay) should be the same, regardless of which one become true first. Wouldn't the "AND" requires it to both become true.
The part in brackets, with the terms separated by a semicolon, is a sequence expression. This is evaluated by comparing the time when each of the terms [u]last became true[/u]. This could be two seconds ago or last week. The expression is true when the terms are in time order.

(ItsDay ; TG_Door1_Open) will be true if the last time TG_Door1_Open was true was after ItsDay was last true. It doesn’t matter whether either of the terms are still true - only the time order in which they last became true is relevant.

b[/b] will be true if TG_Door1_Open last became true before ItsDay last became true.

Because a sequence expression can be true even when the terms are currently false, it usually requires to be and-ed with another term to make it useful for current states. ItsNight and (ItsNight; TG_Door1_Open) will become true when TG_Door1_Open becomes true after ItsNight last became true and ItsNight is still true. (ItsNight; TG_Door1_Open) and ItsNight will do exactly the same. The order of the terms within the sequence part of the expression is critical. The order of the and-ed terms doesn’t matter.

The simple condition expression ItsNight and TG_Door1_Open will fire (become true) whenever TG_Door1_Open becomes true (changes from false to true) while ItsNight is true. It will also fire whenever ItsNight becomes true while TG_Door1_Open is true. The order of the terms makes no difference. The order of the events makes no difference.

I’m sorry if some of the above is a bit wordy but I’m stressing the becomes part because it’s important. PLxx actions fire when the specified condition changes from false to true. Sequence expressions are evaluated on the basis of when the terms last changed from false to true. It’s easy to forget that subtlety.

So, to answer your simple question after all this rambling: ::slight_smile:

WHEN DOOR IS OPEN AND IT IS NIGHT THEN TURN ON MY LIGHTS

can be achieved by the condition ItsNight and TG_Door1_Open as long as you don’t care in what order the two events occurred. If you only want the condition to fire if the door is opened after it became dark, use ItsNight and (ItsNight; TG_Door1_Open)

Does that help?

Yup! Thanks again!