Свойства класса:
Методы класса:
$url = 'http://192.168.1.210/acoff'; get_headers($url);
//$t1 = gg('sensorTable.temp'); $t = gg('sensorBed.temp'); //$t = $t1 + $t2; //$t = $t/2; $t = $t*9/5+32; sg('AC_1.avTemp',$t); $h = gg('HumidityBed.humidity'); $hi = 0-42.379; $hi = $hi+($t*2.04901523); $hi = $hi+($h*10.14333127); $hi = $hi-($t*$h*0.22475541); $hi = $hi-(($t*$t)*6.83783E-3); $hi = $hi-(($h*$h)*5.481717E-2); $hi = $hi+(($t*$t)*$h*1.22874E-3); $hi = $hi+($t*($h*$h)*8.5282E-4); $hi = $hi-(($t*$t)*($h*$h)*1.99E-6); //определяем тепловой индекс $hi = ($hi-32)*5/9; //конвертируем обратно в гр. цельсия. Так привычнее $hi = round($hi,1); sg('AC_1.address', $hi); $ts = gg('AC_1.standartTemp'); //сравниваем температуру с эталоном и решаем что делать дальше if ($hi <= $ts) { say('Что-то очень холодно. Включаю кондиционер на нагрев'); cm('AC_1.AC_Heat'); } sg('AC_1.address',$hi);
Объекты класса:
Методы класса:
Объекты класса:
$br = getGlobal('LightAlarm.Brightness'); //тут берём яркость if ((getGlobal("LightAlarm.Switch") == 1)) { //будильник включен? if ((getGlobal('LightAlarm.Run') == 1) and $br<101) { //наше время пришло? Тогда поехали! sg('LightAlarm.on', 1); //говорим системе, что сейчас будильник активен sg("LED.Coeff", 1);//даём команду на включение //sg('LEDnode.Switch', 1); //включаем выключатель света setGlobal("LED.Brightness", $br); //меняем яркость $br = $br+1; setGlobal('LightAlarm.Brightness',$br); callMethod("LED.Start"); clearTimeOut("alarmTimer"); SetTimeOut("alarmTimer",'callMethod("LightAlarm.Start");',1*6); //считаем кулдаун } else { sg('LightAlarm.on', 0); //а здесь говорим, что работу закончили sg('LightAlarm.Run', 0); setGlobal('LightAlarm.Brightness',0); //яркость по нулям clearTimeOut("alarmTimer"); //очищаем таймер say('Цикл будильника завершён'); //мяукаем } } else { sg('LightAlarm.on', 0); //аналогично предыдущему setGlobal('LightAlarm.Brightness',0); //яркость по нулям clearTimeOut("alarmTimer"); //очищаем таймер sg('LightAlarm.Run', 0); say('Будильник выключен'); //мяукаем }
Свойства класса:
Методы класса:
$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); runScript('iiiBot', array('message'=>$command)); }
Свойства класса:
Методы класса:
$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);
$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);
Объекты класса:
$temp = gg('sensorEnvironment.temp')*10; $hum = gg('HumidityEnvironment.humidity')*10; $light = gg('sensorLight.percent')*10; echo "YES12321"; echo "Start"; echo $temp; echo "#"; echo $hum; echo "#"; echo $light;
Методы класса:
Объекты класса:
$left = gg('RollerBlinds.FlapLeft'); //первой идёт инфа о левой створке, потом о правой $right = gg('RollerBlinds.FlapRight'); echo "Left"; echo $left; echo "#"; echo "Right"; echo $right; echo "#"; //say("meow");
Свойства класса:
Методы класса:
//$params['t'] $this->setProperty("updated",time()); $this->setProperty("updatedTime",date("H:i",time())); $this->setProperty("alive",1); $t=round($params['humidity'],1); $this->setProperty('humidity',$t); $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 (gg("HumidityEnvironment.alive")==0) { $nr="Не отвечает"; sg("HumidityEnvironment.humidity",$nr); }
if (gg("HumidityBed.alive")==0) { $nr="Не отвечает"; sg("HumidityBed.humidity",$nr); }
Свойства класса:
Методы класса:
$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);
Объекты класса:
if (gg("sensorDoor.status") == 1) { sg("sensorDoor.stateColor",green); } else { sg("sensorDoor.stateColor",red); }
Свойства класса:
Методы класса:
$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 (gg('MovementSensor1.Switch') > 0 and gg('LEDnode.Auto') == 1) { //если считывание датчика включено if(getGlobal("MovementSensor1.motionDetected")>0) { //и он заметил движение callMethod("LEDnode.Start"); //дёргаем за наш узел } } /* $CD = getGlobal('MovementSensor1.CoolDown'); if(getGlobal("MovementSensor1.motionDetected")>0) //and (getGlobal("AutoLight.AutoOn") == 1) { if ((gg('MovementSensor1.Switch') == 1) and (gg("LED_Button.Status")) == 0) { sg("MovementSensor1.Coeff","1"); callMethod("LED.Run"); clearTimeOut("myroomLight"); SetTimeOut("myroomLight",'sg("MovementSensor1.Coeff","0.1"); callMethod("LED.Run"); say("Начальник вышел куда-то...");',$CD*60); } else { sg("MovementSensor1.Coeff","1"); clearTimeOut("myroomLight"); // callMethod("LED.Run"); } } */
Свойства класса:
Методы класса:
$this->setProperty('status',$params['status']); // выставляем статус сенсора $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['s'])) { return; } $old_temp=$this->getProperty('status'); $t=round($params['s'],1); if ($t>110) return; $this->setProperty('status',$t); if ($params['uptime']) { $this->setProperty('uptime',$params['uptime']); }
Объекты класса:
echo exec('noolitepc -api -sw_ch 3');
echo exec('noolitepc -api -sw_ch 1');
//if (gg('LEDnode.Switch') == 1) { //раз нас вызвали, проверяем горит ли свет и если не горит, то $Slider = gg('LEDnode.Slider'); sg("LED.Brightness",$Slider); //задаём яркость как указано в меню callMethod("LED.Start"); //и включаем свет if (gg("LEDnode.Auto") == 1 and gg('LightAlarm.on') == 0) { //если у нас включен учёт датчиков движения и выключен будильник $CD = gg('LEDnode.cooldown'); //берём время кулдауна if(gg("MovementSensor1.motionDetected")>0) { //и если заметили движение // if (gg('MovementSensor1.Switch') == 1) { //управление конкретным датчиком движения. Можно отключить ненужные sg("LED.coeff","1"); //ставим коэффициент callMethod("LED.Start"); //и включаем свет clearTimeOut("myroomLight"); //начинаем отсчёт до кулдауна, а как досчитали, ставим коэффициент на 0.1, включаем свет SetTimeOut("myroomLight",'sg("LED.Coeff","0.1"); callMethod("LED.Start"); say("В комнате пусто");',$CD*60); //и мяукаем :) //} } } else { sg("LED.Coeff","1"); //ну а если автосвет выключен, то clearTimeOut("myroomLight"); //чистим таймер //callMethod("LED.Run"); //и включаем свет } /*} else { //если свет горит, то sg("LED.Brightness",0); //яркость в ноль callMethod("LED.Start"); //и выключаем его } */
$bright = getGlobal('LED.Brightness')*gg('LED.Coeff'); $bright = $bright; $bright = $bright/100; $x = getGlobal('LED.Red') * $bright; $y = getGlobal('LED.Green') * $bright; $z = getGlobal('LED.Blue') * $bright; $x = 256-$x; $x = round($x); sg('LED.r', $x); $y = 256-$y; $y = round($y); sg('LED.g', $y); $z = 256-$z; $z = round($z); sg('LED.b', $z); $a = "-$x -$y -$z"; if ($x < 256 or $y < 256 or $z < 256) { echo exec('noolitepc -api -set_color_ch 2 '.$a); } else { echo exec('noolitepc -api -off_ch 2'); }
echo exec('noolitepc -api -sw_ch 4');
Свойства класса:
Методы класса:
$this->setProperty("updated",time()); $this->setProperty("updatedTime",date('H:i')); if ($this->getProperty('active')) { say("Режим ".$this->getProperty('title')." активирован."); } else { say("Режим ".$this->getProperty('title')." выключен."); }
$this->setProperty('active',1);
$this->setProperty('active',0);
Объекты класса:
setGlobal('minMsgLevel','2');
setGlobal('minMsgLevel','1');
Свойства класса:
Методы класса:
$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 (gg("SensorCurrent.status") <= 8) { sg("LEDnode.Switch", 0); // cm("LEDnode.Start"); } else { sg("LEDnode.Switch", 1); //cm("LEDnode.Start"); }
$t = gg('sensorLight.status'); $percent = ($t*100)/1024; $percent = 100-$percent; $percent = round($percent, 1, PHP_ROUND_HALF_UP); sg('sensorLight.percent', $percent); if (gg("sensorLight.alive")==0) { $nr="Не отвечает"; sg("sensorLight.percent",$nr); }
$status = gg("transmission.status"); if ( $status == "stop") { say("В сети кто-то есть. Останавливаю торрент"); } elseif ($status == "start") { say("В сети никого. Запускаю торрент"); }
Свойства класса:
Методы класса:
$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);
Свойства класса:
Методы класса:
$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 rcon$code1:$code2;"); $this->setProperty("status",1);
$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);
Свойства класса:
Методы класса:
$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");
Объекты класса:
Методы класса:
Объекты класса:
global $voicemode; $voicemode='off'; processCommand($params['message']);
echo "status received: ".$params['status'];
Свойства класса:
Методы класса:
Объекты класса:
$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','watchfolders'=>'watch folders','rss'=>'RSS'); 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'); }
$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; 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'); }
Свойства класса:
Методы класса:
//$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); }
Объекты класса:
/* $bat_temp = gg('sensorHB.temp'); $t1 = gg('sensorTable.temp'); $t2 = gg('sensorBed.temp'); $av_temp = $t1 + $t2; $av_temp = $av_temp/2; if ($bat_temp > $av_temp) { //проверяем включено ли отопление и сообщаем об этом sg('sensorHB.On', true); } else { sg('sensorHB.On', false); } */ if (gg("sensorHB.alive")==0) { $nr="Не отвечает"; sg("sensorHB.temp",$nr); }
$t = gg('sensorBed.temp'); $t = $t*9/5+32; sg('AC_1.avTemp',$t); $h = gg('HumidityBed.humidity'); $hi = 0-42.379; $hi = $hi+($t*2.04901523); $hi = $hi+($h*10.14333127); $hi = $hi-($t*$h*0.22475541); $hi = $hi-(($t*$t)*6.83783E-3); $hi = $hi-(($h*$h)*5.481717E-2); $hi = $hi+(($t*$t)*$h*1.22874E-3); $hi = $hi+($t*($h*$h)*8.5282E-4); $hi = $hi-(($t*$t)*($h*$h)*1.99E-6); //определяем тепловой индекс //sg('sensorBed.heatindex', $hi); $hi = $hi-32; $hi = $hi*5; $hi = $hi/9; //конвертируем обратно в гр. цельсия. Так привычнее $hi = round($hi,1); sg('sensorBed.heatindex', $hi); runScript("AC_start"); if (gg("sensorBed.alive")==0) { $nr="Не отвечает"; sg("sensorBed.temp",$nr); }
if (gg("sensorTable.alive")==0) { $nr="Не отвечает"; sg("sensorTable.temp",$nr); }
if (gg("sensorKitchen.alive")==0) { $b="Не отвечает"; sg("sensorKitchen.temp",$b); }
Свойства класса:
Методы класса:
Объекты класса:
$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); 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); } if (timeIs("23:30") && (gg("EconomMode.active")!="1") && (gg("NobodyHomeMode.active")=="1")) { say("Похоже никого нет сегодня, можно сэкономить немного."); callMethod('EconomMode.activate'); } if (timeIs('20:00')) { callMethod('NightMode.activate'); } elseif (timeIs('08:00')) { callMethod('NightMode.deactivate'); } if (timeIs("03:00")) { runScript("systemMaintenance"); } if (gg('ThisComputer.AlarmStatus') && timeIs(gg('ThisComputer.AlarmTime'))) { runScript('MorningAlarm'); } //будильник $checktime = getGlobal("LightAlarm.StartTime"); if ((getGlobal("LightAlarm.Switch") == 1)) { if(timeIs($checktime)){ //если будильник включен и время совпало setGlobal('LightAlarm.Run',true);//запустим отсчёт say("Будильник запущен"); callMethod("LightAlarm.Start"); } } //мониторинг работы сервера runScript("serverMonitor");
Методы класса:
Объекты класса:
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']); } }
Свойства класса:
Объекты класса:
, Беларусь
© 2024 - Site Built By SergeJey | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving