Since we live in western Washington and the weather dramatically affects the time of day it gets light (regardless of sunrise/sunset times), we don't pay much attention to daytime as ECS is programmed. We instead opted to use light sensors and use them to control an item called 'Daylight'. First we received a couple of Sundowners as part of a promotion from x10.com. To make sure we detect the transition at the correct time, we use both of the Sundowners; one set to maximum sensitivity and the other set to minimum sensitivity. Each Sundowner has its own address (they could actually share one but we wanted to track which sensor triggered at what time). The event to track usage looks like this:
If         PLC-Button G            Is         None               
->This section just allows us to ignore the rest
And        PLC-Command G           Is Not     Dim          
->of the event if there hasn't been anything
And        PLC-Command G           Is Not     Bright       
->received for this house code (G).
Then       Event-Exit              Set        True
Do         Click                   Set        1
;----------------------------------------------------------------
BEGINIF    PLC-Button G            Is         1/On          
->The unit code for the first sensor is 1 and
Then       Text-A                  T1<-T1     Text, G1           
->section is to respond to an on indication from
Then       Text-A                  Set        <Space>               
->the Sundowner.  Note the Sundowner is designed
Then       Temp State 4            Set        Off             
->to operate a light if it becomes dark so the
Then       Text-A                  T1/A<-Stt  Temp State 4    
->indication may seem backwards.  We actually
Then       Text-A                  Set        Log/Speak             
->invert the indication prior to entering it into
Then       Sens, Light, 1          Set        False         
->the log.  In the next section, we will explain
ENDIF                                 
->what is going on.
;----------------------------------------------------------------
BEGINIF    PLC-Button G            Is         1/Off         
->If G1/Off is sent
Then       Text-A                  T1<-T1     Text, G1           
->Copy the text contents of Text, G1 to Text-A
Then       Text-A                  Set        <Space>               
->Append a space to the end of Text-A
Then       Temp State 4            Set        On              
->Change the state of our temp state holder to on
Then       Text-A                  T1/A<-Stt  Temp State 4    
->Copy the state of the state holder to Text-A
Then       Text-A                  Set        Log/Speak             
->Speak and log the contents of Text-A
Then       Sens, Light, 1          Set        True          
->Set the item related to this sensor to True
ENDIF                                 
->Close this BEGINIF loop
;----------------------------------------------------------------
BEGINIF    PLC-Button G            Is         2/On
Then       Text-A                  T1<-T1     Text, G2
Then       Text-A                  Set        <Space>
Then       Temp State 4            Set        Off
Then       Text-A                  T1/A<-Stt  Temp State 4
Then       Text-A                  Set        Log/Speak
Then       Sens, Light, 2          Set        False
ENDIF
;----------------------------------------------------------------
BEGINIF    PLC-Button G            Is         2/Off
Then       Text-A                  T1<-T1     Text, G2
Then       Text-A                  Set        <Space>
Then       Temp State 4            Set        On
Then       Text-A                  T1/A<-Stt  Temp State 4
Then       Text-A                  Set        Log/Speak
Then       Sens, Light, 2          Set        True
ENDIF
The Daylight event is even simpler:
If Sens, Light, 1          Is Now     False
Then       Daylight                Set        False
If         Sens, Light, 2          Is Now     False
Then       Daylight                Set        False
If         Sens, Light, 1          Is Now     True
Then       Daylight                Set        True
If         Sens, Light, 2          Is Now     True
Then       Daylight                Set        True
Now any time we need to know if it is light or dark outside, we check the status
of the item 'Daylight'.  This way we don't have to know what our long/lat
is or even what time zone we are in to guess whether it is daylight or not.
Something worthy of not is all the sensor items should be set to be backed up so if the PC has to be rebooted, it will remember the status of Daylight. The sensors must be placed where only natural light will hit them or you will get all kinds of unreliable, undesirable, and unexpected results.