Jump to content

Security lights program


TheWabit

Recommended Posts

Posted

I am having an issue with this program. Everything after the first "wait" works sporadically. Foyer goes off about half of the time - front house lights never turn off. Is there a better way to write this?

 

 

 

 

 

Front Security  - [iD 0030][Parent 0001]
If
        From    12:00:00AM
        To      Sunrise (same day)
    And Control 'Front House Security-S' is switched On
 
Then
        Set Scene 'Front House Lights' On
        Set Scene 'Dining Room' On
        Set Scene 'Foyer' On
        Wait  5 minutes
        Set Scene 'Dining Room' Off
        Wait  5 minutes
        Set Scene 'Foyer' Off
        Wait  5 minutes
        Set 'Front House Lights' Off
 
Else
   - No Actions - (To add one, press 'Action')
 
 

 

Posted

 

I am having an issue with this program. Everything after the first "wait" works sporadically. Foyer goes off about half of the time - front house lights never turn off. Is there a better way to write this?

 

 

 

 

 

Front Security  - [iD 0030][Parent 0001]
If

        From    12:00:00AM

        To      Sunrise (same day)

    And Control 'Front House Security-S' is switched On

 

Then

        Set Scene 'Front House Lights' On

        Set Scene 'Dining Room' On

        Set Scene 'Foyer' On

        Wait  5 minutes

        Set Scene 'Dining Room' Off

        Wait  5 minutes

        Set Scene 'Foyer' Off

        Wait  5 minutes

        Set 'Front House Lights' Off

 

Else

   - No Actions - (To add one, press 'Action')

 

 

 

What type of device is "Front House Security-S", and once it's turned on does it stay on?

 

Every time a parameter in the IF statement changes the THEN clause will start over.

Posted

You program, if "Front House Security-S" remains on during the specified times, will run twice, once at 12:00AM and once at Sunrise.

Posted (edited)

It can only run True when the

  • And Control 'Front House Security-S' is switched On

is triggered.

 

Any other time it is Fase and with AND logic, the whole If section logic statement can otherwise never  be True.

Edited by larryllix
Posted (edited)

Anytime you have problems with statements after a "Wait" not running, suspect the issue raised above.

 

The quick and dirty workaround is to move all the actions into a separate program.

Front Security Switch - [ID 0030][Parent 0001]
If
    From 12:00:00AM
    To Sunrise (same day)
    And Control 'Front House Security-S' is switched On

Then
     Run Program 'Front Security' (Then path)
Else
     Run Program 'Front Security' (Else path)
The second program, below, has no conditions, so it will only run when it is called explicitly, in this case, by the first program:

Front Security - [ID 0031][Parent 0001]
If 
     - No Conditions -

Then
    Set Scene 'Front House Lights' On
    Set Scene 'Dining Room' On
    Set Scene 'Foyer' On
    Run Program 'Front Security' (Else path)

Else
    Wait 5 minutes
    Set Scene 'Dining Room' Off
    Wait 5 minutes
    Set Scene 'Foyer' Off
    Wait 5 minutes
    Set 'Front House Lights' Off
Because the second program has no conditions, there is nothing to be reevaluated after the wait, it will always run all the way to end. Edited by KeviNH
Posted

What type of device is "Front House Security-S", and once it's turned on does it stay on?

 

Every time a parameter in the IF statement changes the THEN clause will start over.

 

It is a motion sensor

Posted

I think the 2 programs is the answer. But let me make sure my statement "And Control 'Front House Security-S' is switched On" is correct. This is a MS. Any issues with that? It seems to turn everything on fine - It is just the turning off that is the problem.

Posted (edited)

I think the 2 programs is the answer. But let me make sure my statement "And Control 'Front House Security-S' is switched On" is correct. This is a MS. Any issues with that? It seems to turn everything on fine - It is just the turning off that is the problem.

Yes, you're good.

 

For testing out programs like this one, try making the sensor trigger a noise or notification, for example:

Front Security Switch - [ID 0030][Parent 0001]
If
     Control 'Front House Security-S' is switched On

Then
     Run Program 'Front Security' (If path)
     Set Scene 'Dining Room' Beep 

The "Beep" line will cause any beep-enabled controller (e.g. a lightswitch) in the scene to emit a single chirp.   I like to use a notification which writes a timestamped line to a logfile for this kind of execution tracking.

 

 

The second program, below, is disabled (You'll need to right click on the program and select 'Disable') and has the time range as the conditions, so when 'If' is called by the first program, it will only run if the time condition is true. 

NOTE:   Disable this program!!!
Front Security - [ID 0031][Parent 0001] 
If   
     From 12:00:00AM
     To Sunrise (same day)

Then
    Set Scene 'Front House Lights' On
    Set Scene 'Dining Room' On
    Set Scene 'Foyer' On
    Wait 5 minutes
    Set Scene 'Dining Room' Off
    Wait 5 minutes
    Set Scene 'Foyer' Off
    Wait 5 minutes
    Set 'Front House Lights' Off

Else
    - No Actions -

With the above, anytime the motion sensor is triggered, you will get a beep, but only when it is triggered at night will it turn the lights on, then off.

Edited by KeviNH
Posted

Great idea - Thanks Kevin!

If your device is a motion detector, retriggering your program, a second program will be called and retrigger the same as one program did, cancelling further program lines from executing. A trigger, whether from being called by another program, or an internal If section trigger event line, makes no difference.

 

Two programs will not help that problem.

 

You need to have an MS that doesn't retrriger on motion until the the Waits are all done, or a disable the first program from the second to lock out further action until done, and then re-enable the first program again.

Posted

Let me play with this. But even if it retriggers, wouldnt that just reset the wait? Looking at the logs, this thing triggers earlier in the night (morning) like 1 am. Then I wake up in the morning and they are still on. Except the dining room light.

Posted

Let me play with this. But even if it retriggers, wouldnt that just reset the wait? Looking at the logs, this thing triggers earlier in the night (morning) like 1 am. Then I wake up in the morning and they are still on. Except the dining room light.

Yeah, Last trigger it should complete with any amounts of retriggering.

 

I suspect you have somethng in your scene Offs that isn't working. Test them manually from the admin console.

 

That program time schedule cannot run anything except Else, ANDed with a control/switched line. A control/switched line is never True to other conditions, only when it triggers itself.

Posted

Another thought. Some Insteon MSes send erroneous On signals when their batteries are getting low.

 

It's just possible this may be an issue here.

Posted (edited)

Another thought. Some Insteon MSes send erroneous On signals when their batteries are getting low.

 

It's just possible this may be an issue here.

Another good reason to add a "Beep", notification, or log to the first program, as shown above.

 

Yeah, Last trigger it should complete with any amounts of retriggering.

 

I suspect you have somethng in your scene Offs that isn't working. Test them manually from the admin console.

 

That program time schedule cannot run anything except Else, ANDed with a control/switched line. A control/switched line is never True to other conditions, only when it triggers itself.

 

With the original single program, conditions are re-evaluated (including at the end of each Wait).  Program will stop early if the conditions are false, which is why statements after the wait sometimes do not execute.

 

Go with the two program solution, so "Last trigger it should complete with any amounts of retriggering".

Edited by KeviNH
Posted

I'd create a single scene with all devices that you want on as a responder. That way you lessen the chance of something potentially getting missed when each scene is activated

  • Like 1
Posted

Another option is to set a variable in the first program at the same time the MS is triggered, and then have the second program run when the variable is set.

 

Once the 2nd program completes you can have it set the variable back to 0.

  • Like 1
Guest
This topic is now closed to further replies.

×
×
  • Create New...