AuthorTopic: Auto occupancy light turn off Macro (Read 6191 times)

I had a situation where I did not want a motion sensor to turn a light ON, I wanted a human to decide that, but I did want the lights to go off if no one was in the room for a predetermined time. A timer would not work, sinec I would turn off after the pre set time regardless of occupancy, and, for the reason mentioned, a motion sensor would not work either. Here was my solution:

LIGHT OFF WHEN ROOM VACANT MACRO SET

Problem to be solved: When a room light is turned on by an occupant and the occupant vacates the room without turning off the light and is gone for a specified time (e.g. 10 minutes) without any return to the room at all during that time, I want the light to be turned OFF.X-10 Devices involved in room : (1) In wall transmitter on Address X and (2) Motion detector with 5 minute delay from detection trigger until “OFF” command sent. Also, there is a “Phantom Module” I created in AHP to act as a trigger.

MACRO 1 - Flag 1 set macro

Trigger: X ON (X can be any one of several devices, so I actually have this macro for any of them) NOTE: The devices are all turned on by an in wall transmitter or a palmpad, so AHP knows when they are turned on.Actions: Set Flag 1Comments: This is a one time macro in this set, used to set an “ON” flag used by other Macros at the time the light is first turned on.

MACRO 2 - Possible turn off commander

Trigger: Motion sensor sends an “off” commandActions: Set Flag 2 Clear Flag 1 Delay 5 minutes Call Macro 4 (P8 “ON”)Comments: This macro is used to set up flags for a possible shut off under Macro 4. The 5 minute delay is there so that of someone leaves and after the Motion detector delay an “OFF” is sent, that delay plus an additional 5 minutes will prevent unnecessary “OFF” actions should they re-enter during this time period. This way someone “coming and going” will not be required to repetitively turn on the light – in other words this is an “anti annoyance” feature.

MACRO 3 - “ON” flag maintenance

Condition: Flag 2 is SetTrigger: Motion Sensor sends an “ON” commandActions: Clear Flag 2 Set Flag 1Comments: This macro is designed to run when there has been an “off” command from the Motion Sensor, but then there is a subsequent “ON” command received within 5 minutes. This resets the flags preventing a shutoff of the light due to temporarily being out of the room. As there will likely be many “motion detected” - “ON” commands sent from an occupied room, I only run this macro when there has been an intervening “OFF” command which set flag 2, hence the condition of flag 2 set.

MACRO 4 – Light Shutoff

Trigger: P8 ONConditions: Flag 1 is clear and Flag 2 is set.Action: Turn off Light XP8 OFFComment: Pretty straightforward, “turn off the light” command – conditions are used to check for specified flag settings prior to turning off the light. In my case I have multiple lights in an area that I wanted to turn off all together, and so grouped them on a separate housecode, and have the last Macro turn off everything on that housecode, but this would work for individual lighting situations as well.