| ECS-L Home Automation and Security Archives |
| Subject: From: Date: | Re: [ECS] Stumped on Event Mark Gilmore Sun, 21 Nov 1999 14:55:00 -0500 |
Todd, When an OR condition is processed, ALL AND/OR conditionals above it are considered independent of it (and any following conditionals). This would do what you want: BEGINIF DAY IS SUNDAY OR DAY IS MONDAY OR DAY IS TUESDAY OR DAY IS WEDNEDSAY OR DAY IS THURSDAY IF TIME IS NOW 9:30 PM THEN BEDTIME MSG SET SPEAK->VC THEN KIDS LIGHT SET 40% ENDIF > Todd A. Theisen wrote: > > Hello All, > > I'm using the new 4.2 release and am having a problem that I can't > figure out. I know that the IS NOW operator has undergone some minor > changes and wonder if it is somehow involved here. I created a new > EVENT that tells my kids when to head off to bed (they think it's > fun). The scripting for the EVENT is given below followed by a > description of the problem: > > IF DAY IS SUNDAY > OR DAY IS MONDAY > OR DAY IS TUESDAY > OR DAY IS WEDNEDSAY > OR DAY IS THURSDAY > AND TIME IS NOW 9:30 PM > THEN BEDTIME MSG SET SPEAK->VC > THEN KIDS LIGHT SET 40% > > IF DAY IS FRIDAY > OR DAY IS SATURDAY > AND TIME IS NOW 10:00 PM > THEN BEDTIME MSG SET SPEAK->VC > THEN KIDS LIGHT SET 40% > > IF TIME IS NOW 10:30 PM > THEN KIDS LIGHT SET OFF > > The EVENT first checks to see if it's a school night. I could have > created a new ITEM that defines a school night but the above method > was a quick attempt. Anyway, if it's a school night the kids get sent > to bed at 9:30 via a spoken message and their bedroom light is turned > on to dim (I used 40%). If it's not a school night the kids get sent > to bed at 10:00 PM. Finally the bedroom light gets turned off at > 10:30 regardless of it being a school night or not. > > The event was first saved to ECS.CFG on a SATURDAY at appx 8:00 PM. > As expected the event sent the kids to bed at 10:00 PM. However, at > midnight (changing from SATURDAY to SUNDAY) the event began streaming > the "go to bed" message endlessly until overflowing the speech que. > So I edited the event by placing semicolons in front of each > instruction line to "rem out" the instructions, saved and then > re-started ECS. ESC started normally, then after about ten seconds > began spewing out the "go to bed" message again. My solution was to > delete the EVENT completely which stopped the message stream. Can > anyone (Mark) shed some light on what is happening (likely a problem > with the structure of my code). > > Therefore, I have changed the EVENT as follows and it seems to be > working so far... > > ; Check to see if its a schoolnight...; > > BEGINIF Time Is Now 9:30 PM > If Day Is Sunday > Or Day Is Monday > Or Day Is Tuesday > Or Day Is Wednesday > Or Day Is Thursday > Then Bedtime Msg Set Speak->VC > Then Kids Light Set 60% > ENDIF > > ; If not, check to see if it's not a school night ; > > BEGINIF Time Is Now 10:00 PM > If Day Is Friday > Or Day Is Saturday > Then Bedtime Msg Set Speak->VC > ENDIF > > ; Turn the light off at 10:30 PM ; > > IF TIME IS NOW 10:30 PM > THEN KIDS LIGHT SET OFF > > Thanks any help that can be shed on this mystery. I will know if the > modified EVENT works tonight at the stroke of midnight. > > Todd A. Theisen > -- Mark Gilmore Omnipotence (ECS home automation software) http://www.usit.com/omnip 423-745-0026