dansmith Posted March 21, 2010 Posted March 21, 2010 Just when I thought that I was understanding the IF condition, I ran into this issue. I have a light over our kitchen table that I want to come on only if it is dark enough outside. I have a program that tells me if the light level is low outside (using weatherbug). I have set the climate module to poll every 900 seconds or 15 minutes so that I not getting a status change every minute. I am using this program as a variable and would like to use it in other programs. What I was expecting to happen was that the Kitchen Table Light would only come on between 5:50PM and 7:10PM if it was Dark Outside. If during that time frame the light level increased above 12, then the light would go out. Any time outside the time frame of 5:50PM to 7:10PM the light level could do what it wanted, but the Kitchen Table light would not come on. However, at 5:37PM this afternoon Program Dark Outside became true due to the light level dropping below 12, and my kitchen light came on very briefly, more of a flicker, and then went out again. In Program summary Last Run time of the Kitchen Table Light was 5:37:46 PM and Last Finish Time was the exactly the same. The Last Run and Last Finish Times for the Dark Outside were both 5:37:46 as well. It was that I did not expect the IF statement of Kitchen Table Light to execute as the schedule should have still been false at 5:37:46PM even though Dark Outside Program was true. Since the schedule was ANDed with Dark Outside the IF should have still been false until at 5:50PM. Just to clarify, at 5:50PM the light did come on and stay on which was expected since the light level was still below 12. The light stayed on until 7:10PM when it went out as expected. Any help would be much appreciated. Program Dark Outside If Module 'Climate' Light < 12 Then - No Actions - (To add one, press 'Action') Else - No Actions - (To add one, press 'Action') Program Kitchen Table Light If From 5:50:00PM To 7:10:00PM (same day) And Program 'Dark Outside' is True Then Send X10 'D3/On (3)' Else Send X10 'D3/Off (11)'
Michel Kohanim Posted March 21, 2010 Posted March 21, 2010 Hi dansmith, The last runtime and finish time are accurate since the light level dropped to below 12 at 5:37 and thus the program was evaluated to FALSE and the Else path was run. So, those do not give us enough information to figure out why you got the flicker. What we need to do is to go to the log (Tools | Log) and check the activity for 5:37 PM and specifically, we need to know if anything else turned on and then off that unit. With kind regards, Michel
dansmith Posted March 21, 2010 Author Posted March 21, 2010 Hi Michel: Here is the log for those events: X10 D3 Sat 2010/03/20 05:37:46 PM Program LogX10 D3 On (3) Sat 2010/03/20 05:37:46 PM Program LogX10 D3 Sat 2010/03/20 05:37:47 PM Program LogX10 D3 Off (11) Sat 2010/03/20 05:37:47 PM Program Log With the program to control the light having the From 5:50 pm to 7:10 pm ANDED with the light level, I would not expect to have the program execute until 5:50pm even if the light level dropped below 12. The only other D3 command in the log was just after 4pm when it shows a D3 Off by Program. Thanks Dan
Michel Kohanim Posted March 22, 2010 Posted March 22, 2010 Hi Dan, This is good! Would you be kind enough to right mouse click My Programs, choose Find/Replace, and look for any other occurrences of D3 On or Off? I just want to make sure there are no other programs that are causing this issue. With kind regards, Michel
dansmith Posted March 23, 2010 Author Posted March 23, 2010 I checked the rest of the programs and nothing else is sending D3 On or Off. Something else that I did notice when going through the log was that a D3 Off was getting sent everytime the weatherbug module was polled and the light level was below 12. I am assuming that each time the status of light level is updated by polling that it causes the If statement to be evaluated. When the If is evaluated the Else statement is then executed. Last night I broke the code into two separate programs so that this wouldn't happen. However, I still cannot figure out the D3 On by program that I am seeing in the log.
Michel Kohanim Posted March 23, 2010 Posted March 23, 2010 Hi dansmith, Good catch! Yes, indeed the program is re-evaluated every time an associated condition is changed. As far as D3 On, is it still happening? With kind regards, Michel
dansmith Posted March 27, 2010 Author Posted March 27, 2010 I have been chasing my tail here with half of my devices quitting working and the Discovering Node errors etc (other post). That seems to have settled down and I have just gotten back to this issue. It has not happened since and I haven't changed anything, so not sure what was going on. Works for now and I am going to leave it at that. Thanks for all your help. Dan
Recommended Posts