Свойства класса:
Методы класса:
$this->setProperty("updated",time()); $this->setProperty("updatedTime",date("H:i",time()));
Объекты класса:
Свойства класса:
Методы класса:
$status=$this->getProperty("detection"); if($status==1){ $this->callMethod("StartDetection"); } else { $this->callMethod("StopDetection"); }
$status=$this->getProperty("status"); if($status==1){ $this->callMethod("StartVideo"); $this->callMethod("onDetectionChanged"); } else { $this->callMethod("StopVideo"); $this->callMethod("onDetectionChanged"); }
Объекты класса:
$url='http://192.168.0.39:8087/0/detection/status'; // это собственно страница, на которую нам надо заходить уже залогинившись $ch = curl_init(); //curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); $result = curl_exec($ch); curl_close($ch); if(!$result){ sg("CameraZal.status",0); } if (preg_match('/Detection status (.+)<\/body>/is',$result,$m)) { // здесь как раз ищем нужную нам информацию $status=$m[1]; if ($status=="PAUSE") { sg("CameraZal.status",1); sg("CameraZal.detection",0); } if ($status=="ACTIVE") { sg("CameraZal.status",1); sg("CameraZal.detection",1); } }
$url='http://192.168.0.39:8087/0/detection/start'; // это собственно страница, на которую нам надо заходить уже залогинившись $ch = curl_init(); //curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); $result = curl_exec($ch); curl_close($ch); if(!$result){ sg("CameraZal.detection",0); sg("CameraZal.status",0); } if (preg_match('/<b>Thread 0<\/b> Detection (.+)<\/body>/is',$result,$m)) { // здесь как раз ищем нужную нам информацию $status=trim($m[1]); if ($status=="resumed") { sg("CameraZal.status",1); sg("CameraZal.detection",1); } }
$url='http://192.168.0.39:8087/0/detection/pause'; // это собственно страница, на которую нам надо заходить уже залогинившись $ch = curl_init(); //curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); $result = curl_exec($ch); curl_close($ch); if(!$result){ sg("CameraZal.detection",0); sg("CameraZal.status",0); } if (preg_match('/<b>Thread 0<\/b> Detection (.+)<\/body>/is',$result,$m)) { // здесь как раз ищем нужную нам информацию $status=trim($m[1]); if ($status=="paused") { sg("CameraZal.status",1); sg("CameraZal.detection",0); } }
shell_exec('ssh root@192.168.0.39 "/etc/init.d/motion start"'); $this->setProperty("Status",1); $this->callMethod("onDetectionChanged");
shell_exec('ssh root@192.168.0.39 "/etc/init.d/motion stop"');
$url='http://192.168.0.39:8087'; // это собственно страница, на которую нам надо заходить уже залогинившись $ch = curl_init(); //curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); $result = curl_exec($ch); curl_close($ch); if(!$result){ sg("CameraZal.status",0); //sg("CameraZal.detection",0); }
Свойства класса:
Методы класса:
Объекты класса:
$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]); } elseif (preg_match('/проверка оповещ.+?уров.+? (.)/is',$command,$m)) { if ($dt>0) { addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt); say('Задача принята'); echo $short_command; return; } global $voicemode; $voicemode='on'; say('Проверяю оповещение уровень '.$m[1].' ('.PUSHOVER_LEVEL.')',$m[1]); } else { say('Потому что гладиолус...'); }
say("Отключено питание");
say('Выполняем стартовые скрипты'); $res=getObjectsByClass("Camera"); $total=count($res); for($i=0;$i<$total;$i++) { $title = $res[$i]['TITLE']; callMethod($title.'.onStatusChanged'); callMethod($title.'.onDetectionChanged'); }
Свойства класса:
Свойства класса:
Методы класса:
$hl=$this->getProperty('health'); $last=$this->getProperty('updated'); $now=time(); $per=$this->getProperty('period'); if (($now-$last>$per)&&($hl<51)){ $this->setProperty('health','0'); }
Объекты класса:
Свойства класса:
Методы класса:
$last_update=$this->getProperty("updated"); $this->setProperty("updated",time()); $this->setProperty("updatedTime",date("H:i",time())); $this->setProperty("period",(int)$this->getProperty("updated")-(int)$last_update);
Свойства класса:
Методы класса:
Объекты класса:
$lc=(int)gg("MainMeter.lastPicks"); $cc=(int)gg("MainMeter.Picks"); $mode="day"; if($this->getProperty("day_mode")==0){ $mode="night"; } if($cc<$lc){ $delta=$cc; say("Обнаружен сброс показаний счетчика MainMeter",4); }else{ $delta=$cc-$lc; } //$delta=rand(40,100); if(gg("MainMeter.day_mode")==0){ $qwer=($cc-gg("MainMeter.night_picks"))*(float)gg("MainMeter.factor")/(60*60*1000); sg("mainMeter.per_night_energy",round($qwer,3)); }else{ $qwer=($cc-gg("MainMeter.day_picks"))*(float)gg("MainMeter.factor")/(60*60*1000); sg("mainMeter.per_day_energy",round($qwer,3)); } sg("MainMeter.lastPicks",$cc); $en_delta=(float)$delta*(float)gg("MainMeter.factor"); //в Джоулях if(gg("MainMeter.period")!=0){ $pw = (float)$en_delta/(float)gg("MainMeter.period"); //в Ваттах } else { $pw = 0; } sg("MainMeter.power",round($pw,2)); $en_delta=$en_delta/(60*60*1000); //в кВт-ч if(gg("MainMeter.day_mode")==1){ sg("MainMeter.DayEnergy",(float)gg("MainMeter.DayEnergy")+$en_delta); }else{ sg("MainMeter.NightEnergy",(float)gg("MainMeter.NightEnergy")+$en_delta); } $tm=date("H:i",time()); $ds=gg("MainMeter.day_start_time"); $ns=gg("MainMeter.night_start_time"); if(($tm>=$ds)&&($tm<$ns)){ if(gg("MainMeter.day_mode")==0){ sg("MainMeter.day_mode",1); callMethod("MainMeter.day_mode_changed"); } } if((($tm>=$ns)&&($tm<="23:59"))||(($tm>="00:00")&&($tm<$ds))){ if(gg("MainMeter.day_mode")==1){ sg("MainMeter.day_mode",0); callMethod("MainMeter.day_mode_changed"); } }
if($this->getProperty("day_mode")==1){ $this->setProperty("day_picks",$this->getProperty("lastPicks")); $qwer=($this->getProperty("lastPicks")-$this->getProperty("night_picks"))*(float)$this->getProperty("factor")/(60*60*1000); $this->setProperty("nightly_energy",$qwer); }else{ $this->setProperty("night_picks",$this->getProperty("lastPicks")); $qwer=($this->getProperty("lastPicks")-$this->getProperty("day_picks"))*(float)$this->getProperty("factor")/(60*60*1000); $this->setProperty("daily_energy",$qwer); }
Свойства класса:
Методы класса:
$this->setProperty("updated",time()); $this->setProperty("updatedTime",date("H:i",time())); $bal=(float)$this->getProperty("balance"); $alm=(float)$this->getProperty("Alarm"); $alarmed=(int)$this->getProperty("alarmed"); $def_alarm=(float)$this->getProperty("defaultAlarm"); if($bal<$alm){ $this->setProperty("alarmed",1); //$oldLevel=gg("ThisComputer.minMsgLevel"); //sg("ThisComputer.minMsgLevel",9); say("Требуется пополнить баланс: ".$this->getProperty("Number")." (".$this->getProperty("balance").")",4); //sg("ThisComputer.minMsgLevel",$oldLevel); $new_alarm=$bal-9; if($new_alarm<0){ $new_alarm=0; } $this->setProperty("Alarm",$new_alarm); }else{ if(($bal>($alm+10))&&($alarmed==1)){ $this->setProperty("alarmed",0); $this->setProperty("Alarm",$def_alarm); //$oldLevel=gg("ThisComputer.minMsgLevel"); //sg("ThisComputer.minMsgLevel",9); say("Пополнен баланс: ".$this->getProperty("Number")." (".$this->getProperty("balance").")",4); //sg("ThisComputer.minMsgLevel",$oldLevel); } }
Объекты класса:
Свойства класса:
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
Объекты класса:
if ($params['OLD_VALUE']==$params['VALUE']) { return false; } say("Свет в коридоре: ".gg('Coridor.lightLevel')." (".$params['OLD_VALUE']."=>".$params['VALUE'].")");
//if ($params['OLD_VALUE']==$params['VALUE']) { // return false; //} say("Свет в зале: ".gg('Zal.lightLevel')." (".$params['OLD_VALUE']."=>".$params['VALUE'].")"); if ($params['VALUE']=='1'||$params['VALUE']=='3') { $low='1'; } else { $low='0'; } if ($params['VALUE']=='2'||$params['VALUE']=='3') { $high='1'; } else { $high='0'; } sg('Zal.defaultLevel',''.$low.','.$high);
//if ($params['OLD_VALUE']==$params['VALUE']) { // return false; //} say("Свет в детской: ".gg('Det.lightLevel')." (".$params['OLD_VALUE']."=>".$params['VALUE'].")"); shell_exec('/usr/local/bin/noolite -api -set_ch 1 '.$params['VALUE']);
Методы класса:
Объекты класса:
echo "status received: ".$params['status'];
global $voicemode; $voicemode='off'; processCommand($params['message']);
Свойства класса:
Методы класса:
Объекты класса:
Свойства класса:
Методы класса:
//$params['t'] $old_temp=$this->getProperty('temp'); $t=round($params['t']*10)/10; $this->setProperty('temp',$t); if ($t>$old_temp) { $d=1; } elseif ($t<$old_temp) { $d=-1; } else { $d=0; } $this->setProperty('direction',$d); $this->setProperty("updated",time()); $this->setProperty("updatedTime",date("H:i",time()));
Объекты класса:
Свойства класса:
Методы класса:
Объекты класса:
RunScript('sensors'); RunScript('Health'); RunScript('Meters'); $h=(int)date('G',time()); $m=date('i',time()); if (isWeekDay()) { } if (($h>=8)) { if ($m=="00") { say(timeNow()); } } if (($m=="00")||($m=="30")) { RunScript('Mobilephones_update'); }
Методы класса:
Объекты класса:
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']); } }
Свойства класса:
Объекты класса:
, Россия
Веб-сайт:
http://cmd-q.ru
© 2025 - Site Built By SergeJey | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving