Свойства класса:
Методы класса:
if ($this->getProperty("power")) { // Восстанавливаем сохранённые параметры кондиционера $this->setProperty("turbo", $this->getProperty("turbo_old")); // Включаем кондиционер getURL('localhost/modules/dev_broadlink/command.php?command=split_on'); // Устанавливаем режим работы $this->callMethod('SetParams'); } else { // $this->setProperty("turbo", 0); // Выключаем кондиционер getURL('localhost/modules/dev_broadlink/command.php?command=split_off'); }
// Ограничиваем параметр температуры допустимым диапазоном if ($this->getProperty("temp") < 16) $this->setProperty("temp", 16); if ($this->getProperty("temp") > 30) $this->setProperty("temp", 30); { if ($this->getProperty("turbo")) { // Включаем режим Турбо getURL('localhost/modules/dev_broadlink/command.php?command=turbo_on'); say("Включен режим турбо", 2); } else { // Устанавливаем температуру switch ($this->getProperty("temp")) { case 18: getURL('localhost/modules/dev_broadlink/command.php?command=split_18'); break; case 19: getURL('localhost/modules/dev_broadlink/command.php?command=split_19'); break; case 20: getURL('localhost/modules/dev_broadlink/command.php?command=split_20'); break; case 21: getURL('localhost/modules/dev_broadlink/command.php?command=split_21'); break; case 22: getURL('localhost/modules/dev_broadlink/command.php?command=split_22'); break; case 23: getURL('localhost/modules/dev_broadlink/command.php?command=split_23'); break; case 24: getURL('localhost/modules/dev_broadlink/command.php?command=split_24'); break; case 25: getURL('localhost/modules/dev_broadlink/command.php?command=split_25'); break; case 26: getURL('localhost/modules/dev_broadlink/command.php?command=split_26'); break; case 27: getURL('localhost/modules/dev_broadlink/command.php?command=split_27'); break; case 28: getURL('localhost/modules/dev_broadlink/command.php?command=split_28'); break; case 29: getURL('localhost/modules/dev_broadlink/command.php?command=split_29'); break; case 30: getURL('localhost/modules/dev_broadlink/command.php?command=split_30'); break; } say("Температура ".$this->getProperty("temp"), 2); } } // Сохраняем параметры кондиционера $this->setProperty("turbo_old", $this->getProperty("turbo"));
Объекты класса:
Свойства класса:
Методы класса:
$vol=$this->GetProperty('VolumeLevel'); if ($vol>60) {$vol=60;}//запретим превышать громкость if ($vol == 0) { $command=strtoupper('!1'.$this->GetProperty('VolumeCommand')."00"); } else { $command=strtoupper('!1'.$this->GetProperty('VolumeCommand').dechex($vol)); } $ot=$this->object_title; //получить имя объекта callMethod($ot.'.SendCommand',array('OnkyoCommand'=>$command));
$command='!1PRS0'.$this->GetProperty('RadioNum'); cm('OnkyoMain.SendCommand',array('OnkyoCommand'=>$command));
$command='!1NTCSTOP'; $ot=$this->object_title; //получить имя объекта callMethod($ot.'.SendCommand',array('OnkyoCommand'=>$command));
$command='!1NTCPLAY'; $ot=$this->object_title; //получить имя объекта callMethod($ot.'.SendCommand',array('OnkyoCommand'=>$command));
$receiveripnumber=$this->GetProperty('IP_address'); $receiverlistenport="60128"; $fp = pfsockopen($receiveripnumber, $receiverlistenport, $errno, $errstr, 30); $VolCommand=$this->GetProperty('VolumeCommand'); $command='!1'.$VolCommand.'QSTN'; $status=get_status($command,$fp,false); $status=hexdec(str_replace('!1'.$VolCommand,'',$status)); $this->SetProperty('VolumeLevel',$status); //say($status); $PwrCommand=$this->GetProperty('PowerCommand'); $command='!1'.$PwrCommand.'QSTN'; $status=get_status($command,$fp,false); //say($status); $status=str_replace('!1'.$PwrCommand,'',$status)+0; //say($status); $this->SetProperty('Status',$status); //say($status); //$command='!1SLIQSTN'; //$status=get_status($command,$fp,false); //say($status); fclose($fp); function send_cmd($cmd, $fp, $debug){ $length=strlen($cmd); $length=$length+1; $total =$length+16; $code =chr($length); $line ="ISCP\x00\x00\x00\x10\x00\x00\x00$code\x01\x00\x00\x00".$cmd."\x0D"; if ($debug) { DebMes("\n*** send_cmd:".$line); } fwrite($fp, $line); return $line; } function get_status($cmd, $fp, $debug){ do { send_cmd($cmd, $fp, $debug); $status = ""; $status = fread($fp, 80); $status = substr($status, strpos($status, "!")); $status = substr($status, 0, strlen($status)-3); if ($debug) { DebMes("\n*** get_status:".$cmd." : ".$status); } } while ((substr_compare($status, "!1NLS", 0, 5) == 0)or (substr_compare($status, "!1NLT", 0, 5) == 0)or (substr_compare($status, "!!1NL", 0, 5) == 0)); return $status; }
$command=$params['OnkyoCommand']; //say($command); $receiveripnumber=$this->GetProperty('IP_address'); $receiverlistenport="60128"; $fp = pfsockopen($receiveripnumber, $receiverlistenport, $errno, $errstr, 30); $length=strlen($command); $length=$length+1; $total=$length+16; $code=chr($length); // total eiscp packet to send $line="ISCP\x00\x00\x00\x10\x00\x00\x00$code\x01\x00\x00\x00".$command."\x0D"; fwrite($fp, $line); fclose($fp);
$command='!1'.$this->GetProperty('SelectorCommand').$this->GetProperty('Source'); $ot=$this->object_title; //получить имя объекта callMethod($ot.'.SendCommand',array('OnkyoCommand'=>$command));
$command='!1'.$this->GetProperty('PowerCommand').'0'.$this->GetProperty('Status'); $ot=$this->object_title; //получить имя объекта callMethod($ot.'.SendCommand',array('OnkyoCommand'=>$command));
Объекты класса:
Методы класса:
Объекты класса:
// device lost registerEvent('bluetooth_lost_'.$params['mac']); { if ($params['bluetooth_lost']); say($params['user'].'куку'); setGlobal($params['user'].'btOnline',0); }
// new device $tm=registeredEventTime('btcall'); if ((time()-$tm)>60 || $tm<0) { registerEvent('btcall'); } if ($params['new']) { // say('Обнаружено новое блютуз устройство'); } if ($params['user']!='') { say($params['user'].' где-то рядом'); setGlobal($params['user'].'btOnline',1); }
Свойства класса:
Методы класса:
$volume=round(65535*$params['VALUE']/100); $this->setProperty('volumeLevel',$params['VALUE']); safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume); //say("Изменилась громкость до ".$params['VALUE']." процентов");
Объекты класса:
say("Отключено питание");
$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('Задача принята',2); return; } global $voicemode; $voicemode='on'; say('Сейчас '.timeNow(),2); } 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('Задача принята',2); return; } global $voicemode; $voicemode='on'; say($m[1],2); } else { // say('Неизвестная команда...',2); }
Свойства класса:
Методы класса:
$this->setProperty('LastRun',date('Y-m-d H:i:s'));
$name='Cron_'.$this->object_title; SQLExec("DELETE FROM jobs WHERE title='".$name."'");
Свойства класса:
Методы класса:
$this->setProperty("gpiout12",1);
$status=$this->getProperty("gpiout12"); if ($status) { $this->callMethod('turnOff'); } else { $this->callMethod('turnOn'); }
$this->setProperty("gpiout12",0);
if ((getGlobal('ESPkoridor.gpiout12')) =="1") { getURL('http://192.168.8.180/gpio?st=1&pin=12', 1); } else if ((getGlobal('ESPkoridor.gpiout12')) =="0") { getURL('http://192.168.8.180/gpio?st=0&pin=12', 0); }
// получить температуру $x = $this->getProperty('dsw1,dhtе1'); // не больше и не меньше if ($x<12) {$x=12;} elseif ($x>30) {$x=30;} // расчет величины цветовой шкалы $x = round( ($x-12)*42,5 ); $hcolor = '#'; // расчет r $y = $x-255; if ($y < 0) {$y = 0;} elseif ($y > 255) {$y = 255;} $y = dechex($y); if (strlen($y) == 1) {$y = '0'.$y;} $hcolor = $hcolor.$y; // расчет g $y = 255-$x; if ($y < 0) {$y = 0;} elseif ($y > 255) {$y = 255;} $y = dechex($y); if (strlen($y) == 1) {$y = '0'.$y;} $hcolor = $hcolor.$y; // расчет b $y = 765-$x; if ($y < 0) {$y = 0;} elseif ($y > 255) {$y = 255;} $y = dechex($y); if (strlen($y) == 1) {$y = '0'.$y;} $hcolor = $hcolor.$y; // установить свойство цвета температуры $this->setProperty('TempHEX', $hcolor);
Объекты класса:
getURL('http://192.168.8.179/gpio?st=1&pin=12&flash=1', 1);
getURL('http://192.168.8.179/gpio?st=0&pin=12&flash=0', 0);
getURL('http://192.168.8.153/gpio?st=0&pin=12&flash=0', 0);
getURL('http://192.168.8.153/gpio?st=1&pin=12&flash=1', 1);
getURL('http://192.168.8.175/gpio?st=1&pin=12&flash=1', 1);
getURL('http://192.168.8.175/gpio?st=0&pin=12&flash=0', 0);
getURL('http://192.168.8.170/gpio?st=0&pin=12&flash=0', 0);
getURL('http://192.168.8.170/gpio?st=1&pin=12&flash=1', 1);
Свойства класса:
Методы класса:
//$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['h'])) { return; } $old_temp=$this->getProperty('humidity'); $t=round($params['h'],1); if ($t>100) return; $this->setProperty('humidity',$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.'.Humidity',$t); }
Объекты класса:
Свойства класса:
Методы класса:
if (IsSet($params['status'])) { $this->setProperty('status',$params['status']); // выставляем статус сенсора } else{ $params['status']=$this->getProperty('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'); } }
Свойства класса:
Методы класса:
$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 ($this->object_title=='sensorMovement3' || $this->object_title=='sensorMovementRemote1' || $this->object_title=='sensorMovementRemote2') { //|| $this->object_title=='sensorMovement5' return; // не реагируем на движение в спальне, по ip-сенсорам и по сенсору на втром этаже } ClearTimeOut("nobodyHome"); SetTimeOut("nobodyHome","callMethod('NobodyHomeMode.activate');", 1*60*60); // выполняем если целый час никого не было if (getGlobal('NobodyHomeMode.active')) { callMethod('NobodyHomeMode.deactivate'); } $last_register=registeredEventTime('inhouseMovement'); // проверяем когда в последний раз срабатывало событие "движение внутри дома" registerEvent('inhouseMovement',$this->name,2); // регистрируем событие "движение внутри дома" if (timeBetween('05:00', '12:00') && ((time()-$last_register)>2*60*60)) { runScript('Greeting'); // запускаем скрипт "доброе утро" } }
Объекты класса:
if ($params['status']) { say("Движение"); //runScript('checkStreetLight'); }
Методы класса:
Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty('active',0);
$this->setProperty('active',1);
$this->setProperty("updated",time()); $this->setProperty("updatedTime",date('H:i')); if ($this->getProperty('active')) { say("Режим ".$this->getProperty('title')." активирован."); } else { say("Режим ".$this->getProperty('title')." выключен."); }
Объекты класса:
setGlobal('minMsgLevel','3'); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nightmode_activate.php'); /* end injection of {SDevices} */
setGlobal('minMsgLevel','1'); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nightmode_deactivate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_activate.php'); /* end injection of {SDevices} */ say("По-моему никого нет дома..."); setGlobal('somebodyHome',0); // ставим глобальный флаг на то что никого нет дома //setGlobal('somebodyHomeText','Никого нет дома'); if (timeBetween('23:30','06:00')) { say('Видимо все спят...'); } else { say('Все куда-то ушли...'); } //runScript('takeCare');
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_deactivate.php'); /* end injection of {SDevices} */ if (getGlobal('EconomMode.active')) { callMethod('EconomMode.deactivate'); } //callMethod("MiLamp4.setColor",array('color'=>'#00ff00')); //setTimeOut('milamp4turnoff','callMethod("MiLamp4.turnOff");',10*60); setGlobal('somebodyHome',1); // ставим глобальный флаг на то что кто-то дома //setGlobal('somebodyHomeText','Дома кто-то есть'); say("Обнаружено движение.");
Объекты класса:
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); }
Свойства класса:
Методы класса:
if ($params['OLD_VALUE']>$params['NEW_VALUE']) { brLinkCommand('reciver_volume-'); } else { brLinkCommand('reciver_volume+'); }
Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty("status",0);
$this->setProperty("status",1);
$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); //safe_exec('"c:\Program Files\nooLite\noolite.exe" -api -off_ch'.$this->getProperty("channel")); $this->callMethod("sendCommand",array('command'=>'-off_ch'.$this->getProperty("channel")));
$this->setProperty("status",1); $this->callMethod("sendCommand",array('command'=>'-on_ch'.$this->getProperty("channel")));
$cmdline='"c:\Program Files\nooLite\nooLite.exe" -api '.$params['command']; $last_called=gg('NoolightCommandSend'); $min_delay=3; $now=time(); if (($now-$last_called)>$min_delay) { //safe_exec($cmdline); $last_callled=$now; sg('NoolightCommandSend',$last_called); DebMes("Noolite instant exec: ".$cmdline); system($cmdline); //exec($cmdline); } else { if ($last_callled<$now) { $last_callled=$now; } $last_called+=$min_delay; sg('NoolightCommandSend',$last_called); DebMes("Noolite scheduled job for ".date('H:i:s',$last_called)); AddScheduledJob("noolight".md5($cmdline),"safe_exec('".$cmdline."');",$last_called); }
Свойства класса:
Методы класса:
$code1=$this->getProperty('Code1'); $code2=$this->getProperty('Code2'); safe_exec("c:\_majordomo\apps\arduino_gw\arduino_gw.exe rcoff$code1:$code2;"); $this->setProperty("status",0);
$code1=$this->getProperty('Code1'); $code2=$this->getProperty('Code2'); safe_exec("c:\_majordomo\apps\arduino_gw\arduino_gw.exe rcon$code1:$code2;"); $this->setProperty("status",1);
Свойства класса:
Методы класса:
// получить температуру $x = $this->getProperty('Temperature'); // не больше и не меньше if ($x<12) {$x=12;} elseif ($x>30) {$x=30;} // расчет величины цветовой шкалы $x = round( ($x-12)*42,5 ); $hcolor = '#'; // расчет r $y = $x-255; if ($y < 0) {$y = 0;} elseif ($y > 255) {$y = 255;} $y = dechex($y); if (strlen($y) == 1) {$y = '0'.$y;} $hcolor = $hcolor.$y; // расчет g $y = 255-$x; if ($y < 0) {$y = 0;} elseif ($y > 255) {$y = 255;} $y = dechex($y); if (strlen($y) == 1) {$y = '0'.$y;} $hcolor = $hcolor.$y; // расчет b $y = 765-$x; if ($y < 0) {$y = 0;} elseif ($y > 255) {$y = 255;} $y = dechex($y); if (strlen($y) == 1) {$y = '0'.$y;} $hcolor = $hcolor.$y; // установить свойство цвета температуры $this->setProperty('TempHEX', $hcolor);
$rooms=getObjectsByClass("Rooms"); $total=count($rooms); for($i=0;$i<$total;$i++) { $rooms[$i]['room']=getGlobal($rooms[$i]['TITLE'].'.Title'); if (!$rooms[$i]['room']) { $rooms[$i]['room']=$rooms[$i]['TITLE']; } $rooms[$i]['active']=getGlobal($rooms[$i]['TITLE'].'.SomebodyHere'); $rooms[$i]['time']=getGlobal($rooms[$i]['TITLE'].'.LatestActivity'); $rooms[$i]['diff']=time()-$rooms[$i]['time']; } function cmp($a, $b) { if ($a['diff'] == $b['diff']) { return 0; } return ($a['diff'] < $b['diff']) ? -1 : 1; } usort($rooms,"cmp"); if (!$rooms[0]['active']) { $somebodyHomeText="Никого нет дома. Были в ".date('H:i',$rooms[0]['time'])." (".$rooms[0]['room'].")"; } else { $res_rooms=array(); for($i=0;$i<$total;$i++) { if ($rooms[$i]['active']) { $res_rooms[]=$rooms[$i]['room']; } } $somebodyHomeText="Кто-то дома: ".implode(", ",$res_rooms); } setGlobal('somebodyHomeText',$somebodyHomeText); //echo "Updated";
$this->setProperty('SomebodyHere',0);
$latestActivity=$this->getProperty('LatestActivity'); $this->setProperty('LatestActivity',time()); $this->setProperty('LatestActivityTime',date('H:i')); $this->setProperty('SomebodyHere',1); $ot=$this->object_title; if ($this->getProperty("IdleDelay")) { $activity_timeout=(int)$this->getProperty("IdleDelay"); } else { $activity_timeout=10*60; } clearTimeOut($ot."_activity_timeout"); setTimeOut($ot."_activity_timeout","callMethod('".$ot.".onIdle');",$activity_timeout); $this->callMethod("updateActivityStatus"); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_onActivity.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_logicAction.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_statusUpdated.php'); /* end injection of {SDevices} */
Объекты класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SButtons_pressed.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SControllers_switch.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SControllers_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SControllers_turnOn.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_levelUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_turnOff.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SRGB_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SRGB_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SRGB_colorUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SRGB_setColor.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCounters_valueUpdated.php'); /* end injection of {SDevices} */
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_statusUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions_motionDetected.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenClose_statusUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_valueUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_statusUpdated.php'); /* end injection of {SDevices} */
Объекты класса:
Методы класса:
Объекты класса:
global $voicemode; $voicemode='off'; processCommand($params['message']);
echo "status received: ".$params['status'];
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
Объекты класса:
$details=array(); $red_state=0; $yellow_state=0; if (!isOnline('Internet')) { $yellow_state=1; $details[]=LANG_GENERAL_NO_INTERNET_ACCESS; } if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; } else { $state='green'; $state_title=LANG_GENERAL_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(LANG_GENERAL_COMMUNICATION_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title."."); say(implode(". ",$details)); } else { say(LANG_GENERAL_COMMUNICATION_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title); } $this->callMethod('stateChanged'); }
$details=array(); $red_state=0; $yellow_state=0; $cycles=array('states'=>'states','main'=>'main','execs'=>'exec','scheduler'=>'scheduler'); foreach($cycles as $k=>$v) { $tm=getGlobal('ThisComputer.cycle_'.$k.'Run'); if (time()-$tm>5*60) { $red_state=1; $details[]=$v." ".LANG_GENERAL_CYCLE." ".LANG_GENERAL_STOPPED."."; } } $cycles=array('ping'=>'ping','webvars'=>'webvars'); foreach($cycles as $k=>$v) { $tm=getGlobal('ThisComputer.cycle_'.$k.'Run'); if (time()-$tm>10*60) { $yellow_state=1; $details[]=$v." ".LANG_GENERAL_CYCLE." ".LANG_GENERAL_STOPPED."."; } } if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; } else { $state='green'; $state_title=LANG_GENERAL_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(LANG_GENERAL_SYSTEM_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title."."); say(implode(". ",$details)); } else { say(LANG_GENERAL_SYSTEM_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title); } $this->callMethod('stateChanged'); } /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/system_checkstate.php'); /* end injection of {SDevices} */
$details=array(); $red_state=0; $yellow_state=0; if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; } else { $state='green'; $state_title=LANG_GENERAL_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(LANG_GENERAL_SECURITY_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title."."); say(implode(". ",$details)); } else { say(LANG_GENERAL_SECURITY_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title); } $this->callMethod('stateChanged'); }
Свойства класса:
Методы класса:
$this->setProperty("updated",time()); $this->setProperty("updatedTime",date("Y-m-d H:i:s",time())); $this->setProperty("alive",1); $ot=$this->object_title; $alive_timeout=(int)$this->getProperty("aliveTimeOut"); if (!$alive_timeout) { $alive_timeout=12*60*60; } setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout); // Получение среднего значения из истории //Получить id свойства $prop_id=$this->getPropertyByName('status', $this->class_id, $this->id); //Получаем VALUE_ID для следующей таблицы $pvalue=SQLSelectOne("SELECT * FROM pvalues WHERE PROPERTY_ID='".$prop_id."' AND OBJECT_ID='".$this->id."'"); //Получаем средние значения температуры за последние 30 минут $start_time=time()-30*60; // 30 минут $arr_s = SQLSelectOne("SELECT avg(VALUE) as AVG_V FROM phistory WHERE VALUE_ID='".$pvalue['ID']."' AND ADDED>='".date('Y-m-d H:i:s', $start_time)."'"); $avg_s=round($arr_s[AVG_V], 1); $s=$params['status']; if (isset($s)) { // Если некорректные данные if (($s > 50) || ($s < -50)) { return; } // Записать в свойство объекта $this->setProperty('status',$s); } else { // Для слинкованных свойств и запуска этого метода без передачи данных, взять их из свойства. $s = $this->getProperty('status'); } $s=round($s, 1); // Сравнение if ($s-$avg_s > 0.5) { $d=1; } elseif ($s-$avg_s < -0.5) { $d=-1; } else { $d=0; } $this->setProperty('direction',$d); // Передать данные слинкованной комнате $linked_room=$this->getProperty("LinkedRoom"); if ($linked_room) { setGlobal($linked_room.'.Temperature', $s); }
Объекты класса:
Свойства класса:
Методы класса:
Объекты класса:
// раскидываем дату и время если изменилось в Windows onNewHour $h=(int)date('G',time()); if (gg('ThisComputer.DateD')!=date("d", time())) { $day[0]="воскресенье"; $day[1]="понедельник"; $day[2]="вторник"; $day[3]="среда"; $day[4]="четверг"; $day[5]="пятница"; $day[6]="суббота"; $month[1]="января"; $monthAlt[1]="ЯНВАРЬ"; $month[2]="февраля"; $monthAlt[2]="ФЕВРАЛЬ"; $month[3]="марта"; $monthAlt[3]="МАРТ"; $month[4]="апреля"; $monthAlt[4]="АПРЕЛЬ"; $month[5]="мая"; $monthAlt[5]="МАЙ"; $month[6]="июня"; $monthAlt[6]="ИЮНЬ"; $month[7]="июля"; $monthAlt[7]="ИЮЛЬ"; $month[8]="августа"; $monthAlt[8]="АВГУСТ"; $month[9]="сентября"; $monthAlt[9]="СЕНТЯБРЬ"; $month[10]="октября"; $monthAlt[10]="ОКТЯБРЬ"; $month[11]="ноября"; $monthAlt[11]="НОЯБРЬ"; $month[12]="декабря"; $monthAlt[12]="ДЕКАБРЬ"; sg("ThisComputer.DateD",date( "d", time())); sg("ThisComputer.DateM",date( "m", time())); sg("ThisComputer.DateY",date( "Y", time())); sg("ThisComputer.Date",date( "d.m.Y", time())); sg("ThisComputer.Day",$day[date("w")]); sg("ThisComputer.Month",$month[date("n")]); sg("ThisComputer.MonthAlt",$monthAlt[date("n")]); } getURL('http://localhost/modules/app_PostTracker/check_track.php',0);
$h=(int)date('G',time()); $m=date('i',time()); if (isWeekDay()) { } if (($h>=8) && getGlobal('clockChimeEnabled')) { if ($m=="00") { say(timeNow(),1); } } setGlobal('timeNow',date('H:i')); $homeStatus=date('H:i'); if (getGlobal('NobodyHomeMode.active')) { $homeStatus.=' Дома никого'; } else { $homeStatus.=' Дома кто-то есть'; } $homeStatus.=' '.getGlobal('Security.stateDetails'); $homeStatus.=' '.getGlobal('System.stateDetails'); $homeStatus.=' '.getGlobal('Communication.stateDetails'); setGlobal('HomeStatus',$homeStatus); $sunrise = date_sunrise(time(), SUNFUNCS_RET_STRING, 47.233183, 39.718849, 90+50/60, 3); $sunset = date_sunset(time(), SUNFUNCS_RET_STRING, 47.233183, 39.718849, 90+50/60, 3); setGlobal ('ThisComputer.SunSetTime',$sunset); setGlobal ('ThisComputer.SunRiseTime',$sunrise); $lat=gg('Coordinates.latitude'); // широта 55.553964 $long=gg('Coordinates.longitude'); // долгота 39.7191 $sun_info = date_sun_info(time(), $lat, $long); foreach ($sun_info as $key => $val) { if ($key == 'sunrise') { $sunrise = $val; echo 'Восход: '.date("H:i", $sunrise).'<br>'; setGlobal('Sun.SunRiseTime',date("H:i:s", $sunrise)); } if ($key == 'sunset') { $sunset = $val; $day_length = $sunset - $sunrise; echo 'Заход: '.date("H:i", $sunset).'<br>'; echo 'Долгота дня: '.gmdate("H:i", $day_length).'<br>'; setGlobal('Sun.SunSetTime',date("H:i:s", $sunset)); setGlobal('Sun.LongTag',gmdate("H:i:s", $day_length)); } if ($key == 'transit') { echo 'В зените: '.date("H:i", $val).'<br>'; setGlobal('Sun.Transit',date("H:i:s", $val)); } if ($key == 'civil_twilight_begin') { echo 'Начало утренних сумерек: '.date("H:i", $val).'<br>'; setGlobal('Sun.civil_begin',date("H:i:s", $val)); } if ($key == 'civil_twilight_end') { echo 'Конец вечерних сумерек: '.date("H:i", $val).'<br>'; setGlobal('Sun.civil_end',date("H:i:s", $val)); } } if (timeBetween(getGlobal('SunRiseTime'),getGlobal('SunSetTime')) && getGlobal('isDark')=="1") { setGlobal("isDark",0); callMethod('DarknessMode.deactivate'); } elseif (!timeBetween(getGlobal('SunRiseTime'),getGlobal('SunSetTime')) && getGlobal('isDark')!="1") { setGlobal("isDark",1); callMethod('DarknessMode.activate'); } if (timeIs(getGlobal('SunRiseTime'))) { say('Всходит солнце'); } if (timeIs(getGlobal('SunSetTime'))) { say('Солнце заходит',2); } // получем ЧАСЫ и МИНУТЫ отдельно $timeH=date("H", time()); $timeM=date("i", time()); sg("ThisComputer.timeH",$timeH); sg("ThisComputer.timeM",$timeM); runScript('timer_2s'); //Выключение света через 3 минуты после окончания утренних сумерек if (timeBetween('3:00','10:00')) { $SunCB=timeConvert(gg('Sun.civil_begin')); if (timeIs(date('H:i', $SunCB+180))) { say('Свет на улице выключен',1); getURL('http://192.168.8.175/gpio?st=0&pin=12&flash=0', 0); } } // Включение света за 3 минуты до начала вечерних сумерек if (timeBetween('16:00','22:00')) { $SunCE=timeConvert(gg('Sun.civil_end')); if (timeIs(date('H:i', $SunCE-180))) { say('Свет на улице включен',1); getURL('http://192.168.8.175/gpio?st=1&pin=12&flash=1', 0); } } if (timeIs('22:00')) { callMethod('NightMode.activate'); } elseif (timeIs('07:00')) { callMethod('NightMode.deactivate'); }
Свойства класса:
Методы класса:
if ($params['OLD_VALUE']>$params['NEW_VALUE']) { brLinkCommand('tv_volume down'); } else { brLinkCommand('tv_wolume up'); }
Объекты класса:
Методы класса:
Объекты класса:
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']); } }
Свойства класса:
Методы класса:
$Coordinates=$this->getProperty("Coordinates"); $lat=substr($Coordinates,0,strpos($Coordinates,",")); $lon=substr($Coordinates,strpos($Coordinates,",")+1); $this->setProperty("Location",Getgeocode($lon,$lat));
// Если ночь и кто-то дома то не оповещать $night=getGlobal("NightMode.active"); $nobody=getGlobal("NightMode.active"); if (($night == 0) && ($nobody != 0)){ return; } //$this->callMethod("SendEMail", $params); //$this->callMethod("SendSMS", $params);
$this->setProperty("isHome", 0);
Объекты класса:
Свойства класса:
Объекты класса:
Методы класса:
include_once(DIR_MODULES."app_yatraffic/app_yatraffic.class.php"); $app_yatraffic=new app_yatraffic(); $app_yatraffic->get_traffic(gg("yt_settings.reg_id"));
Объекты класса:
Свойства класса:
Ростов на Дону, Россия
На форуме: Slavik398
© 2023 - Site Built By SergeJey | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving