birdman Posted December 14, 2011 Posted December 14, 2011 I did a search for "double press" but recv'd an error that it is too common a search term. I am trying to write a program that would, for example, turn off all the lights in the basement, (or turn of all the lights in some other area) by "double pressing" a button on a 6 button keypad (either the Off button, or A, B, C or D) but I cannot find out how to program a "double press". (For example, if I press the Off once, and then wait 3 seconds and if I press the OFf again, I want it to turn off all the lights, not just a smaller sub set.) Any assistance would be appreciated. Thanx
io_guy Posted December 14, 2011 Posted December 14, 2011 Fast On/Off is an immediate double press (very clean solution). Waiting 3s or some amount of time would need a program against it (compare control off press w/ status of already being off).
cul8rv8 Posted December 20, 2011 Posted December 20, 2011 I am trying to do a similar task, and as a newb I'm looking for someone to just confirm that I programmed this correctly. I read the primer in the How-To section (Triggers and conditions and IFs, oh my!), and it mostly made sense, so I think I have it right. I have read it 2 or 3 times so far, need to just keep going through it while I build my programs until it is crystal clear. The idea being doing a double tap on my main SwitchLinc in my bedroom will set that room to 30%, turn off all the other lights in the house, then 30 seconds later turn off the bedroom light. Currently it is set up in my HouseLinc as follows. ___________________ Trigger: Master BR dimmer Off double-tapped Actions: Master BR dimmer set level 30% Pause for 30 seconds Master BR dimmer set level off ___________________ Here is what I have programmed in the ISY nightoff0body If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Run Program 'nightoff1body' (Else Path) Run Program 'nightoff2body' (Else Path) Else - No Actions - (To add one, press 'Action') nightoff1body If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Run Program 'nightoff0body' (Else Path) Run Program 'nightoff2body' (Else Path) Wait 2 seconds Run Program 'nightoff0body' (Then Path) Else - No Actions - (To add one, press 'Action') nightoff1cond If Program 'nightoff0body' is True And Control 'Master Bedroom Main' is switched Off Then Run Program 'nightoff1body' (Then Path) Else - No Actions - (To add one, press 'Action') nightoff2body If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Run Program 'nightoff0body' (Else Path) Run Program 'nightoff1body' (Else Path) Run Program 'nightoff results' (Then Path) Wait 5 seconds Run Program 'nightoff0body' (Then Path) Else - No Actions - (To add one, press 'Action') nightoff2cond If Program 'nightoff1body' is True And Status 'Master Bedroom Main' is Off Then Run Program 'nightoff2body' (Then Path) Else - No Actions - (To add one, press 'Action') nightoff results If Program 'nightoff2body' is True Then Set 'Master Bedroom Main' 30% Set 'Back Porch Light' Off ... Set 'Upstairs Hallway Main' Off Wait 30 seconds Set 'Master Bedroom Main' Off Run Program 'nightoff0body' (Then Path) Else - No Actions - (To add one, press 'Action') I plan to change "nightoff results" to use a scene that contains all of the devices rather than individually turning off each device, but right now I'm using both the ISY and my HouseLinc software, so when I added all devices and kept current links, it created a bunch of scenes that I know can be cleaned up. So I plan to clean those up one at a time as I work through moving over control slowly. I just need to go through 30 or 40 scenes and determine which ones are duplicates, which can be deleted, and renaming them all. Who knew as I kept adding devices over the last 3 or 4 years that I just made links without really thinking about scenes or what I was dupliating.
oberkc Posted December 20, 2011 Posted December 20, 2011 so I think I have it right. So, you have not actually tried the program? Does it do what you want? It seems to me that you have a pretty complicated set of programs to accomplish your stated goal. Specifics will depend on how you define scenes and what switches control what fixtures. Conceptually, could you not do something just like you suggested: if control "Master BR dimmer" is set fast off then set 'Master BR dimmer' to 30% set scene 'rest of the house' off wait 30 seconds set 'Master BR dimmer' off else Given that you are trying to trigger a program from a device that powers the load (master BR dimmer), I would expect this light to initially turn off, then immediately rise to 30%. I am not sure there is any way around this.
cul8rv8 Posted December 20, 2011 Posted December 20, 2011 Well, I just wrote it, but won't be home from work for another 6 or 7 hours. I guess I'm just looking for confirmation that I'm understanding how to program on the ISY. Yes, it turns the light off, then back on. I've had it this way for some time with HouseLinc. The problem is my significant other, she likes to huff and puff and get pissy with me because she can't make it work. She doesn't do the fast off double tap quick enough, then stands there and gets frustrated, then eventually gets pissed off and makes me get up out of bed to do it for her. Also, this was just the closest program setup to what was in the thread I linked above. The thread just never wrote out what was in each program and traced it back, so that was my hope with this one. Basically I haven't written "code" since I was in college, where I determined that I hated coding and never wanted to do it for a living. So I got away from code and went into telecom/networking. When I coded in college, I was never very good at it, either, so I just feel better when someone better than me just says, "yes, that will do what you want it to do." lol
apostolakisl Posted December 20, 2011 Posted December 20, 2011 If your wife's fast twitch muscle fibers are deficient, perhaps consider getting a kpl and setting the various buttons to do the tasks instead of doing the double tap. You also won't have the screwy off then back on thing. You can even label them if she has a grey matter deficit and can't remember things. PS I am just being cute here, I really mean no insult to your wife.
cul8rv8 Posted December 20, 2011 Posted December 20, 2011 No worries, I laughed. Besides, she's not my wife. She's more like a friend with benefits that's usually at my house 3 or 4 nights a week. I just figure significant other sounds nicer.
cul8rv8 Posted December 21, 2011 Posted December 21, 2011 Well, tested it when I got home last night, didn't work. Guess I don't have as good of a grasp on how the ISY programming works as I thought. Back to the drawing board, time to read through stuff again.
oberkc Posted December 21, 2011 Posted December 21, 2011 I will take a shot at this. I have not yet used variables, but this seems like a good place to start. This suggestion is conceptual, so the wording is approximate. You would have to create a variable (integer seems appropriate) in your admin console for this to work. I suggest using the variable as 1 to show the dimmer button has been pressed off within the last two seconds, otherwise set it to 0. I understand that variables don't trigger an evaluation when changed, which makes them useful in this case. I will throw this out for others to review: if control "Master BR dimmer" is set off and ivariable is 1 or control "Master BR dimmer" is set fast off then $variable = 0 set 'Master BR dimmer' to 30% set scene 'rest of the house' off wait 30 seconds set 'Master BR dimmer' off else $variable = 1 wait 2 seconds $variable = 0 I am hoping that this simpler approach will work for you.
cul8rv8 Posted December 21, 2011 Posted December 21, 2011 I think I figured out where I screwed up, and the inherent mistake in my thinking of how to program the ISY. I believed that when the "If" field was empty, this would cause the program to always be TRUE. My mind says if there are no limitations to check, then the conditions are true. But after looking at the program summary screen and trying a couple things, I believe that an empty "If" field does not cause it to be TRUE, but rather running the "Then" field sets it to TRUE, and running the "Else" field sets the program to FALSE. This seems to be the key to the whole thing for me. Now that I grasp this concept, it all makes a helluva lot more sense. My problem on the above setup I described was I had not set nightoff0body to run on startup, and it was thus set to false. Since that was never true, nightoff1cond never met the criteria to be true, and thus never ran. I certainly like your single program using variables better. This setup I built was more than just to turn all the lights off in the house, but to also verify my grasp of the programming. Since I'm at work as I realized my mistake in understanding, I will have to see if she will try it again today. My gut says it's actually going to work now as I have it. Then I'll probably clean it up and change it to something more simple.
oberkc Posted December 21, 2011 Posted December 21, 2011 I believe that an empty "If" field does not cause it to be TRUE, but rather running the "Then" field sets it to TRUE, and running the "Else" field sets the program to FALSE. That sounds correct to me. I vaguely recall times when some of my programs have NO status, suggesting that they need to run at least once. Given this, there would be need to deal with this condition after times of power outages.
Recommended Posts