a:1:{i:0;a:6:{s:5:"TITLE";s:5:"Place";s:5:"NOLOG";s:1:"1";s:11:"DESCRIPTION";s:24:"Describes physical place";s:7:"METHODS";a:3:{i:0;a:7:{s:5:"TITLE";s:17:"isOccupiedUpdated";s:11:"DESCRIPTION";s:69:"Property isOccupied calls this method when someone changes isOccupied";s:4:"CODE";s:831:"$isOccupied = intval($params['NEW_VALUE']);
if ($isOccupied == 1) {
  $interval = time() - $this->getProperty('occupiedTime');
  $freezeTimeout = intval($this->getProperty('freezeTimeout'));
  if ($freezeTimeout == 0) $freezeTimeout = 30;
    
  if ($interval > $freezeTimeout) {
    $this->callMethod('onOccupie');
    
    $releaseTimeout= intval($this->getProperty('releaseTimeout'));
    if ($releaseTimeout== 0) $releaseTimeout = 60;
    SetTimeOut(sprintf('Place %s is occupied', $this->object_title),
      'callMethod("'.$this->object_title.'.onRelease");', $releaseTimeout);

    $log = getLogger($this);
    $log->trace(sprintf('Place %s is occupied, and will be automatically released in %d seconds', $this->object_title, $releaseTimeout));
      
    $this->setProperty('occupiedTime', time());
  }
}";s:11:"CALL_PARENT";s:1:"0";s:9:"SCRIPT_ID";s:1:"0";s:8:"EXECUTED";s:19:"2014-07-13 23:18:40";s:15:"EXECUTED_PARAMS";s:137:"a:4:{s:8:"PROPERTY";s:10:"isOccupied";s:9:"NEW_VALUE";s:1:"0";s:9:"OLD_VALUE";s:1:"0";s:21:"ORIGINAL_OBJECT_TITLE";s:13:"CorridorPlace";}";}i:1;a:7:{s:5:"TITLE";s:9:"onOccupie";s:11:"DESCRIPTION";s:77:"Abstract method. Objects should implement it if you want to handle this event";s:4:"CODE";s:0:"";s:11:"CALL_PARENT";s:1:"0";s:9:"SCRIPT_ID";s:1:"0";s:8:"EXECUTED";s:19:"2014-07-13 23:18:35";s:15:"EXECUTED_PARAMS";s:55:"a:1:{s:21:"ORIGINAL_OBJECT_TITLE";s:12:"BedroomPlace";}";}i:2;a:7:{s:5:"TITLE";s:9:"onRelease";s:11:"DESCRIPTION";s:77:"Abstract method. Objects should implement it if you want to handle this event";s:4:"CODE";s:0:"";s:11:"CALL_PARENT";s:1:"0";s:9:"SCRIPT_ID";s:1:"0";s:8:"EXECUTED";s:19:"2014-07-13 23:14:10";s:15:"EXECUTED_PARAMS";s:56:"a:1:{s:21:"ORIGINAL_OBJECT_TITLE";s:13:"CorridorPlace";}";}}s:10:"PROPERTIES";a:4:{i:0;a:4:{s:5:"TITLE";s:10:"isOccupied";s:11:"DESCRIPTION";s:40:"If place is occupied then 1, otherwise 0";s:12:"KEEP_HISTORY";s:1:"0";s:8:"ONCHANGE";s:17:"isOccupiedUpdated";}i:1;a:4:{s:5:"TITLE";s:14:"releaseTimeout";s:11:"DESCRIPTION";s:90:"How long (sec) we should keep isOccupied = 1. Method onRelease will be fired after timeout";s:12:"KEEP_HISTORY";s:1:"0";s:8:"ONCHANGE";s:0:"";}i:2;a:4:{s:5:"TITLE";s:12:"occupiedTime";s:11:"DESCRIPTION";s:95:"Property hold time when place was occupied last time.
Need for internal purposes. Don't use it";s:12:"KEEP_HISTORY";s:1:"0";s:8:"ONCHANGE";s:0:"";}i:3;a:4:{s:5:"TITLE";s:13:"freezeTimeout";s:11:"DESCRIPTION";s:187:"How long (sec) we should not check changes of isOccupied property. Method onOccupie will be fired after this timeout. So, this timeout configures how often repeat to fire onOccupie method";s:12:"KEEP_HISTORY";s:1:"0";s:8:"ONCHANGE";s:0:"";}}s:7:"OBJECTS";a:3:{i:0;a:3:{s:5:"TITLE";s:13:"CorridorPlace";s:11:"DESCRIPTION";s:0:"";s:7:"METHODS";a:1:{i:0;a:7:{s:5:"TITLE";s:9:"onOccupie";s:11:"DESCRIPTION";s:0:"";s:4:"CODE";s:234:"if (timeBetween('17:00', '23:00')) {
  callMethod('Corridor1Light.switchOn');
}
callMethod('Corridor2Light.switchOn');
// Reset timer if light was switch on by hardware button
callMethod('Corridor1Light.resetAutoSwitchOffTimer');";s:11:"CALL_PARENT";s:1:"0";s:9:"SCRIPT_ID";s:1:"0";s:8:"EXECUTED";s:19:"2014-07-13 23:13:55";s:15:"EXECUTED_PARAMS";s:0:"";}}}i:1;a:3:{s:5:"TITLE";s:12:"BedroomPlace";s:11:"DESCRIPTION";s:0:"";s:7:"METHODS";a:1:{i:0;a:7:{s:5:"TITLE";s:9:"onRelease";s:11:"DESCRIPTION";s:0:"";s:4:"CODE";s:38:"callMethod('Bedroom1Light.switchOff');";s:11:"CALL_PARENT";s:1:"0";s:9:"SCRIPT_ID";s:1:"0";s:8:"EXECUTED";s:19:"2014-07-13 23:04:33";s:15:"EXECUTED_PARAMS";s:0:"";}}}i:2;a:3:{s:5:"TITLE";s:15:"LivingroomPlace";s:11:"DESCRIPTION";s:0:"";s:7:"METHODS";a:2:{i:0;a:7:{s:5:"TITLE";s:9:"onOccupie";s:11:"DESCRIPTION";s:0:"";s:4:"CODE";s:83:"if (timeBetween('08:00', '23:00')) {
  callMethod('Livingroom3Light.switchOn');
}";s:11:"CALL_PARENT";s:1:"0";s:9:"SCRIPT_ID";s:1:"0";s:8:"EXECUTED";s:19:"2014-07-13 23:14:04";s:15:"EXECUTED_PARAMS";s:0:"";}i:1;a:7:{s:5:"TITLE";s:9:"onRelease";s:11:"DESCRIPTION";s:0:"";s:4:"CODE";s:41:"callMethod('Livingroom3Light.switchOff');";s:11:"CALL_PARENT";s:1:"0";s:9:"SCRIPT_ID";s:1:"0";s:8:"EXECUTED";s:19:"2014-07-13 18:11:41";s:15:"EXECUTED_PARAMS";s:0:"";}}}}}}