MWareman Posted January 12, 2018 Posted January 12, 2018 Well, it looks like sometimes the trigger program runs more than once and when it does the problem occurs. The first time the trigger program runs it calls the action program's 'then'. The second time the trigger program runs it sees the outside light as on and runs the action program's 'else'. I know wireless Insteon devices send their status (Switched on or switched off) multiple times. ISY should ignore the secondary ones as duplicates. I’ve never thought about this, because I’ve never had this requirement on my system. Could those events be causing an issue somehow? Can you post the level 3 log showing where the door opens? Also, what type of device is it?
Goose66 Posted January 12, 2018 Posted January 12, 2018 I like to think of it like this... The device being ‘switched’ triggers the program. A test is then done, ‘Switched On’ or ‘Switched Off’ to decide if ‘Then’ or ‘Else’ should be executed. So, testing only for ‘Switched On’ will cause ‘Then’ to run when the device is switched on, and ‘Else’ to run when the device is switched off. If you want the program to respond ONLY to ‘On’ commands, you need to match the ‘Not Off’ as well. Not wanting to rehash old arguments, but in an ideal event-driven program model, I would specify what events I wanted to trigger my program, and then write the program I wanted run when those events occurred, including if statements to check various conditions and statuses. However, the ISY programming model doesn't work that way. The ISY infers the triggering events from the conditions in the If clause. Unfortunately what trigger events are to be inferred is not always clear, and it can lead to some unwanted results. And, IMO, it makes the Else branch in the ISY programming model nearly useless. This is all discussed in great detail in the Wiki and a number of posts linked in the Wiki. The way to get around these limitations in the event-driven ISY programming model is to do what the OP has done here: create a first program that has your trigger conditions in the If clause, and have it execute a second program that checks the conditions and statuses and performs the tasks. This second program is disabled, so that no trigger conditions are inferred from its If clause. It appears the problem here has nothing to do with his model, just with the fact that the first program (the trigger or event program) is being executed multiple times. This is likely because the ISY is receiving multiple On cmds from the South Gate sensor (whatever that is). Depending on why this is happening, there are a number of options to prevent the subsequent calls to the second program: 1. Put the running status of the second program in the If clause of the first program (I believe this method best comports with the information in the Wiki) 2. Have the second program disable the first program for a time 3. Use a variable to short circuit the first program when the second program is running
apostolakisl Posted January 12, 2018 Posted January 12, 2018 My bad on this. When I downloaded the program as a txt file, it just so happened that the text editor opened it to the end of the doc and the second program exactly perfectly fit on the screen . .. and I didn't realize there was another program above it. Just an FYI, this forum software has the ability to post code directly. It works much better that way . . use the <>. If the second program is triggering twice, then it can only happen because ISY is seeing two events from that gate sensor which is trigger the first program twice. The first part of both the "then" and "else" are atomic . .. they will run to completion and can't be interupted by a re-trigger. Once you hit the repeat, a retrigger can happen. So you will always see the first part happen with every trigger, how much of the stuff after the repeat happens will depend on when the re-trigger occurred. Debugging would include 1) Put a "notify" and have the first program send you an email every time it triggers. 2) Put your ISY in level 3 and watch all the com Alternatively, flank your second program with a disable/enable of the first program. In other words, first line of the "then" and "else" clause disables program 1, and the last line of each re-enables program 1. In this event, the second program would always finish to completion and would never run twice unless a second trigger happened AFTER the second program was completely finished.
walkman9999 Posted January 12, 2018 Author Posted January 12, 2018 Replying to above comments/suggestions: >> Put a "notify" and have the first program send you an email every time it triggers. This is done, I'm watching results. So far the trigger program runs twice about 1/2 the time. >> Put your ISY in level 3 and watch all the com There are so many things happening (due to the complexity of the 'then/else' statements) and I'm afraid it is beyond my current understanding to make total sense of it. >> Also, what type of device is it? 2421 trigger-link v.40. It is set to only notify on an open event. It routinely reached 2 hops, sometimes 3 due to distance, but it seems to "work" 100% of the time. I see how this RF communication may cause multiple triggers to be received. >> Can you post the level 3 log showing where the door opens? I will do this when I get home at end of day All this said, I'm interested in fulfilling the original requirements as simply as possible and thank you both for suggestions on how to do that. Sounds like current suggestions are: use a variable set in the second program to short circuit the trigger event in the first program and then reset the variable after the second program was finished flank your second program with a disable/enable of the first program put the running status of the second program in the If clause of the first program Is there a consensus on the "best" solution, or any other solutions come to mind? Thanks again for input. :MIke
larryllix Posted January 12, 2018 Posted January 12, 2018 <snipped> Is there a consensus on the "best" solution, or any other solutions come to mind? Thanks again for input. :MIke Whoa!!! Everybody will have a different method that feels best to them butt.... I would set a State variable to True = 1 in the first program In the Second program I would monitor the Stat variable for True = 1 and then run whatever depending on your logic and condition. At the end of each section clear the State variable to False = 0 Programs that disable others can get locked out when a power failure or ISY reboot occurs. Looping programs can get stopped on the same problems but also when you edit them. Now you need another bank of programs to monitor the monitor program etc.. Variables automatically set themselve to the Init to value on ISY reboot.
walkman9999 Posted January 12, 2018 Author Posted January 12, 2018 I know how to do most of what is required, I'll give it a shot. Edit: This is what I came-up with, can't test until later. Open to suggestions. ____________________________________________ South Door (Door) - [iD 001C][Parent 0031] If Control 'Main House / Motion-Door Sensors / South Gate Sensor-Opened' is switched On And $Door_Prog_Running is 0 Then Send Notification to 'Text' content '!South Door - Door (if)' Run Program '_South Door (Door)' (If) Else - No Actions - (To add one, press 'Action') __________________________________________ _South Door (Door) - [iD 0033][Parent 0035][Not Enabled] If Status 'Outside / South Lights' is Off And From Sunset - 30 minutes To Sunrise + 30 minutes (next day) Then $Door_Prog_Running Init To 1 Send Notification to 'Text' content '!South Door - Door (then)' Set 'Outside / South Lights' Fast On Set 'Outside / North Lights' Fast On Set 'Outside / West Lights' Fast On Set 'Outside / Front Porch Shed' Fast On Set 'Outside / Back Porch Shed' Fast On Set 'Main House / Keypads / Front Door' Fast On Set 'Main House / Keypads / Back Door' Fast On Repeat 15 times Set 'Main House / Kitchen Accents' 250 (Beep Duration) Set 'Main House / Kitchen Island Cans' 250 (Beep Duration) Set 'Main House / Keypads / Bedroom' 250 (Beep Duration) Repeat 1 times Wait 30 seconds Set 'Outside / South Lights' 25% Set 'Outside / North Lights' 25% Set 'Outside / West Lights' 25% Set 'Outside / Front Porch Shed' 25% Set 'Outside / Back Porch Shed' 25% Set 'Main House / Keypads / Front Door' 25% Set 'Main House / Keypads / Back Door' 25% Wait 60 seconds Set 'Outside / South Lights' Off Set 'Outside / North Lights' Off Set 'Outside / West Lights' Off Set 'Outside / Front Porch Shed' Off Set 'Outside / Back Porch Shed' Off Set 'Main House / Keypads / Front Door' Off Set 'Main House / Keypads / Back Door' Off $Door_Prog_Running Init To 0 Else $Door_Prog_Running Init To 1 Send Notification to 'Text' content '!South Door - Door (else)' Set 'Main House / Keypads / Front Door' Fast On Set 'Main House / Keypads / Back Door' Fast On Repeat 15 times Set 'Main House / Kitchen Accents' 250 (Beep Duration) Set 'Main House / Kitchen Island Cans' 250 (Beep Duration) Set 'Main House / Keypads / Bedroom' 250 (Beep Duration) Repeat 1 times Wait 30 seconds Set 'Main House / Keypads / Front Door' 25% Set 'Main House / Keypads / Back Door' 25% Wait 60 seconds Set 'Main House / Keypads / Front Door' Off Set 'Main House / Keypads / Back Door' Off $Door_Prog_Running Init To 0
apostolakisl Posted January 12, 2018 Posted January 12, 2018 Programs that disable others can get locked out when a power failure or ISY reboot occurs. Looping programs can get stopped on the same problems but also when you edit them. Now you need another bank of programs to monitor the monitor program etc.. Variables automatically set themselve to the Init to value on ISY reboot. That is true. Though we are only talking about a ~100 second window in which a power failure would be able to create a problem. A good question to answer is whether clicking "run at startup" would over ride the program being disabled. If so, you can use that to circumvent any risk of the program being 'trapped" in the disabled state. Either way, I wouldn't be too concerned since it is not a life or death program. On the other hand, the variable solution is more likely to create confusion when, say 3 years from now, when you go to edit it or whatever and your have totally forgotten all of this stuff. Personally, I keep my ISY on a UPS so power outages are never an issue. I recommend that for lots more reasons than just this example. Finally, how quick are the two triggers comming? Are they like 1 or 2 seconds apart? If they are bang/bang, then you only need to disable program 1 for a few seconds, not the entire ~100 seconds of the then/else clause. That may also have other advantages .. .say you actually open that gate on purspose a second time and want it to re-trigger.
apostolakisl Posted January 12, 2018 Posted January 12, 2018 I know how to do most of what is required, I'll give it a shot. Edit: This is what I came-up with, can't test until later. Open to suggestions. ____________________________________________ South Door (Door) - [iD 001C][Parent 0031] If Control 'Main House / Motion-Door Sensors / South Gate Sensor-Opened' is switched On And $Door_Prog_Running is 0 Then Send Notification to 'Text' content '!South Door - Door (if)' Run Program '_South Door (Door)' (If) Else - No Actions - (To add one, press 'Action') __________________________________________ _South Door (Door) - [iD 0033][Parent 0035][Not Enabled] If Status 'Outside / South Lights' is Off And From Sunset - 30 minutes To Sunrise + 30 minutes (next day) Then $Door_Prog_Running Init To 1 Send Notification to 'Text' content '!South Door - Door (then)' Set 'Outside / South Lights' Fast On Set 'Outside / North Lights' Fast On Set 'Outside / West Lights' Fast On Set 'Outside / Front Porch Shed' Fast On Set 'Outside / Back Porch Shed' Fast On Set 'Main House / Keypads / Front Door' Fast On Set 'Main House / Keypads / Back Door' Fast On Repeat 15 times Set 'Main House / Kitchen Accents' 250 (Beep Duration) Set 'Main House / Kitchen Island Cans' 250 (Beep Duration) Set 'Main House / Keypads / Bedroom' 250 (Beep Duration) Repeat 1 times Wait 30 seconds Set 'Outside / South Lights' 25% Set 'Outside / North Lights' 25% Set 'Outside / West Lights' 25% Set 'Outside / Front Porch Shed' 25% Set 'Outside / Back Porch Shed' 25% Set 'Main House / Keypads / Front Door' 25% Set 'Main House / Keypads / Back Door' 25% Wait 60 seconds Set 'Outside / South Lights' Off Set 'Outside / North Lights' Off Set 'Outside / West Lights' Off Set 'Outside / Front Porch Shed' Off Set 'Outside / Back Porch Shed' Off Set 'Main House / Keypads / Front Door' Off Set 'Main House / Keypads / Back Door' Off $Door_Prog_Running Init To 0 Else $Door_Prog_Running Init To 1 Send Notification to 'Text' content '!South Door - Door (else)' Set 'Main House / Keypads / Front Door' Fast On Set 'Main House / Keypads / Back Door' Fast On Repeat 15 times Set 'Main House / Kitchen Accents' 250 (Beep Duration) Set 'Main House / Kitchen Island Cans' 250 (Beep Duration) Set 'Main House / Keypads / Bedroom' 250 (Beep Duration) Repeat 1 times Wait 30 seconds Set 'Main House / Keypads / Front Door' 25% Set 'Main House / Keypads / Back Door' 25% Wait 60 seconds Set 'Main House / Keypads / Front Door' Off Set 'Main House / Keypads / Back Door' Off $Door_Prog_Running Init To 0 You are "init" -ing the variable. You don't want to init it, you want to set it. init is what the variable is set to at boot, not the current value currently in use.
walkman9999 Posted January 12, 2018 Author Posted January 12, 2018 >> when you go to edit it or whatever and your have totally forgotten all of this stuff Happens with almost every project I do, home or work. Can't seem to learn to notate and use comments >> how quick are the two triggers coming? They come (according to notifications) between 10-25 seconds apart. A valid concern, but I don't mind forgoing the two quick door event notifications for the stability. >> I keep my ISY on a UPS UPS for the Win! I am a network guy so lots of UPS in my "technology closet". They are priceless.
walkman9999 Posted January 12, 2018 Author Posted January 12, 2018 >> You are "init" -ing the variable. You don't want to init it, you want to set it. Thank you. I made the change. I am assuming you set the variable with the '=' operator? Please let me know if not correct.
apostolakisl Posted January 12, 2018 Posted January 12, 2018 >> You are "init" -ing the variable. You don't want to init it, you want to set it. Thank you. I made the change. I am assuming you set the variable with the '=' operator? Please let me know if not correct. Yes. =- means new value is old value minus whatever you entered =+ means new value is old value plus . . . =/ means new value is the old value divided by . . .
apostolakisl Posted January 12, 2018 Posted January 12, 2018 >> I keep my ISY on a UPS UPS for the Win! I am a network guy so lots of UPS in my "technology closet". They are priceless. Then using a variable offers no advantage as compared to just disabling the program directly.
apostolakisl Posted January 12, 2018 Posted January 12, 2018 >> how quick are the two triggers coming? They come (according to notifications) between 10-25 seconds apart. A valid concern, but I don't mind forgoing the two quick door event notifications for the stability. That is very odd. Unless it is a delay in ISY sending emails (very possible) I can't imagine any sort of Insteon glitch would have such long delay between two triggers which should have been just one. If you learn to use the log, you'll be able to see the actual times that the program triggered.
walkman9999 Posted January 12, 2018 Author Posted January 12, 2018 I agree with your logic, not clear to me why it runs twice either. For now, I am going to try the plan of using a variable to keep track of whether the program is running or not with the goal being making it work. When I get home I will take a look at logging and figure out when it gets triggered. Thank you (and everyone) for your input and help.
walkman9999 Posted January 12, 2018 Author Posted January 12, 2018 Then using a variable offers no advantage as compared to just disabling the program directly. >> I think it may because the program I'm checking variable status in is not disabled (it is the original trigger program). IS there a better/cleaner/simpler way to use the variable that I'm missing? South Door (Door) - [iD 001C][Parent 0031] If Control 'Main House / Motion-Door Sensors / South Gate Sensor-Opened' is switched On And $Door_Prog_Running is 0 Then Send Notification to 'Text' content '!South Door - Door (if)' Run Program '_South Door (Door)' (If) Else - No Actions - (To add one, press 'Action')
apostolakisl Posted January 12, 2018 Posted January 12, 2018 >> I think it may because the program I'm checking variable status in is not disabled (it is the original trigger program). IS there a better/cleaner/simpler way to use the variable that I'm missing? South Door (Door) - [iD 001C][Parent 0031] If Control 'Main House / Motion-Door Sensors / South Gate Sensor-Opened' is switched On And $Door_Prog_Running is 0 Then Send Notification to 'Text' content '!South Door - Door (if)' Run Program '_South Door (Door)' (If) Else - No Actions - (To add one, press 'Action') This works fine so don't change it. But you could have skipped the variable and started your "then/else clause" (on the big program) with "disable program south door (door)" and ended your "then/else" clause with "enable program south door (door)". You would put it those commands in the same place you put the variable = 1 and variable = 0
walkman9999 Posted January 12, 2018 Author Posted January 12, 2018 But you could have skipped the variable and started your "then/else clause" (on the big program) with "disable program south door (door)" and ended your "then/else" clause with "enable program south door (door)". You would put it those commands in the same place you put the variable = 1 and variable = 0 I see what you're saying. Tonight will be the test of the variable system. Hoping for the best, other wise will collect some logs and post problems. Thank you.
Goose66 Posted January 13, 2018 Posted January 13, 2018 >> I think it may because the program I'm checking variable status in is not disabled (it is the original trigger program). IS there a better/cleaner/simpler way to use the variable that I'm missing? South Door (Door) - [iD 001C][Parent 0031] If Control 'Main House / Motion-Door Sensors / South Gate Sensor-Opened' is switched On And $Door_Prog_Running is 0 Then Send Notification to 'Text' content '!South Door - Door (if)' Run Program '_South Door (Door)' (If) Else - No Actions - (To add one, press 'Action') Is this not working?
walkman9999 Posted January 15, 2018 Author Posted January 15, 2018 Thanks to all. The use of a variable to track the status of the outside light works well.
Goose66 Posted January 15, 2018 Posted January 15, 2018 To be clear, you used the post above, or a different implementation of a variable from that? The reason I ask is I question whether, if you run program B (disabled) from program A (enabled), and then program A is triggered again, will that stop the running program B, even if A does not call B on the second trigger?
walkman9999 Posted January 15, 2018 Author Posted January 15, 2018 I am using the above implementation. I'm not sure I can answer your question though. Program A (the enabled program) is no longer triggered again (unexpectedly) because the 'if' statement is not met (since the variable is set to '1'). Is this what you're asking?
apostolakisl Posted January 15, 2018 Posted January 15, 2018 I am using the above implementation. I'm not sure I can answer your question though. Program A (the enabled program) is no longer triggered again (unexpectedly) because the 'if' statement is not met (since the variable is set to '1'). Is this what you're asking? When you say "program a is not triggering", I know what you mean, but this is incorrect. The program still triggers and in fact executes the "else" clause. It is just that your else clause is blank. With ISY and "event" based programs, you must always keep straight the concept of a trigger. A trigger is anything that causes the "if" clause to evaluate. The outcome of the evaluation should not be confused with the evaluation process itself.
walkman9999 Posted January 15, 2018 Author Posted January 15, 2018 That makes perfect sense, and an important piece to keep in mind. Still wrapping my head around the functionality.
larryllix Posted January 16, 2018 Posted January 16, 2018 That makes perfect sense, and an important piece to keep in mind. Still wrapping my head around the functionality. Just to add a little more to your plate. I define many Integer variables with permanent values for usage like this. I try to keep them origanised up into the 200+ range by defining spares up to 199 for programming use. Some are grouped with other user value ones by function grouping too. set $Variable = $cTRUE If ....$Variable is $cFALSE Then .... set ecobee.stat temperature = $cHVAC.SETPOINT.DAY set $HueLamp.colour = $cHUE.RED set $MiLight.colour = $cML.SEAFOAM In the style of some programming languages I use all CAPS and the "c" prefix to define it is a constant. The "c" prefix also helps identify and sort the massive pulldown list of variables when programming with them.
Goose66 Posted January 16, 2018 Posted January 16, 2018 I am using the above implementation. I'm not sure I can answer your question though. Program A (the enabled program) is no longer triggered again (unexpectedly) because the 'if' statement is not met (since the variable is set to '1'). Is this what you're asking? If it works then that answered my question. Yes Program A is being triggered again but Program B continues to run, i.e. is not preempted. That is the way it is supposed to work, but I was afraid that Program A running Program B may have been interpreted by the ISY as just an extension of the "thread" of Program A.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.