 
  
 With Devices.Ademco.ApexDestiny6100.Partitions.Partition_1
	'Check if the current time is between Sunset and Sunrise
	If times.sysTime > times.sysSunset(times.sysDate) Or _
		times.sysTime < times.sysSunrise(times.sysDate) Then
	
		Select Case .SecurityState
		case 0 '0 - Away
			'Turns off all internal lights
			addTimer 60,"devices.CustomDevices.Insteon_Root.InsteonGroup_2.PowerState=FALSE",1,this.Name
			'Turns on the porch light for 1 minute
			addTimer 60,"Scenes.Porch_Light_60s.Play=TRUE",1,this.Name
		case 1 '1 - Disarmed
			devices.CustomDevices.Insteon_Root.InsteonGroup_2.PowerState=TRUE		
		case 2 '2 - Home
			'Turn off the outside entry light if it is on
			If Home.House.First_Floor.Entry.RelayLight.PowerState=TRUE Then
				Home.House.First_Floor.Entry.RelayLight.PowerState=FALSE
			End IF
		End Select		
			
		Else 
			'Default to lights off
			Scenes.Lights_Off.Play=TRUE
	End If
	
End WithWith Devices.Ademco.ApexDestiny6100.Partitions.Partition_1
	'Check if the current time is between Sunset and Sunrise
	If times.sysTime > times.sysSunset(times.sysDate) Or _
		times.sysTime < times.sysSunrise(times.sysDate) Then
	
		Select Case .SecurityState
		case 0 '0 - Away
			'Turns off all internal lights
			addTimer 60,"Scenes.Lights_Off.Play=TRUE",1,this.Name
			'Turns on the porch light for 1 minute
			addTimer 60,"Scenes.Porch_Light_60s.Play=TRUE",1,this.Name
		case 1 '1 - Disarmed
			Scenes.Lights_On.Play=TRUE			
		case 2 '2 - Home
			'Turn off the outside entry light if it is on
			If Home.House.First_Floor.Entry.RelayLight.PowerState=TRUE Then
				Home.House.First_Floor.Entry.RelayLight.PowerState=FALSE
			End IF
		End Select		
			
		Else 
			'Default to lights off
			Scenes.Lights_Off.Play=TRUE
	End If
	
End With 
 addTimer 60,"devices.CustomDevices.Insteon_Root.InsteonGroup_2.PowerState=FALSE",1,this.Name
addTimer 60,"Scenes.Porch_Light_60s.Play=TRUE",1,this.Name
[/code]

