The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Intelligent Light Switching - Thoughts?


  • To: "HomeVision Group" <homevision-users@xxxxxxx>,<ukha_d@xxxxxxx>
  • Subject: RE: Intelligent Light Switching - Thoughts?
  • From: "Ian B" <Ian@xxxxxxx>
  • Date: Tue, 1 Jan 2002 23:12:50 -0000
  • Delivered-to: mailing list ukha_d@xxxxxxx
  • Mailing-list: list ukha_d@xxxxxxx; contact ukha_d-owner@xxxxxxx
  • Reply-to: ukha_d@xxxxxxx

Here are the snippets of code from my schedule where I do as you were
asking
for one room, the kitchen. I would advise you to put the bulk of the code
in
a macro as it can then be called from multiple places.

I have an adjustable light sensor connected to an input port.
There is a beam break into the kitchen and X-10 PIR for movement detection.
The beam break is because the PIR was too slow.
I can also override the default 4 mins to off via other macros. When the
override expires the lights are again controlled by the main movement macro
or forced off.
In the early hours the lights come on at a reduced level.

Enclosed is all the relevant code unless I have forgotten anything. I find
this pretty good and with the overrides my daughter can paint at the table
and not worry about the lights going off.
---------------------------------------------------
INPUT PORT 'HIGH' EVENT # 1 'Kitchen Light Sensor'
Set flag #0 (Kitchen light sensor flag)
Clear flag #1 (Kitchen light status)
---------------------------------------------------
INPUT PORT 'LOW' EVENT # 1 'Kitchen Light Sensor'
Clear flag #0 (Kitchen light sensor flag)
---------------------------------------------------
INPUT PORT 'LOW' EVENT # 2 'Kitchen beam break'
Do macro #10 (Kitchen motion detected) once
---------------------------------------------------
MACRO EVENT # 10 'Kitchen motion detected'
; Kitchen light logic
; Or override is set then bypass everything
If
; Light already on
Flag #1 (Kitchen light status) is set
; Or light sensor = dark
Or  Flag #0 (Kitchen light sensor flag) is set
Then
If
; Early hours
Time is before 6:05 AM
And Time is after 12:00 AM
Then
If
; Lights off
Flag #1 (Kitchen light status) is cleared
Then
; Set lights on level 4 and set lights on flag
Set flag #1 (Kitchen light status)
X-10: A 15 (Kitchen lights) Force Brighten 4 Times
End If
; Start timer for lights off
Load timer #0 (Kitchen light timer) with 0:03:00.00 and start
Else
If
; Lights off and day/evening
Flag #1 (Kitchen light status) is cleared
; Or light sensor = dark i.e lights turned off manually
Or  Flag #0 (Kitchen light sensor flag) is set
Then
; Set lights on full and set lights on flag
X-10: A 15 (Kitchen lights) Force Brighten 23 Times
Set flag #1 (Kitchen light status)
End If
; Start timer for lights off
Load timer #0 (Kitchen light timer) with 0:04:00.00 and start
End If
End If
---------------------------------------------------
TIMER EVENT # 0 'Kitchen light timer'
; Turn off kitchen lights and clear flag
If
Flag #5 (Kitchen lights override) is cleared
Then
X-10: A 15 (Kitchen lights) Force Off
Clear flag #1 (Kitchen light status)
End If
---------------------------------------------------
X-10 SIGNAL 'ON' EVENT # A 10 'Kitchen motion sensor'
Do macro #10 (Kitchen motion detected) once
---------------------------------------------------
MACRO EVENT # 8 'Kitchen light on 1 hour'
Set flag #5 (Kitchen lights override)
X-10: A 15 (Kitchen lights) Force On
Load timer #2 (Kitchen light override) with 1:00:00.00 and start
---------------------------------------------------
TIMER EVENT # 2 'Kitchen light override'
Clear flag #5 (Kitchen lights override)
If
Flag #1 (Kitchen light status) is cleared
Then
X-10: A 15 (Kitchen lights) Force Off
End If
---------------------------------------------------




Home | Main Index | Thread Index

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.