| ECS-L Home Automation and Security Archives |
| Subject: From: Date: | Re: [ECS] Re: Yet another 'newbie'! Bill Walters Wed, 13 Jan 1999 13:29:37 -0600 |
Tony -
I take it that the 1st question was about the Sunrise/Sunset stuff and
the second question was about "bumping" the lamp brightness one level
every 40 seconds, beginning at 0630 AM.
I'd do it this way:
1. Define a second-timer item with the value of 40.
2. Entry into the auto brighten routine dependent upon time AND lamp
setting (i.e., not fully 'ON')
3. On 1st pass through event (after conditions for execution have been
met, i.e., 0630 AND lamp not 'ON') set the lamp to 12%, and set the
second-timer item to 40.
4. When timer = 0, IF the lamp is not yet fully ON, add 1 to the value
of LAMP and reset the timer to 40.
Here's the timer definition:
Item:Tmr_AutoBrt Type:Second-Timer Acc:User/User
Initial State:(none) Backup:No
and add the following to your Inside Lights Event (or whatever event
works your lighting by defined times within your particular
configuration.
If Time Is Now 6:30 AM
And Lamp Is Not On
Then Lamp Set 12%
Then Tmr_AutoBrt Set 40
If Tmr_AutoBrt Is Now 0
And Lamp Is Not On
Then Lamp Add 1
Then Tmr_AutoBrt Set 40
Tony - Use of "Is Now" is particularly important. The "Is Now"
condition is "true" ONLY the 1st system pass through your event after
the condition is met. This way, at 6:30 AM, and only the 1st pass
through your configuration at that time, will the IF statement be
considered true. The same holds true for the Tmr_AutoBrt condition test
later in the event. You want it to execute only once when the timer
reaches the value of 0, not every pass through your configuration (CFG)
anytime the Tmr_AutoBrt is 0.
If you used "Is" instead of "Is Now", the condition would be considered
true EVERY pass through your CFG file while the time was 6:30 AM, which
would result in your lamp being repetedly set to 12% from 0630 to 0631.
I don't know how fast your particular system is operating, but mine
makes about 10 passes through, per second. This would generate MANY
X-10 signals to the lamp! (10 times 60 or 600!).
You could also structure the routine with "BEGINIF/ENDIF" statements:
BEGINIF Time Is Now 6:30 AM
If Lamp Is Not On
Then Lamp Set 12%
Then Tmr_AutoBrt Set 40
ENDIF
BEGINIF Tmr_AutoBrt Is Now 0
If Lamp Is Not On
Then Lamp Add 1
Then Tmr_AutoBrt Set 40
ENDIF
I don't know which is "faster" from an execution standpoint - I've never
tried any measurements with timing since my CFG is executing at 10
passes/second.
Also, as Mark points out, whenever you initially set a lamp to a dim
level other than ON, it first turns on to full bright and then dims down
to the appropriate level. This is because most X-10 switches don't
support "preset dim", and ECS knows this. Ecs turns the lamp on, then
issues the appropriate number of "dim" commands to the switch to give
you the commanded light level.
If you don't want that to happen, have whatever events you use to turn
your lights off to use 0% instead of OFF in their values. I don't like
to use that all over the house but do use it in several areas such as
the kitchen. I have one event that senses motion in the kitchen area
after "BEDTIME" has been set (with x-10 keypad by the bed). The bedtime
event sets one lamp in the kitchen to 0% and any motion in the kitchen
area after that will brighten the lamp by 3 (i.e., 36%) to allow whoever
is padding around the kitchen to have enought light to see by without
being blinded by having the light go to full on. After 10 minutes or
so, the event dims the lamp back to 0% and all ready for the next
nighttime refrigerator raider....
Hope this helps. ECS is a wonderful system - hang in there, it's worth
the fairly steep learning curve!
Bill Walters
-----snippet from original message by Tony, answered by Mark--------
>
> Down to my scenarios. I have a lamp that I want to come on at 0630 weekdays.
> No problem there, I can make ECS do this for me. However what I want is for
> the lamp to come on at 10% and increase by 10% every 40 seconds until at
> 100%. Obviously a counter and timer job, but how?
This would be the simplest approach:
If time is 6:30 am
and second is now 0
then light set 12%
else if time is 6:30 am
and second is now 40
then light set 24%
...
...
Note that most X-10 interfaces do not support even 10%
dimming increments, which is why I chose the above %'s.
WARNING: If the light is initially OFF, it will 1st come
%100 ON and then dim-down. If it is initially set to 0%,
you want have this problem.