Skip to content

Items Presence_Monitor

ggodart edited this page Jan 1, 2021 · 1 revision

Presence_Monitor See original

SYNOPSIS Example initialization:

These are to be placed in a *.mht file in your user code directory.

First, make sure you have an occupancy monitor:

Items.mht

Defined in items.mht as

#OCCUPANCY, occupancy_monitor_name
OCCUPANCY, om
#PRESENCE, sensor_X, om, presence_X
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.

Optional settings:

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.

Automating timers:

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.

Setting occupancy:

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. Output states:

vacant: Nobody is in the room predict: Somebody may be entering the room occupied: Somebody is in the room

DESCRIPTION

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.

INHERITS

Generic_Item

METHODS

Method Description
watch_dog This watch_dog timer method will look for conditions where the room is occupied but no occupancy expiration timer is in play.
get_time_diff Returns the number of seconds since the last motion in the room

INI PARAMETERS

None

AUTHOR

Jason Sharpee jason@sharpee.com

Special Thanks to: Bruce Winter - MH

SEE ALSO

None

Clone this wiki locally