Occupancy lighting

gregoryx

Active Member
I read a bit on this in another post, but I thought I'd see what the best way to do this is.

I'm using timer-equipped motions now with simple light-on-with-motion-trigger and light-off-on-motion-de-trigger rules. That's what I was doing with ADI as well.

The down-sides to it are two:
- have to ignore triggered zones on arming
- delay settings one a silly dial inside the motion sensor (and I'd prefer they be software setting based)

The only way I Can think of to make it work right (without signal flooding) is to:
- re-set a timer counter on motion
- turn light on only if timer is zero
- turn light off if coaster becomes equal to some value

One problem I found was that I could not compare a counter to a custom field (or anything other than a hard-nailed value). That's a bummer because Elk RP rules have to be edited... and I'd just as soon turn a dial. <_<

Any other issues?

How are others doing this?
 
I actually set some of this up today. I am setting a virtual output in the M1 (could use motions, door sensors, floor pressure switches, etc) with a custom setting timeout. The rule looks something like this:

WHENEVER [motion, etc] is turned ON
THEN TURN Output 170 ON for PresenseTime (Cust Set 3), RESTART TIME IF RUNNING

PresenseTime (Cust Set 3) is a Custom Setting that can be changed at any time. Using this setup, I am using CQC to display presence/motion status as shown in the Floorplan overview in this posting:

CQC With M1

Joe
 
Interesting stuff!

That looks like it'd work! Is it actually working for you as occupancy sensing?

Any other ways?
 
gregoryx said:
Interesting stuff!

That looks like it'd work! Is it actually working for you as occupancy sensing?

Any other ways?
It works fine for now, but I just started thinking about it today. I am using the security system status to also indicate occupancy of the house itself (i.e. disarmed or armed stay=occupied, and armed away=not occupied) again setting a virtual output to indicate house occupancy. I used MisterHouse (before I got the M1) previously and a guy there had written a really good algorithm to not only indicate occupancy, but predict occupancy of rooms that worked really well. I have been thinking about something similar for the M1, but it would take a lot of rules space.

It would help if the WHENEVER part of the rule would support the OR statement. That would make it easier to set outputs. Currently if you have more than one criteria to set occupancy in a room, you have to use one rule for each criteria. It would be nice if you could use something like "WHENEVER motion OR pressure sensor OR (dooropened and adjacentroomwasoccupied) then setoccupancy".

Joe
 
Hmmm... finally went to try this out and I don't see any "RESTART TIME IF RUNNING" as mentioned. :lol:

I found a way to do it with more rules as described in an Elk newsletter, but it hardly seems ideal:
WHENEVER Back Door (Zn 1) BECOMES NOT SECURE
THEN SET Close Door (Counter 1) TO 30

For every second that the back door is open, the counter will be decremented by 1.

WHENEVER EVERY 1 SECONDS
AND Back Door (Zn 1) IS NOT SECURE
THEN SUBTRACT 1 FROM Close Door (Counter 1)

If the counter ever reaches a value of 0 (meaning the door has been left open for 30 seconds), the M1 will announce “The back door is open†which has been programmed as Miscellaneous 1 (vm239). Also, the counter is set back to a value of 30. This will allow the system to announce the message again if the back door continues to be left open. The message will repeat every 30 seconds until the back door is closed.

WHENEVER Close Door (Counter 1) CHANGES TO 0
THEN ANNOUNCE Miscellaneous 1 (vm 239)
THEN SET Close Door (Counter 1) TO 30

I'd be substituting "ANNOUNCE" for turning the light off...

... but I'd sure prefer if your method worked. :p
 
This is what I'm doing:
elklightinglogic.jpg


There's got to be a better way... :p
 
Here is an alternative way of writing the RULES:

WHENEVER Garage Motion(ZN15) BECOMES NOT SECURE
THEN TURN Garage Overhead (110 (G14)) ON
THEN TURN Output 100 ON FOR GarageLight (Cust Set 1), RESTART TIMER IF RUNNING

WHENEVER Output 100 STATE IS TURNED OFF
THEN TURN Garage Overhead (110 (G14)) OFF


The motion detectors will tend to click in and out resetting the light timer, but you could add this optional line to make sure the timer stays set.

WHENEVER EVERY 10 SECONDS
AND Garage Motion (ZN 15) IS NOT SECURE
THEN TURN Output 100 ON FOR GarageLight (Cust Set 1), RESTART TIMER IF RUNNING


You can use the Phantom Outputs to do many things. Each of the 205 outputs has a timer that can be used even though nothing is connected to the output.
 
This code works for me. One good thing is that it doesn't send un-needed commands to turn the light "on" over and over again. One bad thing is that if you have turned on the light manually, then any activity (door or motion) will start the timer and will eventually turn the light off, even if you meant to leave it on.

3 WHENEVER Living Rear Door (Zn 8) BECOMES NOT SECURE
AND IT IS DARK OUTSIDE
THEN TURN Output 151 ON FOR 1 MIN,RESTART TIMER IF RUNNING
4 WHENEVER Living Room Mot (Zn 34) BECOMES NOT SECURE
AND IT IS DARK OUTSIDE
THEN TURN Output 151 ON FOR 1 MIN,RESTART TIMER IF RUNNING
5 WHENEVER Output 151 STATE IS TURNED ON
AND Living Lamp [177 (L1)] IS OFF
THEN SET Living Lamp [177 (L1)] TO 30%
6 WHENEVER Output 151 STATE IS TURNED OFF
THEN TURN Living Lamp [177 (L1)] OFF
 
Hmmm... okay... use an output for this instead of a counter compare... interesting...

I don't want the light getting told to turn back on again and again, so that needs addressing.

I don't mind the light turning off even if someone manually turned it on (though I suppose I could rule that out with another setting based on SEEING the light get turned on versus turning it on).

I gotta mull over what you both posted... Thank you!

Separate note: how are you posting your rules? I haven't found a way to copy/paste the text. You're not retyping, are you?
 
gregoryx said:
Separate note: how are you posting your rules? I haven't found a way to copy/paste the text. You're not retyping, are you?
Use the print preview function within RP, then click on the envelope in the top left corner for "export". Then I send it to a text file and copy/paste from there.
 
BTW, in case anyone read this ( B) ), I got this working exactly as I'd hoped for.

The garage motion arms in seconds, but the light stays on as long as anyone is moving AND shuts off at a user-specified (from the control panel, even :() time amount, such as 30 seconds.

1 WHENEVER Garage Motion (Zn 15) BECOMES NOT SECURE
THEN TURN Garage Overhead [110 (G14)] ON
THEN SET GarageLight (Counter 1) TO 1
2 WHENEVER EVERY 1 SECONDS
AND Garage Motion (Zn 15) IS NOT SECURE
THEN SET GarageLight (Counter 1) TO 1
3 WHENEVER EVERY 1 SECONDS
AND GarageLight (Counter 1) IS NOT EQUAL TO 0
THEN ADD 1 TO GarageLight (Counter 1)
4 WHENEVER GarageLight (Counter 1) CHANGES TO
THEN TURN Garage Overhead [110 (G14)] OFF
THEN SET GarageLight (Counter 1) TO 0

Can anyone see an alternative (and/or better) way to do all this?

Thanks!
 
I think something got cut off of the end of the first line of rule #4. I think this is a bug in the ElkRP printing process.

Do you have another rule that decrements the counter every second? I see it being set to 1 and 0 and being added to, but never subtracted from. Otherwise, what is the point of the adding?

Rule #1 will turn the light on repeatedly. This can be a lot more X-10 traffic than desired. If not using X-10, then this may not be an issue.
 
Thanks very much for pointing that out, Wayne.

Here's what it's doing now:

8 WHENEVER Garage Motion (Zn 15) BECOMES NOT SECURE
AND GarageLight (Counter 1) IS EQUAL TO 0
THEN TURN Garage Overhead [110 (G14)] ON
9 WHENEVER EVERY 1 SECONDS
AND Garage Motion (Zn 15) IS NOT SECURE
THEN SET GarageLight (Counter 1) TO 1
10 WHENEVER EVERY 1 SECONDS
AND GarageLight (Counter 1) IS NOT EQUAL TO 0
THEN ADD 1 TO GarageLight (Counter 1)
11 WHENEVER GarageLight (Counter 1) CHANGES TO MotionTimer (Cust Set 13)
THEN TURN Garage Overhead [110 (G14)] OFF
THEN SET GarageLight (Counter 1) TO 0
12 WHENEVER Garage Door (Zn 14) BECOMES NOT SECURE
THEN ANNOUNCE Garage Door (Zn 14)
THEN ANNOUNCE Miscellaneous 9 (vm247)
THEN TURN Garage Overhead [110 (G14)] ON
THEN SET GarageLight (Counter 1) TO 1

I think I've got it only firing the PLC when it should. :)

It seems like I'm using a lot of rules to do the job (four - #12 is turning the light on if the garage door opens... even if it's already on ;)).

Is there another way to do the timer based on a user-settable element, such as CustSet13 that I'm using now?
 
Back
Top