| ECS-L Home Automation and Security Archives |
| Subject: From: Date: | Assign house code/unit to item? Jay Heyl Thu, 09 Sep 1999 00:05:20 -0700 |
I've made several attempts at this and still haven't figure out how to accomplish what I want. I'm trying to write a generalized fade-to-black function that will fade a specified light to black over a period of X seconds. I want the light and the number of seconds to be like parameters to the function. To accomplish this I have two events: Fade Start and Fade. Fade Start is set up as a "called" event. It does some initial calculations and starts a timer to bring the Fade event into action. There are several items defined for use by these events: P-Fade Unit, P-Fade Seconds, and P-Fade Interval. The idea is that the originating event (activated by a button push right now) sets up P-Fade Unit and P-Fade Seconds to be the light to be faded and the time period over which it should fade to black. Fade Start calculates the P-Fade Interval over which individual fade steps will occur. Most of this works fine, but I can't figure out how to get the light house code/unit assigned to P-Fade Unit and passed to the fade events. I've tried defining P-Fade Unit as a "light" item and as a "state holder" item, but in both cases P-Fade Unit seems to just take on the current state of the designated light. Trying to dim it subtracts from the brightness level of P-Fade Unit, but the actual light fixture doesn't change at all. Is what I'm trying to do even possible? What kind of item should P-Fade Unit be to accomplish this? Here are the events in question: PLC Remote C: If PLC Button C Is None Then Event-Exit Set True Else If PLC Button C Is 8/On Then Skylight Light Set 78% Then TV Lamp Set 66% Then Dining Room Light Set Off Then Kitchen Ceiling Set Off Then Living Room Lamps Set Off Then Living Room Wall Set Off Then P-Fade Seconds Set 300 Then P-Fade Unit Set Skylight Light Then Event-Call Set Fade Start Else If PLC Button C Is 16/On Then Event-Call Set Bedtime Start Fade Start: Do Number-A Set P-Fade Seconds Do Number-A Divide 20 Do P-Fade Interval Set Number-A Do Tmr Fade Set P-Fade Seconds Do Msg Fade Disp T1<-T1 Msg Fade Do Msg Fade Disp T1/A<-Nam P-Fade Unit Do Text-A T1<-T1 Msg Fade Start Do Text-A T1/A<-Nam P-Fade Unit Do Text-A Set Display Fade: BEGINIF Tmr Fade Is GT 0 Do Number-A Set Tmr Fade Do Number-A Divide P-Fade Interval Do Number-A Multiply P-Fade Interval If Tmr Fade Is Now Number-A Then P-Fade Unit Subtract 1 Then Msg Fade Disp Set Display ENDIF Oh, the text manipulation in Fade Start isn't working right either, but I'm not concerned about that at the moment. -- Jay