Свойства класса:
Методы класса:
$volume=round(65535*$params['VALUE']/100);
$this->setProperty('volumeLevel',$params['VALUE']);
safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume);
say("Изменилась громкость до ".$params['VALUE']." процентов");Объекты класса:
$command=$params['command'];
$short_command='';
$dt=recognizeTime($command,$short_command);
if (preg_match('/скажи сколько время/is',$command)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята');
return;
}
global $voicemode;
$voicemode='on';
say('Сейчас '.timeNow());
} elseif (preg_match('/сколько время/is',$command)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята');
echo $short_command;
return;
}
say('Сейчас '.timeNow());
} elseif (preg_match('/повтори (.+)/is',$command,$m) || preg_match('/скажи (.+)/is',$command,$m)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята');
return;
}
global $voicemode;
$voicemode='on';
say($m[1]);
} else {
say('Неизвестная команда...');
}say("Отключено питание");Свойства класса:
Методы класса:
$this->setProperty('status',$params['status']);
$this->setProperty('updatedTimestamp',time());
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=12*60*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);Свойства класса:
Методы класса:
$this->setProperty('status',$params['status']);
$this->setProperty('updatedTimestamp',time());
$this->setProperty('alive',1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=24*60*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
if ($params['status']) {
$this->setProperty('motionDetected',1);
clearTimeOut($this->object_title.'_detected');
setTimeOut($this->object_title.'_detected',"setGlobal('".$this->object_title.".motionDetected',0);",30);
$linked_room=$this->getProperty('LinkedRoom');
if ($linked_room!='') {
callMethod($linked_room.'.onActivity');
}
if (getGlobal('somebodyHome')!=1) {
setGlobal('somebodyHome',1);
}
$last_register=registeredEventTime('inhouseMovement');
registerEvent('inhouseMovement',$this->name,2);
if (!$last_register || ((time()-$last_register)>2*60*60)) {
if (timeBetween('06:00', '12:00')) {
runScript('morningGreeting');
}
if (timeBetween('16:00', '01:00')) {
runScript('eveningGreeting');
}
}
}Свойства класса:
Методы класса:
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date('H:i'));
if ($this->getProperty('status')) {
say("Mode ".$this->getProperty('title')." activated.");
} else {
say("Mode ".$this->getProperty('title')." deactivated.");
}$this->setProperty('active',1);$this->setProperty('active',0);Объекты класса:
Объекты класса:
include_once(DIR_MODULES.'app_radio/app_radio.class.php');
$app_radio=new app_radio();
if(is_array($params))
{
if(isset($params['sta'])) $app_radio->change_station($params['sta'],$app_radio);
if(isset($params['cmd'])) $app_radio->control($params['cmd']);
if(isset($params['vol'])) $app_radio->set_volume($params['vol'],$app_radio);
}
else
{
if($params=='play' || $params=='stop') $app_radio->control($params);
else if(strpos($params, "vol")===0) $app_radio->set_volume((int)substr($params,3),$app_radio);
else if(strpos($params, "sta:")===0) $app_radio->change_station(substr($params,4),$app_radio);
}Свойства класса:
Методы класса:
$status=$this->getProperty("status");
if ($status) {
$this->callMethod('turnOn');
} else {
$this->callMethod('turnOff');
}$status=$this->getProperty("status");
if ($status) {
$this->callMethod('turnOff');
} else {
$this->callMethod('turnOn');
}$this->setProperty("status",0);$this->setProperty("status",1);Объекты класса:
Свойства класса:
Методы класса:
$latestActivity=$this->getProperty('LatestActivity');
$this->setProperty('LatestActivity',time());
$this->setProperty('LatestActivityTime',date('H:i'));
$this->setProperty('SomebodyHere',1);
$ot=$this->object_title;
$activity_timeout=10*60;
clearTimeOut($ot."_activity_timeout");
setTimeOut($ot."_activity_timeout","callMethod('".$ot.".onIdle');",$activity_timeout);
$this->setProperty('SomebodyHere',0);Объекты класса:
Методы класса:
Объекты класса:
echo "status received: ".$params['status'];
global $voicemode; $voicemode='off'; processCommand($params['message']);
Свойства класса:
Методы класса:
Объекты класса:
$details=array();
$red_state=0;
$yellow_state=0;
if ($red_state) {
$state='red';
$state_title='Red';
} elseif ($yellow_state) {
$state='yellow';
$state_title='Yellow';
} else {
$state='green';
$state_title='Green';
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say("System state changed to ".$state_title.".");
say(implode(". ",$details));
} else {
say("System state restored to ".$state_title);
}
$this->callMethod('stateChanged');
}$details=array();
$red_state=0;
$yellow_state=0;
$cycles=array('states'=>'states cycle','main'=>'main cycle','execs'=>'exec cycle','scheduler'=>'scheduler cycle');
foreach($cycles as $k=>$v) {
$tm=getGlobal('ThisComputer.cycle_'.$k.'Run');
if (time()-$tm>5*60) {
$red_state=1;
$details[]=$v." stopped.";
}
}
$cycles=array('ping'=>'ping cycle','webvars'=>'webvars cycle','watchfolders'=>'watch folders cycle','rss'=>'RSS cycle');
foreach($cycles as $k=>$v) {
$tm=getGlobal('ThisComputer.cycle_'.$k.'Run');
if (time()-$tm>10*60) {
$yellow_state=1;
$details[]=$v." stopped.";
}
}
if ($red_state) {
$state='red';
$state_title='Red';
} elseif ($yellow_state) {
$state='yellow';
$state_title='Yellow';
} else {
$state='green';
$state_title='Green';
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say("System state changed to ".$state_title.".");
say(implode(". ",$details));
} else {
say("System state restored to ".$state_title);
}
$this->callMethod('stateChanged');
}$details=array();
$red_state=0;
$yellow_state=0;
if ($red_state) {
$state='red';
$state_title='Red';
} elseif ($yellow_state) {
$state='yellow';
$state_title='Yellow';
} else {
$state='green';
$state_title='Green';
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say("System state changed to ".$state_title.".");
say(implode(". ",$details));
} else {
say("System state restored to ".$state_title);
}
$this->callMethod('stateChanged');
}Свойства класса:
Методы класса:
//$params['t']
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date("H:i",time()));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=30*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
if (!isset($params['t'])) {
return;
}
$old_temp=$this->getProperty('temp');
$t=round($params['t'],1);
if ($t>110) return;
$this->setProperty('temp',$t);
if ($params['uptime']) {
$this->setProperty('uptime',$params['uptime']);
}
if ($t>$old_temp) {
$d=1;
} elseif ($t<$old_temp) {
$d=-1;
} else {
$d=0;
}
$this->setProperty('direction',$d);
$linked_room=$this->getProperty("LinkedRoom");
if ($linked_room) {
setGlobal($linked_room.'.Temperature',$t);
}Объекты класса:
Свойства класса:
Методы класса:
Объекты класса:
$h=(int)date('G',time());
$m=date('i',time());
if (isWeekDay()) {
}
if (($h>=8)) {
if ($m=="00") {
say(timeNow());
}
}Методы класса:
Объекты класса:
if ($params['serial']=='' && $params['devname']!='') {
$params['serial']=$params['devname'];
}
$device=SQLSelectOne("SELECT * FROM usbdevices WHERE SERIAL LIKE '".$params['serial']."'");
if (!$device['ID']) {
// new device connected
//say("Подключено новое устройство",1);
$device=array();
$device['SERIAL']=$params['serial'];
$device['TITLE']='устройство '.$params['devname'];
$device['FIRST_FOUND']=date('Y-m-d H:i:s');
$device['LAST_FOUND']=date('Y-m-d H:i:s');
$device['LOG'].=$device['FIRST_FOUND'].' подключено (впервые)'."\n";
$device['ID']=SQLInsert('usbdevices',$device);
} else {
// device already in our database
//say("Подключено ".$device['TITLE'],1);
if ($device['USER_ID']) {
$user=SQLSelectOne("SELECT * FROM users WHERE ID='".$device['USER_ID']."'");
if ($user['ID']) {
//$user['NAME']; // теперь мы знаем имя пользователя, связанного с этим устройством
}
}
$device['LAST_FOUND']=date('Y-m-d H:i:s');
$device['LOG']=$device['LAST_FOUND'].' подключено'."\n".$device['LOG'];
SQLUpdate('usbdevices',$device);
if ($device['SCRIPT_ID']!='') {
runScript($device['SCRIPT_ID'],$params);
} elseif ($device['SCRIPT']!='') {
eval($device['SCRIPT']);
}
}Свойства класса:
Объекты класса:
, Украина
На форуме: dmnd
© 2026 SJLab | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving