| ECS-L Home Automation and Security Archives |
| Subject: From: Date: | Re: [ECS] why won't my lights go off? Bill Walters Sun, 23 Jan 2000 14:01:35 -0600 |
Actually Carl, I had an extra, unnecessary line in the last example. It -could- (and should) have been coded as follows: BEGINIF Front porch motion Is Now On If Daytime Is False Then Front Porch Lights Set On Then Front Porch timer Set 10 Else A/V - Stereo Set Off ENDIF If Front Porch timer Is Now 0 Then Front Porch Lights Set Off Then Event-Exit Set True ---------------------- It's all a matter of "structure"; the more "structured" the more it makes sense to you/others who read your code. Myself, I prefer simple/"brute force" logic with lots of comments! ...and to provide an analogy in the english language----- "Six of one, 1/2 dozen the other" both are the same..... Bill ----- Original Message ----- From: ckeyes <ckeyes@california.com> To: <ecs-list@netbloc.com> Sent: Sunday, January 23, 2000 1:33 PM Subject: Re: [ECS] why won't my lights go off? > Hi, > > I always wondered what the practical differences are > between the two, or more approaches here. > Is it more efficient to use BEGINIFs etc., or is it > just a matter of preference? > > Thanks, > > Carl > > Bill Walters wrote: > > > 2nd possiblity if you really want to use BEGINIF: > > > > BEGINIF Front porch motion Is Now On > > > > If Daytime Is False > > Then Front Porch Lights Set On > > Then Front Porch timer Set 10 > > > > Else If Daytime Is True > > Then A/V - Stereo Set Off > > > > ENDIF > > > > If Front Porch timer Is Now 0 > > Then Front Porch Lights Set Off > > Then Event-Exit Set True > > > > Either way you go........ > > > > Bill > > > > > > > > Remember > > > > > > Why not structure it like this? > > > > > > If front porch motion Is Now On > > > And Daytime Is False > > > Then Front Porch Lights Set On > > > Then Front Porch timer Set 10 > > > > > > Else If front porch motion Is Now On > > > And Daytime Is True > > > Then A/V - Stereo Set Off > > > > > > If Front Porch timer Is Now 0 > > > Then Front Porch Lights Set Off > > > Then Event-Exit Set True > > > > > > > > > You don't say what kind of device is setting your "front porch motion" > > item > > > ON... Just to make sure that there isn't "random" motion that keeps > > kicking > > > this device on (thereby re-setting the Front Porch timer to 10), I'd > > create > > > an item in one of my Group screens to monitor the state of this item..... > > > just while "debugging". > > > > > > Bill Walters > > > > > > > > > > > > ----- Original Message ----- > > > From: A.J. Griglak <aj@griglak.com> > > > To: <ecs-list@netbloc.com> > > > Sent: Saturday, January 22, 2000 5:03 PM > > > Subject: [ECS] why won't my lights go off? > > > > > > > > > > They come on OK, the stereo turns off OK during the day, the timer is > > > > working right, yet when it gets to 0, the lights stay on... anyone? > > > > > > > > -=A.J. > > > > > > > > > > > > BEGINIF Daytime Is False > > > > And front porch motion Is Now On > > > > Then Front Porch Lights Set On > > > > Then Front Porch timer Set 10 > > > > > > > > IF Front Porch timer Is Now 0 > > > > Then Front Porch Lights Set Off > > > > > > > > If Front Porch timer Is 0 > > > > Then Event-Exit Set True > > > > ENDIF > > > > > > > > BEGINIF Daytime Is True > > > > If front porch motion Is Now On > > > > Then A/V - Stereo Set Off > > > > ENDIF > > > > > > > > > > >