Jump to content

How do I set program priority when multiple programs exist?


RichTJ99

Recommended Posts

Hi,

 

I have a driveway alarm & it is tied into a triggerlinc. It does the following things:

 

If it is between 6pm & 6am it will turn on the outside lights for 20 minutes then shut them off.

It will send me an email

It will run a network resource (a beep from XBMC through outside speakers).

 

I want the network resource to be first.

I also want to add another item that will cause the basement lights to turn on & off a few times (since I cant hear the beep in the basement).

 

How do I make the network resource first?

 

Driveway1

 

If
       Control 'Main: Trigger Drive-Opened' is switched On
   And From     6:35:00PM
       To       6:35:00AM (next day)

Then
       Run Program 'Driveway Alarm Lights2' (If)

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


 

Driveway Alarm Lights 2

If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

Then
       Set Scene 'Outside' On
       Wait  5 seconds
       Set Scene 'Outside' On
       Wait  25 minutes 
       Set Scene 'Outside' Off
       Wait  5 seconds
       Set Scene 'Outside' Off

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


 

Driveway Beep ---- NETWORK RESOURCE - SHOULD BE FIRST

 

If
       Control 'Main: Trigger Drive-Opened' is switched On

Then
       Resource 'Driveway Alarm Beep'

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


 

Driveway Email

 

If
       Control 'Main: Trigger Drive-Opened' is switched On

Then
       Send Notification to 'Rich Email' content 'Driveway Alarm Alert'

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


Link to comment

I would take a slightly diffent allocation of tasks, triggers, and programs:

 

If
Control 'Main: Trigger Drive-Opened' is switched On
then
Resource 'Driveway Alarm Beep'
Send Notification to 'Rich Email' content 'Driveway Alarm Alert'
Run driveway alarm (if path)
else

 

Modify your driveway alarm code, and disable this program:

 

If
       From     6:35:00PM
       To       6:35:00AM (next day)

Then
       Set Scene 'Outside' On
       Wait  5 seconds
       Set Scene 'Outside' On
       Wait  25 minutes 
       Set Scene 'Outside' Off
       Wait  5 seconds
       Set Scene 'Outside' Off

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

Link to comment

Hrmm, so in this case it would run:

 

The network resource

Then

Send an email

Then run program (driveway alarm)

 

Driveway alarm program

 

checks the time, if its 6-6 then turn on lights

 

 

How can I do a 'flash' of the downstairs 'basement' scene? Is there a way to leave it in the last state, so if the basement lights are off, they flash on/off/on/off / last state (off)? Or if I am in the basement with the lights on then it would do off/on/off/on last state (on)?

 

Thanks,

Rich

Link to comment
How can I do a 'flash' of the downstairs 'basement' scene?

 

There is no "flash" command in insteon, so the only way I know to do this is through a program. I forget the exact program language, but it is something like:

 

repeat three times

turn light on

wait x seconds

turn light off

Link to comment
How can I do a 'flash' of the downstairs 'basement' scene?

 

There is no "flash" command in insteon, so the only way I know to do this is through a program. I forget the exact program language, but it is something like:

 

repeat three times

turn light on

wait x seconds

turn light off

 

Yes, and if you want it to work so that it stays in the same state.

 

If

status basement light is not off

and driveway sensor goes off

Then

turn light off

wait 1 sec

turn light on

 

If

status basement light is off

and driveway sensor goes off

Then

turn light on

wait 1 sec

turn light off

 

Although I tend to think the second program is not necessary since I'm guessing the basement light off means you aren't in the basement.

Link to comment
  • 3 weeks later...

So I am working on this now. I am a little confused on the basement flashing part. I am using a scene called

 

Scene: Basement

 

This turns on a scene that has 4 insteon switches turning on.

 

I dont see scenes listed in the program options. Is there a different way of doing this?

 

Here is what i came up with for the rest thanks to you guys:

 

Main Program

 

If
       Control 'Main: Trigger Drive-Opened' is switched On

Then
       Resource 'Driveway Alarm Beep'
       Send Notification to 'Rich Email' content 'Driveway Alarm Alert'
       Run Program 'Driveway Alarm Lights2' (If)
       Wait  30 seconds
       Run Program 'Driveway Alarm Basement' (If)

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

 

Driveway Alarm Lights2

If
       From     6:30:00PM
       To       6:30:00AM (next day)

Then
       Set Scene 'Outside' On
       Wait  5 seconds
       Set Scene 'Outside' On
       Wait  25 minutes 
       Set Scene 'Outside' Off
       Wait  5 seconds
       Set Scene 'Outside' Off

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


 

