shannong Posted October 17, 2014 Posted October 17, 2014 (edited) I revamped my programs that set day/night variables that affect various lighting functions. I have an Insteon Motion Sensor which has a luminance sensor. I use one of those combined with sunrise/sunset. The new program I wrote below never evaluates as True to fire. I don't understand how at least the Sunrise+30min doesn't evaluate to True every morning regardless of the status of the luminance node of the MS. Locally my ISY has sunrise posted as 7:30:30 AM and the time was 9:00 AM when I checked this again this morning to find it didn't run. Arrg! If ( From Sunrise - 1 hour To Sunrise + 1 hour (same day) And Status 'Luminance Sensor' is Off ) Or Time is Sunrise + 30 minutes Then Wait 5 minutes $s.Dark = 0 $s.Dark Init To $s.Dark $i.Dark Init To $s.Dark $i.Dark = $s.Dark Else - No Actions - (To add one, press 'Action') Edited October 17, 2014 by shannong
hart2hart Posted October 17, 2014 Posted October 17, 2014 Confirm that the program is enabled. I've saved programs on a few occasions and they were not enabled. Also, is the program in a folder with conditions that have not been met?
shannong Posted October 17, 2014 Author Posted October 17, 2014 The program is enabled. The folder has no conditions. Oddly, the program is now evaluating as True and it wasn't earlier.
Xathros Posted October 17, 2014 Posted October 17, 2014 Keep in mind, a from...to time condition only self triggers at the from and to times. To have it evaluate between those times it needs to be triggered by another trigger, RunIf from another program or manually run from the console. -Xathros
shannong Posted October 17, 2014 Author Posted October 17, 2014 (edited) The luminance node of the MS changing state during that period would provide the trigger. But why wouldn't the Or clause of Sunrise+30min not evaluate True and run at 8am? Edited October 17, 2014 by shannong
larryllix Posted October 17, 2014 Posted October 17, 2014 (edited) The luminance node of the MS changing state during that period would provide the trigger. But why wouldn't the Or clause of Sunrise+30min not evaluate True and run at 8am? Just some observations. You have "sunrise" in both the "to" and "from". Is this is a typo here or just a morning program trigger? If your luminance sensor changes status and runs the "else" section while the 5 minutes are timing the sequence will be cancelled. Why would we need or want the additional 5 min delay? Edited October 17, 2014 by larryllix
larryllix Posted October 17, 2014 Posted October 17, 2014 The luminance node of the MS changing state during that period would provide the trigger. But why wouldn't the Or clause of Sunrise+30min not evaluate True and run at 8am? Maybe??? You have the Insteon MS units. They don't detect "Light" conditions with On status . They detect "Dark" with On status. Take your MS into a darkened closet to test function. The response is about 3-5 minutes IIRC.
shannong Posted October 17, 2014 Author Posted October 17, 2014 Just some observations. You have "sunrise" in both the "to" and "from". Is this is a typo here or just a morning program trigger? It was intentional. My preference is for the luminance sensor to decide it's light enough. However, I wanted to manually trigger it based on sunrise in case the status message was lost, , dead battery, sensor quit working, etc. If your luminance sensor changes status and runs the "else" section while the 5 minutes are timing the sequence will be cancelled. Why would we need or want the additional 5 min delay? There is an Or. So Then should execute with either one evaluating True. If one evaluates True and it starts running and then the other becomes False during that wait the expression should still evaluate True start over rather than go to Else. BTW. The Summary tab showed that the program didn't execute at all so I now it didn't trigger and get derailed during the 5 min wait. The 5 min is meant to act as a de-bouncer. However, I now remember that the MS has a 3.5 min de-bouncer for luminance built in so it's probably not necessary.
shannong Posted October 17, 2014 Author Posted October 17, 2014 Maybe??? You have the Insteon MS units. They don't detect "Light" conditions with On status . They detect "Dark" with On status. Take your MS into a darkened closet to test function. The response is about 3-5 minutes IIRC. Right. So when it's Off there is light. The intention is to detect daylight in the morning. The sensor is changing. Today it changed 5 min outside of the From-To so it couldn't evaluate as True. That's simply a matter of adjusting my light sensitivity on my sensor. For now I'm ignoring the use of the luminance. My real question is why doesn't the Or with Sunrise+30min trigger the program?
shannong Posted October 17, 2014 Author Posted October 17, 2014 You can see in my screenshot based on the green side bar it is now evaluating as True. But why didn't that happen at 800am? (730am sunrise + 30 min) This has happened two days in a row since I first created the program.
larryllix Posted October 17, 2014 Posted October 17, 2014 Right. So when it's Off there is light. The intention is to detect daylight in the morning. The sensor is changing. Today it changed 5 min outside of the From-To so it couldn't evaluate as True. That's simply a matter of adjusting my light sensitivity on my sensor. For now I'm ignoring the use of the luminance. My real question is why doesn't the Or with Sunrise+30min trigger the program? OK I must be misinterpreting your desired function here. Are these times supposed to only flag a small section of time (each morning) when your Dark flag is false? ($s.Dark = 0) Perhaps you can explain the function in more detail as you see and want it.
shannong Posted October 17, 2014 Author Posted October 17, 2014 The variable s.Dark is 0 during daylight hours and 1 when it's dark. When this variable changes it triggers other programs that turns some lights on, others off, etc. This program is to turn s.Dark to zero each morning. I have the time window there as I wouldn't want it to fire in the evening such as when the light in that room is left on which would cause the luminance sensor to turn 'Off' after 3.5 min. Obviously there are a lot of ways to do this.I'm really just looking at this from a programming standpoint rather than functional. I want to understand why this program doesn't evaluate as True using the Or of Sunrise+30min.
larryllix Posted October 17, 2014 Posted October 17, 2014 (edited) I have been misreading your intent on this one but I think I have the function clearer now. I see this (now) program as the second half of a flag (Dark) controller that only turns the flag Off when it is light in the morning. This line "To Sunrise + 1 hour (same day)" evaluates to run the "Else" section at 8:30:30 AM When you check the program status later in the day (9:00AM) the program may have ran the "True" section but the running of the "Else" would supersede all record of it running true. My guess is that you will need to remove the "to" time trigger in your "If" section. It cannot function as you have no "Else" section code. That is all the "to" times do when used as triggers. Edited October 17, 2014 by larryllix
shannong Posted October 17, 2014 Author Posted October 17, 2014 This line "To Sunrise + 1 hour (same day)" evaluates to run the "Else" section at 8:30:30 AM Agreed. But shouldn't the Or Time is Sunrise + 30 minutes evaluate as True at 8am thus setting the variable to zero?
larryllix Posted October 17, 2014 Posted October 17, 2014 (edited) Agreed. But shouldn't the Or Time is Sunrise + 30 minutes evaluate as True at 8am thus setting the variable to zero? Yes. Are you sure it didn't? If you looked after the last run "else" how would you know? IOW: do your lights behave the way you want them to and the observer just doesn't see it? Edit: The variable should not lie and be a good indicator as it should stay where it is put. hmmmm... are we back to the fridge light going out when we close the door problem? Edited October 17, 2014 by larryllix
shannong Posted October 17, 2014 Author Posted October 17, 2014 Yes. Are you sure it didn't? If you looked after the last run "else" how would you know? IOW: do your lights behave the way you want them to and the observer just doesn't see it? I'm only looking at the variable's value which is manually triggered by a time schedule using the Or.
shannong Posted October 17, 2014 Author Posted October 17, 2014 A ha! Now I realize the problem. Based on the second Or clause it evaluates as True at 8am and executes Then. However, I have 5 min wait timer. At 831am the Or second clause now evaluate as False and the first clause is still False too so it now executes Else. Thus it didn't get a chance to change the variable during the one minute the time schedule was True. Duh!
larryllix Posted October 17, 2014 Posted October 17, 2014 I'm only looking at the variable's value which is manually triggered by a time schedule using the Or. Your first post you stated "Locally my ISY has sunrise posted as 7:30:30 AM and the time was 9:00 AM when I checked this again this morning to find it didn't run." The Program Summary only shows the last program state ran and the time it ran. The Program flag in the tree directory only shows the last run "Then" or "Else" section also. If you "to" time trigger triggers the "else" clause that is all you can see at 9:00 AM. I believe your Or condition clause (in question) did run and change the variable to 0. You just can't see the history at 9:00 AM. Do you have an X10 beeper? Or create a lamp blinker program as a test indicator and insert it into your "then" clause so you see the time it executes tomorrow. Then you may catch it in the act. No sleeping in for the wicked.
shannong Posted October 17, 2014 Author Posted October 17, 2014 Mystery solved. Read my post above. The variable definitely didn't change and now I know why.
LeeG Posted October 17, 2014 Posted October 17, 2014 "However, I have 5 min wait timer. At 831am the Or second clause now evaluate as False" There is no False trigger for Or Time is Sunrise + 30 minutes It triggers True at the specified time of Sunrise+30. If it triggered False a program could not use it. The False trigger comes from the Sensor turning On or running out of the first time range.
larryllix Posted October 17, 2014 Posted October 17, 2014 (edited) "However, I have 5 min wait timer. At 831am the Or second clause now evaluate as False" There is no False trigger for Or Time is Sunrise + 30 minutes It triggers True at the specified time of Sunrise+30. If it triggered False a program could not use it. The False trigger comes from the Sensor turning On or running out of the first time range. Agreed. The program should have been true for 30 minutes. The difference between the time range "to" trigger (sunrise plus 1 hour) and the OR clause (sunrise plus 30 min). I think it took LeeG to state this more clearly. Edited October 17, 2014 by larryllix
shannong Posted October 18, 2014 Author Posted October 18, 2014 So at 8am (Sunrise+30min) it evaluates True and executes Then. This would start the Wait 5 min. During the 5 min interval, if the first clause is evaluated again due to the node changing status to On the whole the logic is evaluated again. The first clause is false and since it's now no longer 830am the second clause is also False so Else is executed and the previous running instance of Then is terminated. Is that correct? What if the node changed to On during the first 60 seconds of the Wait when it's still 830am (not 831am). Would the program still evaluate True based on Sunrise+30min? I ask these questions not to split hairs on making this program work. I can think of 5 different ways to write this and deal with the problem. I just want to make sure I understand the nuances of the ISY's state machine.
LeeG Posted October 18, 2014 Posted October 18, 2014 (edited) The specific time trigger is True at 8:30:00 (assuming Sunrise is 8:00:00). It triggers the Program as True and runs the Then which Waits for 5 minutes. It does not trigger the Program True or False at 8:30:01. It never triggers the Program as False. Just as If Control 'xxxxx' is switched On triggers a Program True when On is received from device 'xxxxx', it never triggers a Program as False. Once in a Wait the If can trigger the Program again (not the time trigger if past that time). Should the Sensor change state while in the From/To time range the Program is triggered. False if the new Status is On or True if the new Status is Off. The Program is triggered False at the To time if in the Wait at that time. Edited October 18, 2014 by LeeG
shannong Posted October 18, 2014 Author Posted October 18, 2014 Got it. Thanks for the clarification.
Recommended Posts