Motion_Tracker.pm

Motion_Tracker

SYNOPSIS

In .mht file:

  X10MS, C10, room1_sensor, Sensors

In .pl file:

  my $room1_tracker = new Motion_Tracker(room1_sensor, 2*60);
  print_log "Last motion was " . $room1_tracker->age();

DESCRIPTION

This tracks a X10_Sensor and provides information on the last time motion was seen by the sensor.

INHERITS

Generic_Item

METHODS

TIESCALAR

Part of tie mechanism to track last_motion variable

FETCH

Part of tie mechanism to track last_motion variable

STORE

Part of tie mechanism to track last_motion variable

set

Set the state of this tracker. Valid states input states are 'motion', 'on', 'occupied' or 'vacant'. All other states are ignored. Output states are 'occupied' or 'vacant'.

expire_timeout

Get/set the expire timeout. This controls how long after the last motion is seen until when the tracker will be set to 'vacant'. Will not take effect until next motion is detected (fix?).

age

Return number of seconds since last motion was detected

last_motion

Get/set the last motion time. Call with one argument to set last_motion, call with no arguments to return last_motion time. If last_motion was more than expire_timeout seconds ago, then the state will be set to 'vacant'. Otherwise, a timer will be started to set the state to 'vacant' after expire_timeout seconds have elapsed.

Return vacant/occupied state and time since last motion as a string

INI PARAMETERS

NONE

AUTHOR

John Dillenburg john@dillenburg.org

SEE ALSO

NONE

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

 Motion_Tracker.pm