j0dan Posted September 17, 2011 Posted September 17, 2011 For example: If Status 'Living Room / Lamp A' is not Off Or Status 'Living Room / Lamp C' is not Off Or Status 'Living Room / Corner Lamps' is not Off Or Status 'Living Room / Living Room Light' is not Off Then - No Actions - (To add one, press 'Action') Else - No Actions - (To add one, press 'Action') This program fires if Lamp A is already on, and Lamp C is turned on or off. I have a few programs that do things like update the LED brightness on switches based on other lights or the brightness in the room. It's causing a lot of extra traffic and possibly contributing to a more serious bug with the ISY overwriting it's internal link tables. So I'm trying to minimize the amount of times these programs fire. How can I optimize these programs?
oberkc Posted September 17, 2011 Posted September 17, 2011 I don't see where this program would cause ANY insteon traffic signals on the powerline. There is no "then" or "else" statements. I don't believe a program can overwrite link tables.
apostolakisl Posted September 18, 2011 Posted September 18, 2011 oberkc is right to say that programs won't change link tables, so I don't get that part. I can only assume you are using the "if" section here as an example for a group of programs since the above program doesn't do anything except set a true/false status of itself (as mentioned by oberck, no traffic). In short, if you don't want a program to trigger every time the status of a switch in the program changes, don't use "status" in your programs. That is the nature of "status", that it triggers programs with any status change. Use "control" if you only want a program to trigger under more specific circumstances. If you want the status of something checked after some trigger event occurs, then use two programs. The first program has the trigger event and then you put a "run if" in the "then" section which runs a second program containing the "status" situation. The second program needs to be disabled so it doesn't run except when the first program calls it.
LeeG Posted September 18, 2011 Posted September 18, 2011 j0dan The If is coded to trigger the Program any time the Status of any of the 4 devices changes. What would you like to eliminate (minimize)? Changing the link record Responder On Level and Ramp Rate obviously affects the link database in the respective device. Changing the LED level does not alter the link database. The LED level along with other device configuration information is contained in a different area of memory. Since the link database corruption is an open problem there is no absolute that LED changes are not affecting the link database but the probability is low. I think what Michel was suggesting was to temporarily stop changing the Scene Responder On Level and Ramp Rate information. Lee
Michel Kohanim Posted September 18, 2011 Posted September 18, 2011 Hello j0dan, LeeG is 100% correct. This said, the internal ISY .REC file stores some of those values (such as LED brightness) in the same .REC file. As such, I still think that the problem is not necessarily LED brightness but how we handle multiple tasks trying to update the same .REC file. With kind regards, Michel
LeeG Posted September 18, 2011 Posted September 18, 2011 Thanks Michel I was looking at it from the device perspective rather than an ISY file question. Would be a good idea to stop the LED updates as well. j0dan please ignore my last comment about LED values being in separate memory area. Lee
apostolakisl Posted September 18, 2011 Posted September 18, 2011 Michel, Would it be possible to get an LED backlight level tutorial? When it first showed up as an option on ISY I attemtped to use it and wound up with a switch that needed factory resetting. Some threads at the time basically said "don't use it for now". Where do we stand with it at present? And to the OP. After re-reading your post and question I think I have an idea. It would seem that you want the led backlight to be brighter or dimmer based on the current light in the room. But every time a light changes you don't want the program re-sending the led level if it hasn't changed. Here is a solution. Write one program for each led backlight level you want that includes the conditions (if stuff) for those levels. Perhaps you want 3 different levels: low, medium, and bright. So you have three programs (if you only want 2 levels you can do it with one program using the "else" clause) But don't have the program's "then" section set the led's. Instead, have it set a state variable to 1,2,or3. Then have a second program (three of them for 3 states, 1 for two states, again by using the "else" clause) that looks for the variable to change value and if it does, then send the led brightness change. A program with a single "if" clause testing the status of a state variable will only trigger when that state variable changes value.
IndyMike Posted September 18, 2011 Posted September 18, 2011 Hello j0dan, If you are issuing the LED command from within the Then statement, the following "Lockout" should work. The program will execute the Then statement when the first lamp is turned on and the Program status will become "True". Turning on subsequent lamps will not execute the Then statement since the program is already "True". For example: If Program XXXX is False And ( Status 'Living Room / Lamp A' is not Off Or Status 'Living Room / Lamp C' is not Off Or Status 'Living Room / Corner Lamps' is not Off Or Status 'Living Room / Living Room Light' is not Off) Then Run LED Bright/Dim Program Else - No Actions - (To add one, press 'Action')
IndyMike Posted September 18, 2011 Posted September 18, 2011 Michel, I tested the above code in a few "status" programs that I use. Curiously, the program summary shows the Program executing the "Then" statement even though the condition Program state is shown as "true". Watching the event viewer, I can see that the Then clause is not being executed - but the program summary page indicates that it is. Am I setting up a transient condition that is confusing the ISY?
Michel Kohanim Posted September 18, 2011 Posted September 18, 2011 Hello IM, Thank so very much for the feedback. I will have to defer this one to the Guru himself! Hi apostolakisl, unfortunately there cannot be a tutorial since all we have is what we got from SmartHome: level for On and level for Off. And, On is a function of Off. It would be ideal if someone with a lot of time on their hands could come up with a permutation of all the on/off value pairs and their impact on the backlight. With kind regards, Michel
Chris Jahn Posted September 18, 2011 Posted September 18, 2011 Michel, I tested the above code in a few "status" programs that I use. Curiously, the program summary shows the Program executing the "Then" statement even though the condition Program state is shown as "true". Watching the event viewer, I can see that the Then clause is not being executed - but the program summary page indicates that it is. Am I setting up a transient condition that is confusing the ISY? Hi IndyMike, I'm assuming program XXXX is the program itself containing the status conditions. The program you have will run every time a status changes, regardless of the program true/false state. Therefore with each status change, it will alternate running the then/else unless the status of all the devices in the if are Off. As for the case where the then clause doesn't run, could you post the exact programs you used to test this. I cannot recreate that problem here.
apostolakisl Posted September 18, 2011 Posted September 18, 2011 I think Chris said this, but if xxxx is the actual program (it is using its own state as a condition), it will not work properly. For example: 1) all lights off 2) program is "false" 3) turn one light on 4) program triggers, turns true 5) then runs All is good 6) second light is turned on 7) program is true evaluates to false 9) else clause runs All is still good 10) third light turns on 11) program is false 12) program evaluates to true 13) then clause runs (OOOPs, not good) You need to use a separate flag program or more easily now that we have variables, use a variable. If Status 'light a' is not Off Or Status 'light b' is not Off Or Status 'light c' is not Off Then $sledtracker = 1 Else $sledtracker = 0 If $sledtracker is 1 Then Set 'switchlinc' 100% (Backlight Level) Else Set 'switchlinc' 25% (Backlight Level) The first program will run every time the status of any of the lights change. The second program will only run when the status of the state variable ledtracker changes. ledtracker only changes when the first program goes from true to false or vice-versa. You may be able to skip the variable and use the true/false status of the first program as the if clause for the second program. I forget if a program status in the if cluase triggers a program on status change or if you need a separat trigger. Only if it is a trigger would that work. If you wanted 3 or more state to your backlights, you would definitely need to use a variable.
IndyMike Posted September 19, 2011 Posted September 19, 2011 J0dan, Chris, Michel, Lou, and anyone else who's time I wasted with my post - My apologies - it was a complete cluster... I was attempting to show a program variable used as a latch - I butchered it. For what it's worth, the following is what I should have posted. Lou's approach using variables is superior. On Program with Latch If ( Status '1st Floor / Bar Cans' > Off Or Status '1st Floor / Bar Lamp' is On Or Status '1st Floor / Dinnette SWL' is On Or Status '1st Floor / Fam Room / Fam Fan' is On Or Status '1st Floor / Fam Room / Family Room LampLinc' > Off Or Status '1st Floor / Fam Room / Family Room Lamplinc' > Off Or Status '1st Floor / Fam Room / Fireplace Spots' > Off Or Status '1st Floor / Foyer' > Off Or Status '1st Floor / Fam Room / Fam KPL 1 - Wall' > Off ) And Program '1st Floor Status On Latch' is False Then Run Program '1st Floor Status On Latch' (Then Path) Set Scene 'SC 1st Floor Status On' On Else - No Actions - (To add one, press 'Action') Status off Program with Latch If ( Status '1st Floor / Bar Cans' is Off And Status '1st Floor / Bar Lamp' is Off And Status '1st Floor / Dinnette SWL' is Off And Status '1st Floor / Fam Room / Fam Fan' is Off And Status '1st Floor / Fam Room / Family Room LampLinc' is Off And Status '1st Floor / Fam Room / Family Room Lamplinc' is Off And Status '1st Floor / Fam Room / Fireplace Spots' is Off And Status '1st Floor / Foyer' is Off And Status '1st Floor / Fam Room / Fam KPL 1 - Wall' is Off ) And Program '1st Floor Status On Latch' is True Then Run Program '1st Floor Status On Latch' (Else Path) Set Scene 'SC 1st Floor Status On' Off Else - No Actions - (To add one, press 'Action') Program Latch If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then - No Actions - (To add one, press 'Action') Else - No Actions - (To add one, press 'Action')
Recommended Posts