sceaton Posted October 4, 2007 Posted October 4, 2007 Do we differentiate between when a KPL button was pressed, and just testing whether the button status is on/off by the order of the 'If' statements? For example, I want to run an "all off" scene when my "Away" button is pressed on. Later, at sunset, I want to turn on another scene IF the away button is ON. Program: Start Away Mode If Control 'KPL@Office - Away' is On //same as below Then Set Scene 'All Off' Off Finally - No Actions - (To add one, press 'Action') Program: Welcome Home If Time is Sunset And Control 'KPL@Office - Away' is On //same as above Then Set Scene 'Welcome Home Evening' On Finally - No Actions - (To add one, press 'Action') Does the ORDER of the if statements determine what triggers the program to fire? So the first program will look for the Away button to be pressed. The second program will wait for Sunset ... at sunset, it will then move to the next condition and check the status of the Away button and continue (or not). I understand that I can't control the status of a KPL button directly; the workaround is to place the button into a scene, and turn that scene on or off. I guess I'm confused as to what exactly the KPL limitation is when making programs, and why we can't use both status and control events. Thanks! Quote
Chris Jahn Posted October 4, 2007 Posted October 4, 2007 The order of the IF statements does not matter. In your second program, you should be testing the 'Status' of the button. I think part of your confusion are the bugs in the current beta drop (not being able to test status of KPL, program true/false not set consistently). These have been fixed for the next drop. In general though, I would use a folder condition instead. Folder 'Away' - Allows programs in the folder to run if 'Keypad A' is pressed On, stops them from running when it is pressed 'Off' Folder Conditions for 'Away' Add conditions to limit when programs in this folder are allowed to run. If Control 'Keypad A' is switched On And Control 'Keypad A' is not switched Off Then Allow the programs in this folder to run. Then just put your 'Welcome Home' program in your 'Away' folder Program 'Welcome Home' If Time is Sunset Then Set Scene 'Welcome Home Evening' On Else - No Actions - (To add one, press 'Action') Quote
sceaton Posted October 4, 2007 Author Posted October 4, 2007 I think part of your confusion are the bugs in the current beta drop (not being able to test status of KPL, program true/false not set consistently). These have been fixed for the next drop. You're right! Thanks for explanation! ... crystal clear! ~shawn Quote
sceaton Posted October 4, 2007 Author Posted October 4, 2007 except ... Why are the two If statements necessary? If it is switched On, doesn't that inherently mean it is NOT switched Off? Folder Conditions for 'Away' Add conditions to limit when programs in this folder are allowed to run. If Control 'Keypad A' is switched On And Control 'Keypad A' is not switched Off Then Allow the programs in this folder to run. Quote
Chris Jahn Posted October 4, 2007 Posted October 4, 2007 Good Question! The big change from 2.4.8 is that there are no longer inferred events. This is the primary reason for replacing 'Finally' with 'Else'. The key here is that the true/false status, and whether a program runs (either the Then or the Else) is dependent on a recognized event. For Controls and X10 messages, events must match exactly, meaning: - For Controls, both the switch and value must match - For X10 Messages, the house code/unit code and command must match. The 'is not' allows you to test for the negative (i.e. false if the button is pressed) Therefore the following program will only change state if 'Keypad A' is switched On, or switched Off. If you press 'Fast On' or 'Brighten' on 'Keypad A', the program will not change because these events are not relevant to the program. If Control 'Keypad A' is switched On And Control 'Keypad A' is not switched Off FYI ... As discussed in another thread, if you explicitly run a program, its status becomes true. If you explicitly Run the else its status becomes false. Not all of these changes are in the code drop you are using now; but they will be in the next code drop. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.