Of course the basement program is only doing one device because I cant figure out how to add the scene, but assuming I could:

 

I would like to change it to Scene: basement

 

Driveway Alarm Basement

 

If
       Status  'Main: Basement By Bar' is not Off
   And Control 'Main: Trigger Drive-Opened' is switched On

Then
       Set 'Main: Basement By Bar' On
       Wait  2 seconds
       Set 'Main: Basement By Bar' Off
       Wait  2 seconds
       Set 'Main: Basement By Bar' On
       Wait  2 seconds
       Set 'Main: Basement By Bar' Off
       Wait  2 seconds
       Set 'Main: Basement By Bar' On

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

Link to comment

I guess a scene doesnt show up as a status option but this should be fine because if Basement Control is on or off, so is the rest of the scene.

 

Any ideas why it did not go on & off? Just off?

 

 

If
       Status  'Main: Basement Control' is not Off
   And Control 'Main: Trigger Drive-Opened' is switched On

Then
       Set Scene 'Scene: Basement 3Way' On
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' Off
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' On
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' Off
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' On

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


Link to comment
Is "Main: Basement Control" or "Main: Trigger Drive-Opened" part of the scene "Basement 3Way"? If so, then your program execution causes a re-evaluation of your conditions, halting execution at earliest wait statement.

 

Actually, I think only "Main: Basement Control" would be an issue there as the driveway trigger is watching for Control rather than Status and turning on/off a Scene does not generate a control event.

 

Solution: break the program into 2 programs. Move the then section of the above program to a second program and call it from the then of the first. This way when the If in the first program reevaluates, the second program is unaffected.

 

-Xathros

Link to comment

 

If
       Status  'Main: Basement Control' is not Off
   And Control 'Main: Trigger Drive-Opened' is switched On

Then
       Set Scene 'Scene: Basement 3Way' On
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' Off
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' On
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' Off
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' On

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


 

In the above program, the if contains " Status 'Main: Basement Control' is not Off". The first step in the Then says "Set Scene 'Scene: Basement 3Way' On" . Since this scene contains "Main: Basement Control" and that device now has a Status of On, the If is re-evaluated during the 2 second wait and the program runs false (Else). Nothing after the first On command is executed.

 

Breaking it up as follows:

 

Original Program

If
       Status  'Main: Basement Control' is not Off
   And Control 'Main: Trigger Drive-Opened' is switched On

Then
   Run Program BasementFlashLeaveOn Then Path

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


 

New Program: BasementFlashLeaveOn

If

Then
       Set Scene 'Scene: Basement 3Way' On
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' Off
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' On
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' Off
       Wait  2 seconds
       Set Scene 'Scene: Basement 3Way' On

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

 

Now the first program triggers if the basement is on and someone trips the driveway sensor. It calls the second program that has nothing in the If section. The second program runs the flash and is is not interrupted by the if re-evaluating because it has no If section to re-evaluate and nothing to re-trigger it.

 

Make sense?

 

-Xathros

Link to comment
  • 1 year later...

So a question.  This program is working perfectly but I would like to add another room or two into the mix (master bathroom scene), garage scene.

 

Is there an easy way to make this work with flashing all over in other locations?  How would i add another room - as a separate program?

Link to comment

This gets more complicated. You could use one scene with all desired lights as responders but then determining whether to leave the scene on or off will be a problem with multiple rooms involved. I could write a series of programs to store the state of each area to variables then flash a big scene then even more programs to restore each room afterward. Not sure its worth the effort. With the b5 series firmware this will be much easier. Might be best to wait for that.

 

 

-Xathros

 

Sent from my iPhone using Tapatalk

Link to comment

Is the B5 firmware through UDI or smarthome (the insteon hardware)?

 

In the meantime, can i simply add a device to flash (master bathroom shower)?  

 

Start:

If
        Control 'Leak - Motion - Trigger - Spr / Main: Trigger Drive-Opened' is switched On
 
Then
        Resource 'Driveway Alarm Beep'
        Send Notification to 'Rich Email' content 'Driveway Alarm Alert'
        Run Program 'Driveway Alarm Lights2' (If)
        Wait  10 seconds
        Run Program 'Driveway Alarm Basement' (If)
 
Else
   - No Actions - (To add one, press 'Action')
 

Driveway alarm beep, sends a beep,

the notification sends me an email

 

Driveway alarm lights 2 is this (turns on outside lights temp):

If
        From     5:30:00PM
        To       5:45:00AM (next day)
 
