DevonSprings Posted September 10, 2010 Posted September 10, 2010 Hi All, In my house of dozens of Insteon dimmers I want to be able to turn each room to night time, then if the "Night Time Button" is pressed after 1 second but within 5 seconds I want to be able to set all the rooms into "Night Time Mode" In P-Code something like this.. if KPL-B is on wait 1 if in next five seconds KPL-B is on Set Insteon Scene NightTimeKitchen On Set Insteon Scene NightTimeBedroom On end end but of course my problem is translating that into something that works reliably in the ISY. Thoughts?
Goose66 Posted September 10, 2010 Posted September 10, 2010 Well, you should be able to do this: If Control 'KPL-B' is switched On And Program 'NightimeWaitFlag' is False Then Run Program 'NightimeWaitFlag' (Then Path) Wait 5 seconds Run Program 'NightimeWaitFlag' (Else Path) Else Set Scene 'NightTimeKitchen' On Set Scene 'NightTimeBedroom' On Run Program 'NightimeWaitFlag' (Else Path) But unfortunately, you can differentiate between conditions, such as the "Control 'KPL-B' is switched On", that you want to trigger the program and conditions, such as "'Program 'NightimeWaitFlag' is False", that you just want to check. This is why you will rarely use the Else branch of a program. So, given this limitation in the ISY, you have to write two programs (three, actually, couting the status program 'NightimeWaitFlag' which has no code or conditions. The first program is: If Control 'KPL-B' is switched On And Program 'NightimeWaitFlag' is False Then Run Program 'NightimeWaitFlag' (Then Path) Wait 5 seconds Run Program 'NightimeWaitFlag' (Else Path) Else - No actions - and the second program is: If Control 'KPL-B' is switched On And Program 'NightimeWaitFlag' is True Then Set Scene 'NightTimeKitchen' On Set Scene 'NightTimeBedroom' On Run Program 'NightimeWaitFlag' (Else Path) Else - No actions - EDIT: Never mind. That won't work, because the minute you set the NightimeWaitFlag program to true (run the Then branch), the first program will re-enter and cancel the Wait. Dammit, the ISY programming model is so frustrating! What should be simple is overly complex, all for the want of a simple flag to indicate trigger conditions versus plain status conditions! But I've been banging this drum for almost a year now, and it is falling on deaf ears, I am afraid.
TJF1960 Posted September 10, 2010 Posted September 10, 2010 Hi All, In my house of dozens of Insteon dimmers I want to be able to turn each room to night time, then if the "Night Time Button" is pressed after 1 second but within 5 seconds I want to be able to set all the rooms into "Night Time Mode" In P-Code something like this.. if KPL-B is on wait 1 if in next five seconds KPL-B is on Set Insteon Scene NightTimeKitchen On Set Insteon Scene NightTimeBedroom On end end but of course my problem is translating that into something that works reliably in the ISY. Thoughts? How about using FastOn for KPL-B to trigger the NightTimeBedroom/Kitchen Scenes? Tim
Sub-Routine Posted September 10, 2010 Posted September 10, 2010 It would take a bit more programming to add a Wait but I have an Off-Off program we use. If Control 'Basement / Main / Stairs' is switched Off And Status 'Basement / Main / Stairs' is Off Then Set Scene '~Basement Stairs Low' On Else - No Actions - (To add one, press 'Action') Rand
oberkc Posted September 10, 2010 Posted September 10, 2010 What should be simple is overly complex, all for the want of a simple flag to indicate trigger conditions versus plain status conditions! I will let you judge whether this is overly complex. Conceptually, it sounds as if devonsprings wishes to have a window of time from 1 to 5 seconds after pressing a keypad button. Within that window, if another button "nightimemode" is pressed, the whole house goes into nightime scene. For the time window, I would use a folder. I would create a flag program to use as the folder condition. For the wholehouse lighting, I would create a nightime scene. Nightime folder condition: if program "flag" is true then run the programs in this folder Flag program: if then else Opens the folder time window (outside of folder): if control "KPL-B" is switched on then wait 1 second set program "flag" as true wait 4 seconds set program "flag" as false else Look see if nightimebutton is pressed (put IN folder): If Status KPL-B is on and control nightimebutton is set on then set scene "nightime scene" else Hopefully, this is clear and can be tailored to fit existing device and scene names.
Goose66 Posted September 10, 2010 Posted September 10, 2010 I will let you judge whether this is overly complex. I think everyone can agree that your solution (three programs and folder conditions) is more complex than the first example provided that could be implemented if one could specify the trigger conditions. If Control 'KPL-B' is switched On (trigger) And Program 'NightimeWaitFlag' is False Then Wait 1 second Run Program 'NightimeWaitFlag' (Then Path) Wait 5 seconds Run Program 'NightimeWaitFlag' (Else Path) Else Set Scene 'NightTimeKitchen' On Set Scene 'NightTimeBedroom' On Run Program 'NightimeWaitFlag' (Else Path)
oberkc Posted September 10, 2010 Posted September 10, 2010 I think everyone can agree that your solution (three programs and folder conditions) is more complex than the first example provided that could be implemented if one could specify the trigger conditions. Except, I fear, that the first example may fail for the same reasons as did yours...that when the program first executes the "then" path, forces another evaluation of the conditions at the 1 second point. When this happens, the 5-second timer stops, and the condition evaluates as false.
Goose66 Posted September 11, 2010 Posted September 11, 2010 Except, I fear, that the first example may fail for the same reasons as did yours...that when the program first executes the "then" path, forces another evaluation of the conditions at the 1 second point. When this happens, the 5-second timer stops, and the condition evaluates as false. Well, that's exactly my point. If we could specify trigger conditions in the ISY, i.e. the program should run when KPL-B is switched on but NOT when the status of NightimeWaitFlag changes (as I described above), then that problem wouldn't exist and the single program with the ELSE branch could accomplish what was needed. I think we would find that adding this ability to the ISY would dramatically cut down on the number of programs required as well as make programming much simpler and easier to understand.
oberkc Posted September 11, 2010 Posted September 11, 2010 Well, that's exactly my point. Yes. I am not necessarily disagreeing. I just wanted to offer a potential programming solution given the way things currently stand.
DevonSprings Posted September 11, 2010 Author Posted September 11, 2010 Thanks guys for the suggestions. I am going to try a solution (well tonight) to hard to program lights during the day. Tim, I tried the double press on, but I have all LED lights. The double press the lights are "linked" and they come on full then go off. I suppose I could take the controller out of the scene and then have the ISY run it all. But since this double on function is only going to exist in 4 places (the adult places) then it might be worth it. But the ISY is not as "Instant" as Insteon. I really appreciate all the help and I will post the final solution if I get it. I am going to try the simpler solution first rather than a programmable folder. Thats a bit above me. Devon
LeeG Posted September 11, 2010 Posted September 11, 2010 When the second tap turns the responder Off it means it was not done quick enough to generate a Fast On command. All Insteon devices will generate a Fast On command when the paddle/button is pressed twice quickly. If the Fast On is generated it will defeat what you are trying to accomplish because a Fast On brings all the linked responders to Full Bright at a fast ramp rate. Of course you can override that with programming and bring the responder back to a dim level. You may also want to think about changing the KPL button to non-toggle On mode. In this mode the KPL button always generates an On command rather than Toggling between On and Off. So long as you have linked responders to the KPL button for the immediate response that results in you will have to consider what commands the KPL button press is going to automatically generate and what the linked responders will do with those commands.
Recommended Posts