Jump to content

Programming question


bmiller

Recommended Posts

Posted

The difference is basically triggering.

 

The "if" section of the program typically is used as a place to put conditions (I say typically because there are reasons to have it blank).

These conditions will be tested when the program's "if" section is evaluated.

The question is, what causes an evaluation to occur? What is the "trigger".

Clauses placed within the "if" section may or may not be triggers.

For example, an integer variable is never a trigger. It does evaluate when the program is triggered, but it doesn't cause the trigger.

Status and Control are both triggers, but for different reasons.

 

Status: triggers when the referenced device CHANGES status. So if a light is "on" and you push "on", nothing happens. If the light is "off" and it is turned to anything else (like on), by any means (a scene/program/direct action on the switch), it is a trigger.

Control: triggers when the referenced device IS DIRECTLY ACTED UPON (YOU PHYSICALLY PUSHED THE BUTTON ON THE SWITCH) and YOU DID WHAT IS LISTED. In other words, "control switched fast on" is a trigger only when someone walks up to that switch and double clicks the on. Otherwise it is not a trigger.

 

Both status and control will be evaluated whenever the program is triggered by any means.

 

"Control is switched whatever you choose" will only evaluate to true if whatever you choosewas the trigger. Any other trigger will always force a program to be false.

"Control is not switched whatever you choose" will always evaluate to true except when whatever you choose is the trigger. For example, "control is not switched on" will trigger the program to run when the light is switched "on" but will run the else clause. Switching the light "on" is still the trigger, the is/is not just determines the true/false execution.

 

It is a bit confusing. But you need to keep 2 separate concepts in your head. Triggering . . .what causes the program to run, and Evaluating. . . whether it runs true or false after it is triggered.

Posted

So in my case, i have an away folder with status kplc is on. This is evaluated at dusk, and when found to be true, or the kpl c is infact in the on position, the light programs associated with this will turn on/off at the programmed time. There was no change in status at the time of evaluation, but the statement was found to be true. If that had said control kpl c is on, and was in fact true at the time of evaluaion, or dusk in this case, the lights would also work as per the program.

I also have an off folder that states control kpl c off, which i gather is a trigger to turn the lights off after the program has started.It works as stated. if it said status kplc off, then turn lights off, i gather it would not work, as there is no evalution of the statement after the programs have started.

2 words creating so much confusion. Let me know if i'm getting anywhere near the correct interpretation.

Posted

In earlier posts there is an 'off' and 'turn off' Program that use If control. In the last post and I think in an earlier post an 'off' Folder using If Control is mentioned. It is not likely a Folder condition using If Control is working as you expect. A Folder using If Status KPL button On will change from True to False to True based on the state of the KPL button. A Folder using If Control KPL button is switched On will NOT toggle True to False to True as the KPL button changes state. Look at Programs | Summary, watch the Folder status for a Folder using If Status versus a Folder using If Control. They operate very differently because there is no False side of an If Control xxx is switched On or If Control xxx is switched Off.

 

A Folder condition is a gate for the Programs in the Folder. The Folder condition allows the Programs under it to trigger (Folder condition True) or not trigger (Folder condition False). The Folder condition is not meant to trigger Programs under it.

Posted

I have my away folder with the staus kpl c is on, and all the lights turn on at dusk. Is it better to have the "off" program in the same folder as the on, or in it's own folder. When the lights turn on at dusk, and i switch the kpl c off to end the programs and turn the lights off, it doesn't always work. It did at first, but i guess that was coincidence. I have the program "off" in the same folder as the "on", but i had control kpl c is switched off, and i gather it should be status kpl c is off. I'm thinking now it may be better to make a new folder with the status kpl c is off to end the light programs and turn lights off. I'm the type that learns better from examples, so when i see a working setup, as opposed to a non- working setup, and have the errors explained, it becomes much clearer.

I added a couple of captures. A capture is worth a thousand of my explanations. The off program did have control instead of status. I changed that, as it sounds like control was the wrong statement.

Thanks

Brad

post-4005-140474156577_thumb.jpg

post-4005-140474156579_thumb.jpg

Posted

The If Control in the previous version was probably a race condition between the Folder Condition going False and the Program Off actually getting triggered. I think that same race condition exists, perhaps even more exposed now.

 

I would move the Off Program outside of any Folder. I see no use for the Off Program being in a Folder.

Posted
The If Control in the previous version was probably a race condition between the Folder Condition going False and the Program Off actually getting triggered. I think that same race condition exists, perhaps even more exposed now.

 

I would move the Off Program outside of any Folder. I see no use for the Off Program being in a Folder.

 