Then
        Set Scene 'Outside' 100%
        Wait  5 seconds
        Set Scene 'Outside' 100%
        Wait  25 minutes 
        Set Scene 'Outside' Off
        Wait  5 seconds
        Set Scene 'Outside' Off
 
Else
   - No Actions - (To add one, press 'Action')
 

Last it runs driveway alarm basement which checks for room occupancy:

If
        Status  'Main House / Basement / Main: Basement Control' is not Off
    And Control 'Leak - Motion - Trigger - Spr / Main: Trigger Drive-Opened' is switched On
 
Then
        Run Program 'Driveway Alarm Basement Flash' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 

If the lights in the room are on (someone is there), it runs the next program:

 

Driveway alarm basement flash:

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Set Scene 'Scene: Basement 3Way' 100%
        Wait  2 seconds
        Set Scene 'Scene: Basement 3Way' Off
        Wait  2 seconds
        Set Scene 'Scene: Basement 3Way' 100%
        Wait  2 seconds
        Set Scene 'Scene: Basement 3Way' Off
        Wait  2 seconds
        Set Scene 'Scene: Basement 3Way' 100%
 
Else
   - No Actions - (To add one, press 'Action')
 

Link to comment

So based on how all this worked, I initially added to the first program,

 

wait 10 seconds

run master bath scene

 

That scene had:

If
        Status  'Main House / Master Bath / Main: MBath Toilet Light' is not Off
     Or Status  'Main House / Master Bath / Main: Mbath Shower' is not Off
     Or Status  'Main House / Master Bath / Main: MBath Keypad' is not Off
    And Control 'Leak - Motion - Trigger - Spr / Main: Trigger Drive-Opened' is switched On
 
Then
        Run Program 'Driveway Alarm Master Bath' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 

So if those lights were not off, the driveway alarm goes off, then goto the driveway alarm master bath:

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Set Scene 'Scene: Mbath Off' Fast On
        Wait  3 seconds
        Set Scene 'Scene: Mbath Off' Off
        Wait  3 seconds
        Set Scene 'Scene: Mbath Off' Fast On
        Wait  3 seconds
        Set Scene 'Scene: Mbath Off' Off
        Wait  3 seconds
        Set Scene 'Scene: Mbath Off' Fast On
 
Else
   - No Actions - (To add one, press 'Action')
 

This resulted in an ISY that kept crashing - I suspect i had some sort of poor logic, a reboot allowed me to get back in.  I could only telnet into the device to reboot it.

 

Now here I am.

Link to comment

While I have not yet fully analyzed your code above, I highly suspect that these are all running at the same time and causing an insteon flood.  This is why I said it should be done with a single large scene with all necessary locations included.  The problem currently is tracing the state of each location and restoring that state after the flash happens.  With V5 we should be able to store the state of specific devices in variables then restore from the variables after the flash all in one program with once big scene.

 

-Xathros

Link to comment

Does scene 'Scene: Mbath Off'  include any of these devices :

 

 'Main House / Master Bath / Main: MBath Toilet Light'

'Main House / Master Bath / Main: Mbath Shower'

'Main House / Master Bath / Main: MBath Keypad'

 

If so, your second program may be retriggering your first, which re-fires your second, which retriggers the first, etc.....  You may have created another infinite loop here.

Link to comment

So the master bath scene turns on & off all the devices listed:

 

'Main House / Master Bath / Main: MBath Toilet Light' is not Off
Or Status 'Main House / Master Bath / Main: Mbath Shower' is not Off
Or Status 'Main House / Master Bath / Main: MBath Keypad' is not Off

 

I thought what I was saying was if the toilet or shower, or mbath keypad is not turned off, and Leak - Motion - Trigger - Spr / Main: Trigger Drive-Opened is turned on, then the master bath should run the flashing, leaving the scene on at 100%.  

 

Why would that cause a loop?  I ask because the basement main control is part of the basement scene but works.   

Link to comment

Hello Rich,

 

My reply has nothing to do with your current ask. However, I would like you to consider lending your voice to this *Wish List* thread in hopes of inspiring Smartlabs to make all their products natively beep and flash: http://forum.insteon.com/forum/main-category/new-insteon-device-wish-list/16482-native-beep-flash

 

This would avoid the massive amounts of Insteon traffic on the power line / RF.

 

NOTE: I know a few people are a fan of making their devices beep and flash. But realize doing this on a massive scale reduces reliability of the Insteon network and also impacts the ISY Series Controller as you noted also.

Link to comment
Guest
This topic is now closed to further replies.

×
×
  • Create New...