MarkJames Posted June 20, 2015 Posted June 20, 2015 (edited) I've been rewriting some of my code recently and have moved a bunch of routines around. I have a flag called 'Send Email Alert' which I set to either True (1) or False (0). It's currently set to 0 and I've confirmed it. It's an integer variable. I have a program that senses Elk motion and, when an Elk PIR zone is violated, it sends an email to me. The code looks something like this If elk zone gate motion is violated then notify default blah blah blah That program lives inside a folder which *should* only allow the program to run if the flag 'Send Email Alert' is True/1 For the most part it works. But today we had a lot of company - like 80 people over. There were people tripping the motion sensor relentlessly and from time to time the email message would get sent despite the flag being false. Is it possible to overwhelm the condition processing on the folder? mark Edited June 20, 2015 by MarkJames
stusviews Posted June 20, 2015 Posted June 20, 2015 Do you have another program that refers to the one that should not have run? Tip: You can search by right clocking on My Programs, selecting Find/Replace, selecting Programs.
oberkc Posted June 20, 2015 Posted June 20, 2015 I have not experienced, nor heard of, a program in a false folder being run simply because it was being "overwhelmed". I would look for other explanations. Stusviews has one potential explanation. Is it possible that the flag variable somehow changed temporarily?
larryllix Posted June 20, 2015 Posted June 20, 2015 Should this variable not have to be a state variable to trigger the folder state to false?
MarkJames Posted June 20, 2015 Author Posted June 20, 2015 Do you have another program that refers to the one that should not have run? Tip: You can search by right clocking on My Programs, selecting Find/Replace, selecting Programs. Nope - the only way to that program is by the motion sensor going violated and it resides in a folder that requires the variable to be true. I confirmed that it was the program in question by adding the program data to the email sent I have not experienced, nor heard of, a program in a false folder being run simply because it was being "overwhelmed". I would look for other explanations. Stusviews has one potential explanation. Is it possible that the flag variable somehow changed temporarily? There are no program references that assign a value to the variable - the only way to change it is manually Should this variable not have to be a state variable to trigger the folder state to false? I don't think so.... I don't actually 'trigger' the folder state to false - I assign the variable to false manually and that *should* be adequate to stop the programs in that folder from running. I experimented by adding an additional reference to the same flag within the program so that it reads If elk zone gate motion is violated AND flag send email is TRUE then notify etc. etc. That addition holds - and the program doesn't run. I'm not sure what that means other than that the condition itself is valid Imark
larryllix Posted June 20, 2015 Posted June 20, 2015 I doubt that an integer variable would work but I don't use folder logic. The ISY system is not going to continuously evaluate a condition but rather an event has to trigger ISY to evaluate the condition and set the true or false result. I dont know why folder logic work any different than program if logic. I am on mobile right now so I can't easily give you a reference to the wiki or manual.
stusviews Posted June 20, 2015 Posted June 20, 2015 Do you have another program that refers to the one that should not have run? Tip: You can search by right clocking on My Programs, selecting Find/Replace, selecting Programs. Nope - the only way to that program is by the motion sensor going violated and it resides in a folder that requires the variable to be true. I confirmed that it was the program in question by adding the program data to the email sent There's no doubt that the program ran. Did you actually do a search (Find/Replace) for the errant program? Post the program, too. And the folder condition.
MarkJames Posted June 20, 2015 Author Posted June 20, 2015 This is the folder with the condition. The variable is Integer with a value of 0 Alerts - [ID 0013][Parent 0001] Folder Conditions for 'Alerts' If $Alerts_Send_Email is 1 Then Allow the programs in this folder to run. This is the program that resides in the folder above - as simple as code can be Gate to path email - [ID 008D][Parent 008C] If Elk Zone 'Gate to yard' is Violated Then Send Notification to 'Default' content 'Deer - Gate' Else - No Actions - (To add one, press 'Action') And despite this I will receive the email alert when $Alerts_Send_Email is 0. Not always - just when the program condition gets triggered repeatedly Interestingly - if I add the condition to the program itself so that it looks like this Gate to path email - [ID 008D][Parent 008C] If Elk Zone 'Gate to yard' is Violated And $Alerts_Send_Email is 1 Then Send Notification to 'Default' content 'Deer - Gate' Else - No Actions - (To add one, press 'Action') This will work properly and will not trigger. It's as if the program condition is evaluated separately from the folder condition and when overwhelmed the folder condition doesn't get checked. I thought the folder condition would be evaluated first - and that the program conditions wouldn't even be evaluated if the folder conditions were false. This is a minor problem - I have no complaints - it's just curious. mark
larryllix Posted June 20, 2015 Posted June 20, 2015 Change your variable to a state variable and try it. Integer variable changes do not trigger reevaluation.
MarkJames Posted June 20, 2015 Author Posted June 20, 2015 (edited) Change your variable to a state variable and try it. Integer variable changes do not trigger reevaluation. I'll give it a whirl but I'm not sure I follow your reasoning. With that said you may well be right and I misunderstand the folder variable. I use state variables quite a bit - for programs that need to execute at the time the variable value changes state. The folder condition variable doesn't work that way. When the variable changes state nothing runs. It just allows the programs in the folder to run if/when they evaluate true. The wiki makes no reference to a folder condition requiring a state variable. Indeed it makes no sense for that to be required as the folder condition can be a schedule condition - not a variable. Here's the entry Description There are situations where it is desirable to limit when a set of programs is allowed to run. An office for example may want to limit the hours in which certain lights or appliances are allowed to be turned on, and also automatically turn them off at those times. Folder conditions provide a means of doing this without having to modify each individual program. Adding conditions to a folder is identical to adding conditions to a program. Conditions for a folder must first be met for any of the programs in that folder (or its sub-folders) to run. Folders by default have no conditions, and therefore do not limit when the programs within them run. Edited June 20, 2015 by MarkJames
LeeG Posted June 21, 2015 Posted June 21, 2015 State variable is used in a Folder when the only condition. The Folder will turn True (has Green bar) when Folder condition is True. That does not happen with an Integer variable. Folder being True does not force a Program to trigger, only allows the Program condition(s) to trigger Program when they occur.
MarkJames Posted June 21, 2015 Author Posted June 21, 2015 (edited) State variable is used in a Folder when the only condition. The Folder will turn True (has Green bar) when Folder condition is True. That does not happen with an Integer variable. Folder being True does not force a Program to trigger, only allows the Program condition(s) to trigger Program when they occur. Interesting.... So you're saying that ISY treats time conditions and integer variable conditions differently? I ask because I use time conditions on folders all the time with no problem. If what you say is true then ISY must poll the condition differently when it's not an integer. I've experimented and I don't find this to be true. Regardless of whether the variable is integer or state it still results in an immediate change of the folder condition (green to red or back). I created two variable s_send alert and i_send alert - one a state, one an integer - both work the same. I'm going to play with this some more - it'll be more difficult now that I don't have 80 or 90 people milling about my yard causing sensors to go nuts. In the meantime it'd be interesting to get a firm answer - perhaps from Michel - as to the need for a folder condition variable to be a state variable mark Edited June 21, 2015 by MarkJames
larryllix Posted June 21, 2015 Posted June 21, 2015 There is nothing in a program that causes a folder condition to be evaluated. If a folder contained 15 programs which one would cause reevaluation of the folder logic. Only state variables cause evaluation of usage conditions. The folder condition is only evaluated in advance when triggered from a variable change, not when a program runs.
MarkJames Posted June 21, 2015 Author Posted June 21, 2015 (edited) There is nothing in a program that causes a folder condition to be evaluated. If a folder contained 15 programs which one would cause reevaluation of the folder logic. That's not what I'm saying. What I'm saying is that it acts as if the program condition is being evaluated despite the folder condition being false. I don't know exactly what's going on but what it looks like is that the program condition gets evaluated and runs because it's true - motion *has* been detected. The thing is that it shouldn't get as far as evaluating the program condition because the folder condition is false. As posted above - I tried both integer and state variables and find that both result in an instant change in folder status. So I don't believe that the type of variable is the issue. What would be interesting to know is if ISY continually evaluates program conditions - even in folders that are false - and then when the program is true decides whether to run them on the basis of whether the folder is true. I would suspect it would be the contrary - that so long as the folder is false it wouldn't look at the program at all. Edited June 21, 2015 by MarkJames
LeeG Posted June 21, 2015 Posted June 21, 2015 (edited) It should be a State variable. integer variables do not trigger Programs or Folders. I would not spend time analyzing what happens when the Folder has an Integer variable as the only condition. When it is a State variable that is False then analyze what happens with an Elk Zone trigger. Edited June 21, 2015 by LeeG
LeeG Posted June 21, 2015 Posted June 21, 2015 (edited) Forgot to put this in my last post. Time range works the same for a Program and a Folder. Edited June 21, 2015 by LeeG
stusviews Posted June 21, 2015 Posted June 21, 2015 A state variable can be a triigger, an integer variable cannot. So, if you run a program, then the program can test if an integer variable has a particular value. But you can't run a folder, so you can't test the value of an integer variable. A state variable doesn't depend on running anything. If the value of the state variable becomes true, then then the program runs itself and/or the programs in a folder are permitted to run.
Recommended Posts