-
Notifications
You must be signed in to change notification settings - Fork 130
Presence_Monitor
This is an object that is attached to the Occupancy Monitor (usually $om) as well as one Door_Item or Motion_Item. It maintains whether or not there is presence (or predicted presence) within a given room. You should have one per room in your house, even if the room has multiple motion detectors. Not only will this object show up on floorplan.pl, but it can also be attached to a Light_Object to make sure the light remains on when somebody is present. If the light has prediction enabled it will also cause the light to turn on when somebody may be entering the room.
These are to be placed in a *.mht file in your user code directory.
First, make sure you have an occupancy monitor: OCCUPANCY, om
Then, create your presence objects: PRESENCE, sensor_X, om, presence_X
This creates a new Presence_Monitor object of name 'presence_X' and attaches it to both the occupancy monitor and 'sensor_X'. The 'sensor_X' object must already have been defined and needs to be either a Door_Item or a Motion_Item. The Presence_Monitor object's state will then reflect the state of the room: code format="perl" if($presence_X->state eq "occupied" || $presence_X->state eq "predict") {
$light_X->set("on"); $light_X->set_now("on"); #To prevent PLM spam
}elsif($presence_X->state eq "vacant") {
$light_X->set("off"); $light_X->set_now("off"); #To prevent PLM spam
} code
You can have occupancy automatically expire after X seconds of no activity (no doors opened or motion in the room):
$presence_X->occupancy_expire(3600); # Expire after 1 hour
When using this feature, consider how long a person might remain in the room without creating any motion. This will depend on the room and the motion detector coverage. Obviously a room with motion detector coverage only on the entrances/exits would need a longer expiration time. A hallway could have a pretty short expiration time, but a room in which you might sit and read a book for two hours needs a longer expiration time.
The purpose of this feature is to cause an errant occupancy to eventually expire. This is especially useful for rooms like a closet that might get false-positive presence and nobody else goes near it for a long time. Also for a room like a hallway that basically nobody ever stays in... yet there is lots of activity in and out and one of the outs might be missed.
You can now add arbitrary commands to a presence object that will be run after a room has been vacant or occupied for the specified amount of time. Here are examples:
$om_presence_master_bedroom->add_presence_timer(15, 'speak("bedroom presence")'); $om_presence_master_bedroom->add_vacancy_timer(15, 'speak("bedroom vacant")');
These examples cause the specified text to be spoken after a room has been continuously occupied for 15 seconds or continuously vacant for 15 seconds.
set_count(): This function can be used to set the number of people in a specific room. Set to 0 to vacate the room, or a positive number to set the number of people in the room.
vacant: Nobody is in the room predict: Somebody may be entering the room occupied: Somebody is in the room