🖥️ActiveHome Pro > User-Designed Working Macros

Artificial Sunset and Sunrise

(1/3) > >>

steven r:
Objective dim or brighten a light over a period of 30 minutes.

This uses 2 macros programed with the AHP software.

First you will need to determine what the minimum brightness that is visible for your light at night. This will likely be higher than you think. Let's say for example that your light is no longer visible at 10%. It could easily be higher but this is a good figure for this example. This will mean your dusk range will need to be from 100% down to 10%. Likewise your dawn range will be from 10% to 100%. That means for this example you have a range of 90 to divide by 30 min or 15 every 5 min. So this is how I would do it...

Dusk   P11 On   
(C9) Steven Lamp   
Brighten then dim to 98%                       ;Absolute setting of 98% brightness
Delay for 05:00
(C9) Steven Lamp   Dim by 15%             ;relative dim by 15%
Delay for 05:00
(C9) Steven Lamp   Dim by 15%
Delay for 05:00
(C9) Steven Lamp   Dim by 15%
Delay for 05:00
(C9) Steven Lamp   Dim by 15%
Delay for 05:00
(C9) Steven Lamp   Dim by 15%
Delay for 05:00
(C9) Steven Lamp   Dim by 15%
(C9) Steven Lamp   OFF                        ;If you are not using a soft start module, omit this step
                                                           ;and say a prayer that you don't have a power interruption

Dawn   P12 On   
(C9) Steven Lamp   On                         ;Omit if not using a soft start module
(C9) Steven Lamp   Brighten by 15%      ;relative brighten by 15%
Delay for 05:00
(C9) Steven Lamp   Brighten by 15%
Delay for 05:00
(C9) Steven Lamp   Brighten by 15%
Delay for 05:00
(C9) Steven Lamp   Brighten by 15%
Delay for 05:00
(C9) Steven Lamp   Brighten by 15%
Delay for 05:00
(C9) Steven Lamp   Brighten by 15%
Delay for 05:00
(C9) Steven Lamp   Brighten by 15%

Keep in mind that the percent "dimming" or "brightening" is an incremental amount of full brightness and not based on the current light level. i.e. Unlike your elementary math problem where a 10% loss of money from a starting point of $100 would leave you with $90 followed by another 10% loss of money leaving you with $81, a 10% dim from 100% is 90% followed another dim of 10% is 80%.
( This piece of trivia presented for all the math teachers out there.  ;) )

If the above light change is too abrupt, use increments in smaller amounts with a shorter delay between the increments.
e.g. A 3% change every minute. I don't think a change this small would be noticeable at least not for most lighting situations for most people. That said, the perceptional change may not be linear. i.e. A 3% increase from a level of 10% light may be more noticeable than from 95% to 98%.

For any other arrangements, I'll leave the math to you.  ;)


Now simply program an on time for each macro and there you have it.

Teaser: A smaller looping macro could be made to handle dusk and dawn but the above is easier to understand. The looping macro would need an exit built in with flags or time. A timed window approach would be the easiest but would only work for a regular wakeup time. One using flags would be a lot trickier and might involve the using so many else macros that the above would be more practical.

steven r:
Timed Window Loop Approach

This assumes that the softstart module was predimmed the night before and turned off.
This example also assumes the start of your artificial dawn to be at 6:00 AM and uses a similar brightness range to before.
Uses one macro and a dummy module for triggering the loop.

Macro P14 ON - Triggers On P14 on between 5:55 AM and 6:40 AM
(C9) Steven Lamp   On                           
(C9) Steven Lamp   Brighten by 3%      ;relative brighten by 3%     
delay 1 minute
P14 ON                                              ;Triggers dummy module set as P14 which in turn loops the macro.

Nothing will happen if an attempt to trigger the macro is made outside the time window and all brightening will stop at 6:40 AM regardless of the light state.

You would set the macro time to come on at 6:00 AM in this case.

One advantage / disadvantage to this is the built-in 1 minute sleep switch. Should you manually turn off the light at any time while the macro is running, the light will come back on at the previous brightness and continue to brighten within a minute.

steven r:
Called Loop Approach
( In the continuing saga of ways to wakeup gently to light.  :) )

This assumes that the softstart module was predimmed the night before and turned off.
Uses 2 macros and a dummy module for triggering the loop.

Macro P13 ON                                   ;This macro starts and stops the loop.
Flag 9 On                                           ;Sets the flag needed for the loop to run
P14 On
delay 40 minutes
Flag 9 Off                                           ;Clears the flag to stop the loop

Macro P14 ON - Triggers on P14 On and flag 9 set
(C9) Steven Lamp   On                           
(C9) Steven Lamp   Brighten by 3%      ;relative brighten by 3%     
delay 1 minute
P14 ON                                              ;Triggers dummy module set as P14 which in turn loops the macro.

In this case, the light will continue to brighten by 3% every minute till flag 9 is cleared.

Set your wakeup time(s) as one or more of the timers for macro P13.

A third optional macro could be used as an escape macro. It would be set as the same HC/UC as the light you were controlling.

*Macro C9 OFF - Triggers on C9 Off and flag 9 set
Clear flag 9                                          ;Manually sending an X10 signal to turn off the light would also stop the loop
delay 70 sec
C9 Off                                                 ;Makes sure light is left off

*I'm doing more testing but there appears to be a bug, possibly in AHP, causing this macro to execute and clear the flag. In my test, my flag clears when this macro is present. I haven't found anywhere an off signal is being sent. When I renamed the macro as A4 to test, the flag isn't cleared.

bilyth:
edited:

ok, i'm getting it partially (the called loop method)...

it appears as though the macro is looping- ie when i test it p14 triggers c9 on & after the delay it appears to trigger p14 again (the macro icon flashes)..but it doesn't carry out a further % brighten.

not sure why...

as with your p14 macro, do you have c9 on first (to a set low %) & then C9 brighten 3% (two separate steps)? i was wondering whether or not it was looping but bringing it back down to the original starting level (so instead than continually brightening by 3%..it would go back to the orginal & bump it up 3%)- thus no visual difference.

i tried removing the c9 on first step & leaving my light on & executing the brighten 3% only...it still seems to only bring it up once by 3%...so maybe it's not looping at all; i don't know.

i might be missing something. any input?

steven r:
No the the flag and UC numbers do not need to be the same. It was just a coincidence that the I was controlling a module numbered 9 and the next flag I had available was 9 also.

I'd suggest that you try it again but do not make the optional 3rd macro as I'm still debating as to why it's not working the way I expected. I'm leaning to it being an AHP bug as I can't find anything wrong with my logic.

If you continue to have problems, try creating an entire new AHP file (save your current one first), program it exactly as I have, and temporally change the UC of your module to test.

AHP can execute multiple macros at the same time but I'm not sure as to how it handles priorities in extreme cases.

Again this did work in my test with a soft start wall switch when I removed the 3rd optional macro.

Navigation

[0] Message Index

[#] Next page

Go to full version