I tested putting the off program inside of a folder that goes false with the same trigger and it always worked on my system. It is true that putting it inside the folder serves no purpose aside from organization.

 

But there is no need to guess. If the lights fail to shut off, check the program summary page. It will tell you the last time it executed and whether it went true or false. If the program executed and the lights didn't turn off, then you have a comm problem. I would be very curious to see if indeed this is a "race" issue as suggested by LeeG or a failure to communicate. Based on my experience and my general knowledge of ISY's event driven setup, my impression is that it should always run.

 

And as to whether you use "control" or "status" for that program. .. it doesn't really make any difference. Because kpl buttons only have 2 states (on/off) the only difference would be that the program would run false when you turn the button "on" using "status" as well as running true when you turn it "off". Using "control" the program only runs when you turn the button "off".

Posted

I turned kpl c "away" button to the on position. I Then moved the "off" program out of the folder away, and turned on 3 of the four lights i have programmed with kpl and remotelinc buttons. I then physically turned kpl c off and all 3 lights went out. I gather this proves that the "off" program will in fact shutoff the lights as desired. I'll run the vacation at dusk program tonight, and see how it works.

Posted

Tested setup tonight. Didn't work. After program started at dusk, kpl c was turned off, and only 1 light shut off. The test which worked earlier was before dusk, and the activation of the away folder and programs. There is a problem activating the off when the away program has started. I'll keep plugging away at it, but it sure isn't easy.

Posted

Check the Last Run Time column for the Off Program. Does the Last Run Time reflect the expected time?

 

EDIT: if the Last Run Time does not reflect when the KPL button was turned Off then the Program if section and the Folder If section (if Program is in a Folder) are the areas to look at.

 

If the Last Run Time does match when the KPL button was turned Off then the comm is in question. The test earlier in the day verified the link records are correct but does not mean much relative to comm. What appliances/devices are On or Off, what lighting is On or Off, all can affect comm so something that worked in the afternoon comm wise does not mean it will work later in the day with a different pattern of devices and lighting.

 

Insteon Direct device commands are ACKed and have multiple retry attempts. An ISY Scene has a single Insteon message that has no retry capability so comm. must be reliable for a Scene to work

Posted
Tested setup tonight. Didn't work. After program started at dusk, kpl c was turned off, and only 1 light shut off. The test which worked earlier was before dusk, and the activation of the away folder and programs. There is a problem activating the off when the away program has started. I'll keep plugging away at it, but it sure isn't easy.

 

 

If one light shut off, then the program ran and program settings should not be considered the problem (I base this on the fact that you say you put all the lights in one scene and that you have tested that scene as working).

 

This really can only be a comm issue. You tested it during the day, then you went to use it at night. At night, you likely have a different set of lights and devices on in your house which may be creating noise.

 

Try running the "scene test" on ISY for that scene and see what it says. Try figuring out everything that might have been on in the house when it failed and recreate that environment. Also, things like refrigerators and other automatically cycling appliances can be noise makers and it won't always be obvious when they are on/off. . . just to confuse things.

Posted

A couple of days ago i rearranged things a bit. I took the vacation off scene out of the mix. I moved the off program out of the away folder and left it on it's own. The off program now states "if" control kpl c is switched off, then end all 4 light programs and shutoff all 4 lights. I then added a test time to the existing lights on at dusk program so i can run a test without waiting. I redid the test time through the day 3 times, and all the lights went off as expected every time. I removed the test part of the program and ran the program as designed at dusk. All the lights came on, and shutoff as expected for the last 3 days. That's a total of 6 tests and all passed. I'd say that's a wrap. Anything that prevents the normal operation from this point on must be some sort of interference. In a real situation, coming home and shutting the program off, there should be nothing running, except maybe a furnace or air-conditioning unit. Coulld these have an affect on the isy?

Posted
Coulld these have an affect on the isy?

 

These will have NO effect on the ISY. However, they could interfere with insteon communication across the powerlines. While I recall one or two folks report interference from AC or heating, my impression is that this is not typical.

Posted

Here are some screen shots of the way things are. More to be added later, but not to the away folder, just outletlincs for Christmas lights etc. The away folder has slightly different off times under "if" and different random wait times under "else for each light. There may be better or easier ways to do this, but this is working for me, so i'll keep it the way it is. I'm glad it's helping others. The programing language can be interpreted differently than you expect.

post-4005-140474156582_thumb.jpg

post-4005-140474156585_thumb.jpg

post-4005-140474156586_thumb.jpg

  • 3 weeks later...
Guest
This topic is now closed to further replies.

×
×
  • Create New...