Свойства класса:
Методы класса:
// Установка времени срабатывания последнего будильника setGlobal("ThisComputer.lastalarm", time());
Объекты класса:
// Запоминаем состояние громкости $cur_vol=gg('ThisComputer.volumeLevel'); // Меняем громкость $vol=gg("SchoolAlarm.AlarmVol"); callMethod('ThisComputer.VolumeLevelChanged', array('VALUE'=>$vol)); sleep(5); // Говорим сообщение say(gg('SchoolAlarm.AlarmText'),5); // Say Say(timeNow()." Нужно собираться в школу. Выход через 45 минут",5); // Напоминалки 15 мин setTimeOut('school15', 'say(timeNow()." через 30 мин выходить",5);', 15*60); // Напоминалки 30 мин setTimeOut('school30', 'say(timeNow()." через 15 мин выходить",5);', 30*60); // Напоминалки 35 мин setTimeOut('school35', 'say(timeNow()." через 10 мин выходить",5);', 35*60); // Напоминалки 40 мин setTimeOut('school40', 'say(timeNow()." через 5 мин выходить",5);', 40*60); // Напоминалки 45 мин setTimeOut('school45', 'say(timeNow()." Нужно выходить",5);', 45*60); // Возвращаем громкость SetTimeOut("AlarmOne_Volume","callMethod('ThisComputer.VolumeLevelChanged', (array('VALUE'=>$cur_vol)));", 46*60);
$mel=gg('AlarmOne.AlarmMel'); //Выключим будильник sg("AlarmOne.AlarmOn",0); // Запоминаем состояние громкости $cur_vol=gg('ThisComputer.volumeLevel'); // Меняем громкость $vol=gg("AlarmOne.AlarmVol"); callMethod('ThisComputer.VolumeLevelChanged', array('VALUE'=>$vol)); sleep(5); // все проснулись setGlobal("NightMode.active",0); //Говорим сообщение say(gg('AlarmOne.AlarmText'),5); //say($mel,5); if (strval($mel)==1){ //рассскажем про погоду SetTimeOut("AlarmOne_SayWeather",'runScript("readWeatherToday");', 80); //Включим радио //callMethod("Европа Плюс"); SetTimeOut("AlarmOne_RadioPlay",'runScript("Европа Плюс");', 2*60); //Добавим звук радио до 50 через 5 минут //SetTimeOut("AlarmOne_RadioZvuk",'sg("RadioSetting.VolumeLevel","50");', 60*5); //Добавим звук радио до 70 через 10 минут //SetTimeOut("AlarmOne_RadioZvuk",'sg("RadioSetting.VolumeLevel","70");', 60*10); //Скажем время SetTimeOut("AlarmOne_time",'say(timenow());', 60*15); //выключим радио через 25 минут SetTimeOut("AlarmOne_RadioStop",'callMethod("RadioSetting.controls","stop");', 60*25); } else{ playSound($mel.'.mp3');} // Возвращаем громкость SetTimeOut("AlarmOne_Volume","callMethod('ThisComputer.VolumeLevelChanged', (array('VALUE'=>$cur_vol)));", 60*30);
$mel=gg('AlarmWeekDay.AlarmMel'); // сегодня рабочий день if (isWeekDay()){ say('Пора вставать!',5); //say($mel,5); if (strval($mel)=='Radio'){ //Убавим звук радио до 30 // sg('RadioSetting.VolumeLevel','30'); //включить подсветку //1й уровень sg("Lenta.Red",58); sg("Lenta.Green",29);sg("Lenta.Blue",3); SetTimeOut("AlarmWeekDay_Lentaon_step1",'callMethod("Lenta.turnOn");', 60); //2й уровень sg("Lenta.Red",144); sg("Lenta.Green",73);sg("Lenta.Blue",9); SetTimeOut("AlarmWeekDay_Lentaon_step2",'callMethod("Lenta.turnOn");', 80); //3й уровень sg("Lenta.Red",234); sg("Lenta.Green",119);sg("Lenta.Blue",16); SetTimeOut("AlarmWeekDay_Lentaon_step3",'callMethod("Lenta.turnOn");', 90); //рассскажем про погоду SetTimeOut("AlarmWeekDay_SayWeather",'callMethod("погода на улице.action");', 80); //Включим радио //callMethod("RadioSetting.controls","play"); SetTimeOut("AlarmWeekDay_RadioPlay",'callMethod("RadioSetting.controls","play");', 2*60); //Добавим звук радио до 50 через 5 минут SetTimeOut("AlarmWeekDay_RadioZvuk",'sg("RadioSetting.VolumeLevel","50");', 60*5); //Добавим звук радио до 70 через 10 минут SetTimeOut("AlarmWeekDay_RadioZvuk2",'sg("RadioSetting.VolumeLevel","70");', 60*10); //Скажем время SetTimeOut("AlarmHoliday_time",'say(timenow());', 60*15); //выключим радио через 25 минут SetTimeOut("AlarmWeekDay_RadioStop",'callMethod("RadioSetting.controls","stop");', 60*25); } else{ playSound($mel.'.mp3');} }
$mel=gg('AlarmHoliday.AlarmMel'); // сегодня не рабочий день if (!(isWeekDay())){ say('Пора вставать!',5); //say($mel,5); if (strval($mel)=='Radio'){ //Убавим звук радио до 30 // sg('RadioSetting.VolumeLevel','30'); //включить подсветку //1й уровень sg("Lenta.Red",58); sg("Lenta.Green",29);sg("Lenta.Blue",3); SetTimeOut("AlarmWeekDay_Lentaon_step1",'callMethod("Lenta.turnOn");', 1*60); //2й уровень sg("Lenta.Red",144); sg("Lenta.Green",73);sg("Lenta.Blue",9); SetTimeOut("AlarmWeekDay_Lentaon_step2",'callMethod("Lenta.turnOn");', 1*60); //3й уровень sg("Lenta.Red",234); sg("Lenta.Green",119);sg("Lenta.Blue",16); SetTimeOut("AlarmWeekDay_Lentaon_step3",'callMethod("Lenta.turnOn");', 1*60); //рассскажем про погоду SetTimeOut("AlarmHoliDay_SayWeather",'callMethod("погода на улице.action");', 80); //Включим радио //callMethod("RadioSetting.controls","play"); SetTimeOut("AlarmHoliDay_RadioPlay",'callMethod("RadioSetting.controls","play");', 2*60); //Добавим звук радио до 50 через 5 минут SetTimeOut("AlarmHoliDay_RadioZvuk",'sg("RadioSetting.VolumeLevel","50");', 60*5); //Добавим звук радио до 70 через 10 минут SetTimeOut("AlarmHoliDay_RadioZvuk",'sg("RadioSetting.VolumeLevel","70");', 60*10); //Скажем время SetTimeOut("AlarmHoliDay_time",'say(timenow());', 60*15); //выключим радио через 25 минут SetTimeOut("AlarmHoliDay_RadioStop",'callMethod("RadioSetting.controls","stop");', 60*25); } else{ playSound($mel.'.mp3');} }
Свойства класса:
Методы класса:
$volume=round(65535*$params['VALUE']/100); $this->setProperty('volumeLevel',$params['VALUE']); safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume); say("Изменилась громкость до ".$params['VALUE']." процентов");
Объекты класса:
say("Подключено питание"); sg('ThisComputer.AC_adapter','on-line');
$last_register=registeredEventTime('smsRU_motion'); // проверяем когда в последний раз срабатывало событие "отправка смс" if ((gg('ThisComputer.security') == 1) && (time()-$last_register>60*60) && (gg('ThisComputer.smsRU_motion') != 1)) { registerEvent('smsRU_motion',$this->name,2); // регистрируем событие "отправка смс" say('smsRU_motion'); // запускаем скрипт "отправка смс" RunScript('smsRU_motion'); // запускаем скрипт "отправка смс" sg('ThisComputer.smsRU_motion',1); } else{}
say("Отключено питание"); sg('ThisComputer.AC_adapter','off-line');
$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('Задача принята',1); return; } global $voicemode; $voicemode='on'; say('Сейчас '.timeNow(),1); } 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('Задача принята',1); return; } global $voicemode; $voicemode='on'; say($m[1],2); } else { say('Неизвестная команда...',1); }
Свойства класса:
Методы класса:
$this->setProperty('LastRun',date('Y-m-d H:i:s'));
$name='Cron_'.$this->object_title; SQLExec("DELETE FROM jobs WHERE title='".$name."'");
Объекты класса:
RunScript('rotate_video');
Свойства класса:
Методы класса:
//$params["USER_OBJECT"]
//$params["USER_OBJECT"]
Объекты класса:
Свойства класса:
Методы класса:
/*$sayMetUSD = gg ("Sets.sayMetUSD"); if ($sayMetUSD) { say ("Читаю курсы валюты с ЦБ РФ",($sayMetUSD-2)); }*/ $file = simplexml_load_file("http://www.cbr.ru/scripts/XML_daily.asp?date_req=".date("d/m/Y")); if (!$file){ DebMes("CBR error"); return; } // USD $xml = $file->xpath("//Valute[@ID='R01235']"); $valute = strval($xml[0]->Value); $this->setProperty('USD', round(str_replace(",",".",$valute)*100)/100); // EURO $xml = $file->xpath("//Valute[@ID='R01239']"); $valute = strval($xml[0]->Value); $this->setProperty('EURO', round(str_replace(",",".",$valute)*100)/100); /* CZK (10 крон превращаем в 1 крону) $xml = $file->xpath("//Valute[@ID='R01760']"); $valute = strval($xml[0]->Value); $this->setProperty('CZK', round(str_replace(",",".",$valute)*10)/100); */ $this->setProperty("uptime",date("d.m.Y - H:i:s",time())); $this->setProperty("updatedTimestamp",time());
Объекты класса:
Свойства класса:
Методы класса:
if ($params['status']) { $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 ($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('motionDetected'); // проверяем когда в последний раз срабатывало событие "движение внутри дома" registerEvent('motionDetected',$this->name,2); // регистрируем событие "движение внутри дома" if (timeBetween('08:00', '12:00') && ((time()-$last_register)>2*60*60)) { runScript('Greeting'); // запускаем скрипт "доброе утро" } }
Объекты класса:
Свойства класса:
Объекты класса:
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
if ($this->getProperty("active")) $this->setProperty("active",0); else $this->setProperty("active",1);
$this->setProperty('active',1);
$this->setProperty('active',0);
/* Объекты могут быть двух типов. 1 Переключатель - имеет только один настраиваемый метод modeChanged. Свойство Status указывает на режим. 2 Выключатель - имеет настраиваемые методы activate и deactivate. Свойство Status может быть = 0 или 1. Оба типа существуют одновременно. Для изменения вызов метода modeChanged с указанием параметра status либо линком этого свойства. Для типа Выключатель можно сразу просто вызывать методы activate и deactivate. */ /* $s=$params['status']; if (isset($s)) { // Записать в свойство объекта при его передаче в параметре $this->setProperty('status',$s); } else { // Для слинкованных свойств наоборот взять значение из объекта $s = $this->getProperty('status'); } // Вызов метода if ($s) { $this->callMethod('activate'); } else { $this->callMethod('deactivate'); } */ $this->setProperty("updated",time()); $this->setProperty("updatedTime",date('H:i d.m.Y.')); if ($this->getProperty('active')) { say("Режим ".$this->getProperty('title')." активирован."); //$this->setProperty('status',1); $this->setProperty('statustxt','on'); } else { say("Режим ".$this->getProperty('title')." выключен."); $this->setProperty('status',0); $this->setProperty('statustxt','off'); }
Объекты класса:
setGlobal('minMsgLevel','1'); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nightmode_deactivate.php'); /* end injection of {SDevices} */
setGlobal('minMsgLevel','2'); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nightmode_activate.php'); /* end injection of {SDevices} */
sg('Switch_5_1.auto_off ',120); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/darknessmode_activate.php'); /* end injection of {SDevices} */
sg('Switch_5_1.auto_off ',''); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/darknessmode_deactivate.php'); /* end injection of {SDevices} */
$status=$this->getProperty("status"); if ($status) { //$this->callMethod('activate'); say('У вас есть две минуты, чтобы покинуть квартиру. Квартира будет взята под охрану.',5); setTimeOut("Ohrana60","say('Осталась одна минута. Квартира будет взята под охрану.',5);", 1*60); setTimeOut("Ohrana120","sg('SecurityArmedMode.active',1);", 2*60); } else { $this->callMethod('deactivate'); }
sg('ThisComputer.security',0); sg('ThisComputer.smsRU_motion',0); sg("ThisComputer.screen",1); rs('Stop_Motion'); ClearTimeOut("Backup"); ClearTimeOut("Ohrana60"); ClearTimeOut("Ohrana120"); if (gg("NightMode.active")){ sg("ThisComputer.minMsgLevel",2); }else{ sg("ThisComputer.minMsgLevel",1); }
RunScript('smsRU_Security'); //say('Режим охраны включен.',5); sg("ThisComputer.screen",0); sg("ThisComputer.minMsgLevel",3); rs('Start_Motion'); rs('filesClearOld');
//ClearTimeOut("Security"); //SetTimeOut("Security","callMethodSafe('SecurityArmedMode.activate');", 1*60*60); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_activate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_deactivate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_updateActivityStatus.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/econommode_deactivate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/econommode_activate.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
$ol = $this->getProperty('online'); switch ($ol) { case 0: $this->setProperty('online_color','DimGray'); break; case 1: $this->setProperty('online_color','green'); break; case 2: $this->setProperty('online_color','red'); break; }
$GA_ot = $this->object_title; $GA_ip = $this->getProperty("IPint"); $GA_port = $this->getProperty("port"); $GA_online = $this->getProperty("online"); $GA_ol_color = $this->getProperty("online_color"); $GA_doit = gg('Sets.GA_cmd_txt'); switch ($GA_online) { // для fa case 0: $fa1 = "question-"; break; case 1: $fa1 = "check-"; break; case 2: $fa1 = "times-"; break; default: // вообще, сюда попасть мы не должны $fa1 = ""; } $str = '<i class="fa fa-'.$fa1.'circle" aria-hidden="true" style="color:'.$GA_ol_color.';"></i> <b>'.$GA_ot.'</b>'; $timeGA = 'Время и дата выполнения: <span style="float: right;"><b>'.date( "H:i:s - d.m.Y", time()).'</span></b>'; // проверим - это специальная команда выводящая список команд из файла GetAdmin.ini или нет ? if ($GA_doit != '*') { // нет это не спец.команда, это команда из программы GetAdmin $GA_cmd = str_ireplace("-", "=", $GA_doit); $str = $str.'<span style="float: right;"><b>'.$GA_cmd.'</b></span><br>'; $str = $str.$timeGA.'<hr>'; if (preg_match("/(key=[A-Z0-9+]+$)|(cmd=[a-zA-Z0-9_]+$)|(chk=[a-zA-Z0-9+-_]+$)/", $GA_cmd)) { // через рег.выражения выявим ошибки синтаксиса $provresult = getURL('http://'.$GA_ip.':'.$GA_port.'/?chk=GetAdmin', 0); // проверим выполив заведомо имеющейся командой $result = false; if ($provresult != false) { $result = getURL('http://'.$GA_ip.':'.$GA_port.'/?'.$GA_cmd, 0); // выполним только если проверка была успешной } if ($result == false) { // проверим - а вообще мы получили ответ? switch ($GA_online) { // проверим варианты с учетом online/offline терминала case 0: if ($provresult == false) { $str = $str.'<font size="+1" color="red">Не выполнено!</font><br>'; $str = $str.'Возможные причины:<br>'; $str = $str.'- нет доступа по сети к <b>'.$GA_ot.'</b>;<br>'; $str = $str.'- GetAdmin на <b>'.$GA_ot.'</b> не запущен;<br>'; $str = $str.'- настройки доступа к GetAdmin ошибочны.<br>'; } elseif (($GA_cmd != 'cmd=reboot') && ($GA_cmd != 'cmd=shutdown') && ($GA_cmd != 'cmd=sleep')) { // если это не команды которые не успевают дать ответ $str = $str.'<font size="+1" color="red">Не выполнено!</font><br>'; $str = $str.'Возможные причины:<br>'; $str = $str.'- команда <b>'.$GA_cmd.'</b> отсутствует на <b>'.$GA_ot.'</b>.<br>'; } else { $str = $str.'<font size="+1" color="lime">Вероятно выполнено!</font><br>'; $str = $str.'При выполнении команды: <b>'.$GA_cmd.'</b><br>'; $str = $str.'ответа от сервера нет, проведите проверку позднее.<br>'; } break; case 1: if ($provresult == false) { $str = $str.'<font size="+1" color="red">Не выполнено!</font><br>'; $str = $str.'Возможные причины:<br>'; $str = $str.'- GetAdmin на <b>'.$GA_ot.'</b> не запущен;<br>'; $str = $str.'- настройки доступа к GetAdmin ошибочны.<br>'; } elseif (($GA_cmd != 'cmd=reboot') && ($GA_cmd != 'cmd=shutdown') && ($GA_cmd != 'cmd=sleep')) { // если это не команды которые не успевают дать ответ $str = $str.'<font size="+1" color="red">Не выполнено!</font><br>'; $str = $str.'Возможные причины:<br>'; $str = $str.'- команда <b>'.$GA_cmd.'</b> отсутствует на <b>'.$GA_ot.'</b>.<br>'; } else { $str = $str.'<font size="+1" color="lime">Вероятно выполнено!</font><br>'; $str = $str.'При выполнении команды: <b>'.$GA_cmd.'</b><br>'; $str = $str.'ответа от сервера нет, проведите проверку позднее.<br>'; } break; case 2: if ($provresult == false) { $str = $str.'<font size="+1" color="red">Не выполнено!</font><br>'; $str = $str.'Возможные причины:<br>'; $str = $str.'- нет доступа по сети к <b>'.$GA_ot.'</b>;<br>'; } elseif (($GA_cmd != 'cmd=reboot') && ($GA_cmd != 'cmd=shutdown') && ($GA_cmd != 'cmd=sleep')) { // если это не команды которые не успевают дать ответ $str = $str.'<font size="+1" color="red">Не выполнено!</font><br>'; $str = $str.'Возможные причины:<br>'; $str = $str.'- команда <b>'.$GA_cmd.'</b> отсутствует на <b>'.$GA_ot.'</b>.<br>'; } else { $str = $str.'<font size="+1" color="lime">Вероятно выполнено!</font><br>'; $str = $str.'При выполнении команды: <b>'.$GA_cmd.'</b><br>'; $str = $str.'ответа от сервера нет, проведите проверку позднее.<br>'; } break; default: // вообще, сюда попасть мы не должны echo "ошибка в режиме онлайн!"; } } else { // данные (ответ) получаем, сформируем их $str = $str.iconv ("CP1251", "UTF-8", $result); $str = str_ireplace("<html>", "",$str); $str = str_ireplace("</html>", "",$str); $str = str_ireplace("<p>", "<br>",$str); $str = str_ireplace("</p>", "<br>",$str); $str = ($GA_cmd == "cmd=process") ? str_ireplace(";", "; ",$str) : $str; } } else { // регулярные выражения выявили ошибку $str = $str.'<font size="+1" color="red">Не выполнено!</font><br>'; $str = $str.'Причина: ошибка синтаксиса! => '.$GA_cmd; } $this->setProperty('GA_result', $str); // записываем в свой объект sg("Sets.GA_result", $str); // записываем для меню } else { // да, это спец.команда $str = $str.'<span style="float: right;"><b>из GetAdmin.ini</b></span>'; $str = $str.'<br>'.$timeGA; if (file_exists('\\\\'.$GA_ip.'\\GetAdmin\\GetAdmin.ini')) { // проверим доступность файла GetAdmin.ini // файл доступен, формируем список команд из него $config = parse_ini_file('\\\\'.$GA_ip.'\\GetAdmin\\GetAdmin.ini',true); $count = $config[Properties][Count]; $max = $count * 4; foreach($config[Commands] as $key=>$object) { if (($object != "") && (strpos($key, "show") === false)) { if (strpos($key, "Command") !== false) { $str = $str.'<hr>'; $object = '<span style="cursor:pointer"><font size="+1" color="red" onclick = "ajaxSetGlobal(\'Sets.GA_cmd_txt\', \'cmd='.$object.'\');">'.$object.'</font></span>'; } $str = $str.'<font color="green">'.$key.'</font> = '.$object.'<br>'; } if (--$max <=0) break; } } else { // файл GetAdmin.ini не доступен, выясним причины $str = $str.'<hr>'; $provresult = getURL('http://'.$GA_ip.':'.$GA_port.'/?chk=GetAdmin', 0); // проверим выполив заведомо имеющейся командой switch ($GA_online) { // проверим варианты с учетом online/offline терминала case 0: case 2: $str = $str.'<font size="+1" color="red">Не выполнено!</font><br>'; $str = $str.'Возможные причины:<br>'; if ($provresult == false) { $str = $str.'- нет доступа по сети к <b>'.$GA_ot.'</b>;<br>'; $str = $str.'- GetAdmin на <b>'.$GA_ot.'</b> не установлен;<br>'; $str = $str.'- на <b>'.$GA_ot.'</b> GetAdmin не запущен;<br>'; $str = $str.'- настройки доступа к GetAdmin ошибочны.<br>'; } else { $str = $str.'- к папке GetAdmin на <b>'.$GA_ot.'</b> нет доступа;<br>'; $str = $str.'- GetAdmin на <b>'.$GA_ot.'</b> в другой папке.<br>'; } break; case 1: $str = $str.'<font size="+1" color="red">Не выполнено!</font><br>'; $str = $str.'Возможные причины:<br>'; if ($provresult == false) { $str = $str.'- GetAdmin на <b>'.$GA_ot.'</b> не установлен;<br>'; $str = $str.'- на <b>'.$GA_ot.'</b> GetAdmin не запущен;<br>'; $str = $str.'- настройки доступа к GetAdmin ошибочны.<br>'; } else { $str = $str.'- к папке GetAdmin на <b>'.$GA_ot.'</b> нет доступа;<br>'; $str = $str.'- GetAdmin на <b>'.$GA_ot.'</b> в другой папке.<br>'; } break; default: // вообще, сюда попасть мы не должны echo "ошибка в режиме онлайн!"; } } $this->setProperty('GA_result', $str); // записываем в свой объект sg("Sets.GA_result", $str); // записываем для меню }
Объекты класса:
Методы класса:
Объекты класса:
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); } /* begin injection of {app_radio} */ include_once(DIR_MODULES.'app_radio/app_radio.class.php'); $app_radio = new app_radio(); if(is_array($params)) { foreach($params as $key=>$value) { switch((string)$key) { case 'sta': $app_radio->change_station($params['sta'], $app_radio); break; case 'cmd': $app_radio->control($params['cmd']); break; case 'vol': $app_radio->set_volume($params['vol'], $app_radio); break; default: if($value == 'play' || $value == 'stop') $app_radio->control($value); elseif(strpos($value, 'vol') === 0) $app_radio->set_volume((int)substr($value, 3), $app_radio); elseif(strpos($value, 'sta:') === 0) $app_radio->change_station(substr($value, 4), $app_radio); } } } /* end injection of {app_radio} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_updateActivityStatus.php'); /* end injection of {SDevices} */
$this->setProperty('SomebodyHere',0); $this->callMethodSafe("updateActivityStatus"); ClearTimeOut("Security"); ClearTimeOut("nobodyHome"); SetTimeOut("nobodyHome","callMethodSafe('NobodyHomeMode.activate');", 1*60*60); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_onIdle.php'); /* end injection of {SDevices} */
ClearTimeOut("Security"); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_onActivity.php'); /* end injection of {SDevices} */
Объекты класса:
/*if (gg('Livingroom.TV_on ') == 1) { ClearTimeOut('Rostel_Hall'); setTimeOut('Rostel_Hall',"RunScript('Rostel_Hall');",5); }else{ }*/ setTimeOut('Rostel_Hall',"RunScript('Rostel_Hall');",5);
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_setUpdatedText.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_logicAction.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
if ($this->getProperty("status")) $this->setProperty("status",0); else $this->setProperty("status",1);
require(DIR_MODULES.'devices/SButtons_pressed.php');
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCameras_takeSeries.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCameras_updatePreview.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCameras_motionDetected.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCameras_takeSnapshot.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SControllers_turnOn.php');
require(DIR_MODULES.'devices/SControllers_turnOff.php');
require(DIR_MODULES.'devices/SControllers_switch.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_levelWorkUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_statusUpdated.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SDimmers_turnOn.php');
require(DIR_MODULES.'devices/SDimmers_turnOff.php');
require(DIR_MODULES.'devices/SDimmers_levelUpdated.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_switch.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_statusUpdated.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/SRGB_turnOn.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/SThermostats_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_enable.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_disable.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_tempDown.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_tempUp.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_valueUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_switchEnable.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCounters_refreshStats.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/SCounters_valueWorkUpdated.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_unblockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_alert.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_unblockSensor.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/SMotions_blockSensor.php'); /* end injection of {SDevices} */
Объекты класса:
$sc='<p align="center"> <iframe src="http://192.168.1.7:8800/Door_cam/snapshotfull.php" height="480" width="853"frameborder="no" allowtransparency></iframe></p>'; // Запоминаем состояние громкости $cur_vol=gg('ThisComputer.volumeLevel'); $vol=50; if (gg('MysensorsMotion02.status') == 1) { // Меняем громкость //callMethod('ThisComputer.VolumeLevelChanged', array('VALUE'=>$vol)); //sleep(5); // Включаем экран rs('Screen_on'); // Проигрываем мелодию //playSound('zvuk-dvernogo-zvonka'); playSound('zvonok-i-stuk-v-dver'); say("Вам звонят в дверь",2); // Отображаем видео на главной сцене sg('ThisComputer.StreamingCode',$sc); setTimeout("Zvonok_auto_off", "sg('ThisComputer.StreamingCode',' ');", 30); // Возвращаем громкость //clearTimeout("AlarmOne_Volume"); //SetTimeOut("AlarmOne_Volume","callMethod('ThisComputer.VolumeLevelChanged', (array('VALUE'=>$cur_vol)));", 10); }
if (timeOutExists('Switch_5_1auto_off')) { $auto_off=(gg('Switch_5_1.auto_off')*60); if (!$auto_off) { $auto_off=1*60*60; // 1 hours auto_off by default } ClearTimeOut('Switch_5_1auto_off'); setTimeout('Switch_5_1auto_off', 'setGlobal("Switch_5_1.status", 0);', $auto_off); }
//say("Движение зафиксировано",2); $updatedTime2 = $this->getProperty('updated2'); $passed2 = time() - $updatedTime2; $auto_off1=(gg('Switch_15_1.auto_off')*60); if (!$auto_off1) { $auto_off1=1*60*60; // 1 hours auto_off by default } $auto_off2=(gg('Switch_35_1.auto_off')*60); if (!$auto_off2) { $auto_off2=1*60*60; // 1 hours auto_off by default } $auto_off3=(gg('Switch_35_2.auto_off')*60); if (!$auto_off3) { $auto_off3=1*60*60; // 1 hours auto_off by default } if (gg('SecurityArmedMode.active') == 1) { say('Зафиксировано движение датчиком в Зале'); runScript("sendTelegram",array("user"=>'Admin',"msg"=>'Зафиксировано движение датчиком в Зале')); // отправка сообщения в Telegram //runScript('SendToNotifyEvents', array('text' => "Зафиксировано движение в Зале $date.")); // отправка сообщения в Viber //runScript('Screen_off'); sg('ThisComputer.security',1); sg('Switch_35_1.status',1); setTimeOut("Switch_35_1","sg('Switch_35_1.status',0);", 10*60); } elseif (gg('SecurityArmedMode.active')!= 1){ if ((gg('ThisComputer.screen') == 1) && ($passed2>=180)) { $this->setProperty('updated2',time()); runScript('Screen_on'); sg('ThisComputer.security',0); if (timeOutExists('Switch_15_1auto_off')) { ClearTimeOut('Switch_15_1auto_off'); setTimeout('Switch_15_1auto_off', 'setGlobal("Switch_15_1.status", 0);', $auto_off1); } if (timeOutExists('Switch_35_1auto_off')) { ClearTimeOut('Switch_35_1auto_off'); setTimeout('Switch_35_1auto_off', 'setGlobal("Switch_35_1.status", 0);', $auto_off2); } if (timeOutExists('Switch_35_2auto_off')) { ClearTimeOut('Switch_35_2auto_off'); setTimeout('Switch_35_2auto_off', 'setGlobal("Switch_35_2.status", 0);', $auto_off3); } if (timeOutExists('TV_Livingroom_auto_off')) { ClearTimeOut('TV_Livingroom_auto_off'); setTimeout('TV_Livingroom_auto_off', 'rs("TVon_Hall");', 30*60); } } }
if (timeOutExists('Switch_25_1auto_off')) { $auto_off=(gg('Switch_25_1.auto_off')*60); if (!$auto_off) { $auto_off=1*60*60; // 1 hours auto_off by default } ClearTimeOut('Switch_25_1auto_off'); setTimeout('Switch_25_1auto_off', 'setGlobal("Switch_25_1.status", 0);', $auto_off); } if (timeOutExists('TV_Bedroom_auto_off')) { ClearTimeOut('TV_Bedroom_auto_off'); setTimeout('TV_Bedroom_auto_off', 'rs("TVon_Bed");', 30*60); } if (gg('SecurityArmedMode.active') == 1) { say('Зафиксировано движение датчиком в Спальне'); runScript("sendTelegram",array("user"=>'Admin',"msg"=>'Зафиксировано движение датчиком в Спальне')); // отправка сообщения в Telegram //runScript('SendToNotifyEvents', array('text' => "Зафиксировано движение в Зале $date.")); // отправка сообщения в Viber sg('ThisComputer.security',1); sg('Switch_35_1.status',1); setTimeOut("Switch_35_1","sg('Switch_35_1.status',0);", 10*60); }
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_close.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_open.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_switch.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_statusUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenClose_unblockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenClose_blockSensor.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SOpenClose_statusUpdated.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_unblockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_alert.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_valueUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
Объекты класса:
//say("Метод чек стэйт кухня выполняется"); $value = $this->getProperty("ppm_r"); $oldvalue = $this->getProperty("oldvalue"); $difference = $value - $oldvalue; $this->setProperty('difference', $difference); $this->setProperty('oldvalue', $value); if ($difference >= 30){ if(gg('ThisComputer.alarm')!=1){ $volume = gg('ThisComputer.volumeLevel'); sg('ThisComputer.oldvolumeLevel',$volume); sg('ThisComputer.alarm',1); } rs('Gas_alarm',array("room"=>'кухню')); } if ($value>=130){ $this->setProperty('stateColor',"red"); } elseif ($value>=90){ $this->setProperty('stateColor',"yellow"); } else{ $this->setProperty('stateColor',""); }
//say("Метод ппмрав выполняется"); $t = gg('TempIn.value'); $h = gg('HumIn.value'); $ppmRaw = gg('Air_Kitchen.value')*(1.30732 - 0.0116044 * $t) * (2.20591 - 0.296456 * log($h)); $ppm = Round($ppmRaw, 1); $this->setProperty('valueRAW',$ppm); // Смещение до реальных тиков $offset = $this->getProperty("offset"); if ($offset){ $val = $offset + $ppm; } $ppm_r = Round($val, 1); $this->setProperty('ppm_r', $ppm_r);
//say("Метод чек стэйт спальня выполняется"); $value = $this->getProperty("value"); $oldvalue = $this->getProperty("oldvalue"); $difference = $value - $oldvalue; $this->setProperty('difference', $difference); $this->setProperty('oldvalue', $value); if ($difference >= 40){ if(gg('ThisComputer.alarm')!=1){ $volume = gg('ThisComputer.volumeLevel'); sg('ThisComputer.oldvolumeLevel',$volume); sg('ThisComputer.alarm',1); } rs('Gas_alarm',array("room"=>'спальню')); } if ($value>=130){ $this->setProperty('stateColor',"red"); } elseif ($value>=90){ $this->setProperty('stateColor',"yellow"); } else{ $this->setProperty('stateColor',""); }
Свойства класса:
Методы класса:
//$params['h'] // иконки направления изменения $iconUp="fa fa-arrow-up"; $iconDown="fa fa-arrow-down"; $iconEqually="fa fa-exchange"; $this->setProperty("updated",time()); $this->setProperty("updatedTime",date("H:i",time())); $this->setProperty("alive",1); $this->setProperty("uptime",date("H:i - d.m.Y",time())); $h=$this->getProperty("value"); $ot=$this->object_title; $alive_timeout=(int)$this->getProperty("aliveTimeOut"); if (!$alive_timeout) { $alive_timeout=60*60; } clearTimeOut($ot."_alive"); setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout); $h=round($h,1); if (($h > 110) || ($h < -50)) return; // Получение среднего значения из истории //Получить id свойства $prop_id=$this->getPropertyByName('hum1', $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_t = 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_t=round($arr_t[AVG_V], 1); $this->setProperty('hum1',$h); //притягивание значения температуры для отображения индикатором $this->setProperty('humRoundProc',(round($h))); //$this->setProperty('hum',$h); if ($params['uptime']) { $this->setProperty('uptime',$params['uptime']); } if (abs($avg_t-$h)>=0.3) { if ($h>$avg_t) { $d=1; } else { $d=-1; }} else { $d=0; } $this->setProperty('direction',$d); $linked_room=$this->getProperty("LinkedRoom"); if ($linked_room) { setGlobal($linked_room.'.Humidity',$h); } $this->setProperty('direction',$d); if ($d==1) { $this->setProperty('direction_icon',$iconUp); } else if ($d==-1) { $this->setProperty('direction_icon',$iconDown); } else if ($d==0) { $this->setProperty('direction_icon',$iconEqually); } $val = $this->getProperty('hum1'); // Смещение до реальных тиков $offset = $this->getProperty("offset"); if ($offset){ $val = $offset + $val; } $hum = Round($val, 3); $this->setProperty('hum_r', $hum);
Объекты класса:
Свойства класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SPowerSensors_valueUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SPowerSensors_loadStatusChanged.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/*$t=$this->getProperty('value'); $d=$this->getProperty('direction'); if ($t>=750) { if (((round($t)/5)==round(round($t)/5) && $d!=0) || ($t>750)) { if ($d>0) { say('Атмосферное давление выше нормы',1); } else { say('Атмосферное давление в норме',1); } } }*/
Объекты класса:
//$params['p'] //say("Метод иконки направления выполняется"); // иконки направления изменения $iconUp="fa icon-up"; $iconDown="fa icon-down"; $iconEqually="fa icon-exchange"; $p=$this->getProperty("value"); $p=round($p,1); if (($p > 1000) || ($p < 0)) return; // Получение среднего значения из истории //Получить id свойства $prop_id=$this->getPropertyByName('value', $this->class_id, $this->id); //Получаем VALUE_ID для следующей таблицы $pvalue=SQLSelectOne("SELECT * FROM pvalues WHERE PROPERTY_ID='".$prop_id."' AND OBJECT_ID='".$this->id."'"); //Получаем средние значения давления за последние 60 минут $start_time=time()-60*60; // 60 минут $arr_t = 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_t=round($arr_t [AVG_V], 1); if (abs($avg_t-$p)>=0.1) { if ($p>$avg_t) { $d=1; } else { $d=-1; }} else { $d=0; } $linked_room=$this->getProperty("LinkedRoom"); if ($linked_room) { setGlobal($linked_room.'.Pressure',$p); } $this->setProperty('direction',$d); if ($d==1) { $this->setProperty('direction_icon',$iconUp); } else if ($d==-1) { $this->setProperty('direction_icon',$iconDown); } else if ($d==0) { $this->setProperty('direction_icon',$iconEqually); } $val = $this->getProperty("value"); // Смещение до реальных тиков $offset = $this->getProperty("offset"); if ($offset){ $val = $offset + $val; } $press = Round($val, 1); $this->setProperty('press_r', $press); //$this->callMethod('pressWarning');
Свойства класса:
Методы класса:
//$params['t'] // иконки направления изменения $iconUp="fa fa-arrow-up"; $iconDown="fa fa-arrow-down"; $iconEqually="fa fa-exchange"; $this->setProperty("updated",time()); $this->setProperty("updatedTime",date("H:i",time())); $this->setProperty("alive",1); $this->setProperty("uptime",date("H:i - d.m.Y",time())); $t=$this->getProperty("value"); $ot=$this->object_title; $alive_timeout=(int)$this->getProperty("aliveTimeOut"); if (!$alive_timeout) { $alive_timeout=60*60; } clearTimeOut($ot."_alive"); setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout); $t=round($t,1); if (($t > 110) || ($t < -50)) return; // Получение среднего значения из истории //Получить id свойства $prop_id=$this->getPropertyByName('temp1', $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_t = 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_t=round($arr_t[AVG_V], 1); $this->setProperty('temp1',$t); //притягивание значения температуры для отображения индикатором $this->setProperty('tempRoundProc',(round($t*2.08))); if ($t>110) return; //$this->setProperty('temp',$t); if ($params['uptime']) { $this->setProperty('uptime',$params['uptime']); } if (abs($avg_t-$t)>=0.3) { if ($t>$avg_t) { $d=1; } else { $d=-1; }} else { $d=0; } $this->setProperty('direction',$d); $linked_room=$this->getProperty("LinkedRoom"); if ($linked_room) { setGlobal($linked_room.'.Temperature',$t); } $this->setProperty('direction',$d); if ($d==1) { $this->setProperty('direction_icon',$iconUp); } else if ($d==-1) { $this->setProperty('direction_icon',$iconDown); } else if ($d==0) { $this->setProperty('direction_icon',$iconEqually); } $val = $this->getProperty('temp1'); // Смещение до реальных тиков $offset = $this->getProperty("offset"); if ($offset){ $val = $offset + $val; } $temp = Round($val, 3); $this->setProperty('temp_r', $temp);
Объекты класса:
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_unblockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_alert.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_statusUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_mute-unmute.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_volume.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_stop.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_seekprevious.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_seeknext.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_previous.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_next.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_playUrl.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_urllist.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_playNextUrl.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_pause-unpause.php'); /* end injection of {SDevices} */
Свойства класса:
Объекты класса:
Методы класса:
Объекты класса:
echo "status received: ".$params['status'];
global $voicemode; $voicemode='off'; processCommand($params['message']);
Свойства класса:
Методы класса:
Объекты класса:
$details=array(); $red_state=0; $yellow_state=0; $green_state=0; $mlevel=0; $icon_1="icon-102"; $icon_2="icon-103"; $icon_3="icon-104"; if (gg('ThisComputer.minMsgLevel')>=2){ $red_state=1; $this->setProperty('icon',$icon_1); $details[]="Сообщения отключены"; } elseif (gg('ThisComputer.minMsgLevel')==1){ $green_state=1; $this->setProperty('icon',$icon_2); $details[]="Только важные сообщения"; } elseif (gg('ThisComputer.minMsgLevel')<=0){ $yellow_state=1; $this->setProperty('icon',$icon_3); $details[]="Все сообщения"; } if ($red_state){ $state='red'; $state_title=LANG_GENERAL_RED; $mlevel=3; } elseif ($yellow_state){ $state='yellow'; $state_title=LANG_GENERAL_YELLOW; $mlevel=2; } else { $state='lime'; $state_title=LANG_GENERAL_GREEN; $mlevel=2; } $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!='lime') { say ("Уровень проговаривания сообщений изменился на ".$state_title.". ".implode(". ",$details),$mlevel); } else { say("Уровень проговаривания сообщений восстановился на ".$state_title,$mlevel); } $this->callMethod('stateChanged');*/ }
$details=array(); $red_state=0; $yellow_state=0; if (!isOnline('Internet')) { $yellow_state=1; //say("Пункт второй",5); $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='lime'; $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!='lime') { 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 (!isOnline('Arduino_AMS')) { $red_state=1; $details[]="Нет доступа к управлению освещением."; } if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; } else { $state='lime'; $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!='lime') { say("Уровень системы управления освещением изменился на ".$state_title.". "); say(implode(" ",$details)); } else { say("Уровень системы управления освещением восстановился на ".$state_title.". "); } $this->callMethod('stateChanged'); }
$details=array(); $red_state=0; $yellow_state=0; $green_state=0; $mlevel=0; $icon_1="icon-84"; $icon_2="icon-85"; $icon_3="icon-86"; $icon_4="icon-87"; $icon_5="icon-88"; $icon_6="icon-89"; if (trim(gg('ThisComputer.AC_adapter'))=='off-line'){ if (gg('ThisComputer.Battery_Charge')<15){ $red_state=1; $this->setProperty('icon',$icon_1); $details[]="Критический уровень заряда батареи сервера"; } elseif ((gg('ThisComputer.Battery_Charge')>15)&&(gg('ThisComputer.Battery_Charge')<99)){ $yellow_state=1; $this->setProperty('icon',$icon_3); $details[]="Система работает на аккумуляторе"; } } elseif (trim(gg('ThisComputer.AC_adapter'))=='on-line'){ $green_state=1; $this->setProperty('icon',$icon_6); $details[]="Внешнее питание подключено"; } if ($red_state){ $state='red'; $state_title=LANG_GENERAL_RED; $mlevel=3; } elseif ($yellow_state){ $state='yellow'; $state_title=LANG_GENERAL_YELLOW; $mlevel=2; } else { $state='lime'; $state_title=LANG_GENERAL_GREEN; $mlevel=2; } $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!='lime') { say ("Уровень системы энергообеспечения изменился на ".$state_title.". ".implode(". ",$details),$mlevel); } else { say("Уровень системы энергообеспечения восстановился на ".$state_title,$mlevel); } $this->callMethod('stateChanged'); } /* // Отправить сообщения всем подписаным runScript(AlarmSend, array("value" => 'Communicate:'.implode(". ",$details), "level" => 2) ); } else { say("Энергостатус".LANG_GENERAL_RESTORED_TO." ".$state_title); // Отправить сообщения всем подписаным runScript(AlarmSend, array("value" => 'Communicate:Ok', "level" => 2) ); } $this->callMethod('stateChanged'); } */
$details=array(); $red_state=0; $yellow_state=0; $green_state=0; $mlevel=0; $icon_1="icon-92"; $icon_2="icon-93"; $icon_3="icon-94"; if (gg('SecurityArmedMode.active')==1){ if (gg('ThisComputer.security')!=1){ $red_state=1; $this->setProperty('icon',$icon_2); $details[]="Квартира принята под охрану"; } elseif (gg('ThisComputer.security')==1){ $yellow_state=1; $this->setProperty('icon',$icon_1); $details[]="Проникновение в квартиру"; } } elseif (gg('SecurityArmedMode.active')!=1){ $green_state=1; $this->setProperty('icon',$icon_3); $details[]="Охрана отключена"; } if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; $mlevel=3; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; $mlevel=2; } else { $state='lime'; $state_title=LANG_GENERAL_GREEN; $mlevel=2; } $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!='lime') { say(LANG_GENERAL_SECURITY_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title.".",$mlevel); say(implode(". ",$details),$mlevel); } else { say(LANG_GENERAL_SECURITY_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title,$mlevel); } $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."."; } } /* $objects=array('MotionSensor1'=>'Датчик движения 1','MotionSensor2'=>'Датчик движения 2','TempSensor01'=>'Датчик температуры','HumSensor01'=>'Датчик влажности'); foreach($objects as $k=>$v) { if (!gg($k.'.alive')) { $yellow_state=1; $details[]="Не обновляется ".$v.'.'; } } */ if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; } else { $state='lime'; $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!='lime') { 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} */
Свойства класса:
Методы класса:
Объекты класса:
$h=(int)date('G',time()); $m=date('i',time()); // Записываем текущее время sg('timeNow',date('H:i')); //будильник /*$objects=getObjectsByClass("AlarmClock"); foreach($objects as $obj) { // переберем все будильники в системе if ((getGlobal($obj['TITLE'].".AlarmStatus") == 1) && timeIs(getGlobal($obj['TITLE'].".AlarmTime"))){ //если будильник включен и время совпало callMethod($obj['TITLE'].".AlarmRun"); // выполним метод будильника } } */ //будильник модуль include_once(DIR_MODULES."app_alarmclock/app_alarmclock.class.php"); $app_alarmclock=new app_alarmclock(); $app_alarmclock->check_alarm(); /*// Проверка пользователей по IP $objects=getObjectsByClass("Users"); // переберем все объекты в класе foreach($objects as $obj) { $devices = getGlobal($obj['TITLE'].".deviceip"); $devarr = explode(";", $devices); foreach ($devarr as $device) { if (isOnline($device)){ callMethod($obj['TITLE'].".atHome"); break; } } } */ // Режимы $objects=getObjectsByClass("OperationalModes"); // переберем все объекты в класе foreach($objects as $obj) { // выполним метод callMethod($obj['TITLE'].".check"); } // Прибиваем таймер отключения TV, если TV уже выключен if (timeOutExists('TV_Livingroom_auto_off') && (gg("Livingroom.TV_on")=="1")) { ClearTimeOut('TV_Livingroom_auto_off'); } if (timeOutExists('TV_Bedroom_auto_off') && (gg("Bedroom.TV_on")=="1")) { ClearTimeOut('TV_Bedroom_auto_off'); } /*//Проверить необходимость этого кода if (timeIs("23:30") && (gg("EconomMode.active")!="1") && (gg("NobodyHomeMode.active")=="1")) { say("Похоже никого нет сегодня, можно сэкономить немного."); callMethod('EconomMode.activate'); } if ((timeIs("23:00") || timeIs("08:00")) && (gg("EconomMode.active")!="1")) { say("Похоже никого нет сегодня, можно сэкономить немного."); callMethod('EconomMode.activate'); } if (isWeekDay() && timeIs("17:00") && (gg("EconomMode.active")=="1")) { say("Скоро хозяева должны прийти с работы, разогреваюсь"); callMethod('EconomMode.deactivate'); } */ // Проговаривать время, каждый час if (timeBetween(getGlobal('NightModeEnd'),getGlobal('NightModeStart')) && getGlobal('clockChimeEnabled')) { if ($m=="00") { say(timeNow(),1); } } /* // HomeStatus $homeStatus=date('H:i'); // задаем точное время $nobody=gg('NobodyHomeMode.active'); // тут изменено if ($nobody==1) { $homeStatus.=' Дома никого.'; // в зависимости } elseif ($nobody==2) { $homeStatus.=' Все спят.'; // в зависимости } else { $homeStatus.=' Дома кто-то есть.'; // в зависимости } // у кого-то видел местоположение пользователя по gps выводят $homeStatus.=' '.gg('Security.stateDetails'); $homeStatus.=' '.gg('System.stateDetails'); $homeStatus.=' '.gg('Communication.stateDetails'); sg('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('Солнце заходит',1); } //Отключаем Алису на ночь if (timeIs(gg('NightModeStart'))) { callMethod('NightMode.activate'); } elseif (timeIs(gg('NightModeEnd'))) { callMethod('NightMode.deactivate'); } //Отключаем включение экрана Алисы ночью if (timeIs('00:00')) { sg("ThisComputer.screen",0); } elseif (timeIs('05:00')) { sg("ThisComputer.screen",1); } //Запускаем Обслуживание системы if (timeIs("03:30")) { runScript("systemMaintenance"); } // получем ЧАСЫ и МИНУТЫ отдельно $timeH=date("H", time()); $timeM=date("i", time()); sg("ThisComputer.timeH",$timeH); sg("ThisComputer.timeM",$timeM);
/* $paths=array('/var/log/*.1','/var/log/*.2', '/var/log/*.1.*', '/var/log/*.2.*', '/var/log/*.3.*', '/var/log/*.4.*', '/var/log/*.5.*', '/var/log/*.6.*', '/var/log/*.7.*' ); foreach($paths as $p) { safe_exec('rm '.$p); } runScript('Hourly'); runScript('filesClearOld'); */ // раскидываем дату и время если изменилось в Windows $h=(int)date('G',time()); if (gg('ThisComputer.DateD')!=date("d", time())) { $day[0]="воскресенье"; $dayAlt[0]="ВОСКРЕСЕНЬЕ"; $day[1]="понедельник"; $dayAlt[1]="ПОНЕДЕЛЬНИК"; $day[2]="вторник"; $dayAlt[2]="ВТОРНИК"; $day[3]="среда"; $dayAlt[3]="СРЕДА"; $day[4]="четверг"; $dayAlt[4]="ЧЕТВЕРГ"; $day[5]="пятница"; $dayAlt[5]="ПЯТНИЦА"; $day[6]="суббота"; $dayAlt[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.DayAlt",$dayAlt[date("w")]); sg("ThisComputer.Month",$month[date("n")]); sg("ThisComputer.MonthAlt",$monthAlt[date("n")]); } //Проверяем запущен ли таймер ХХ, если нет, то запускаем if (!timeOutExists('timer_Xs_timeout')) { setTimeOut("timer_Xs_timeout", "runScript('timer_Xs');", 5); } if (!timeOutExists('nobody_Xm_timeout')) { setTimeOut("nobody_Xm_timeout", "runScript('Nobody');", 10); } if (isOnline('Internet')) { if (!timeOutExists('Router_IP')) { rs('Router_IP'); } } if (isOnline('Internet')) { // обновим прогноз погоды if (!($h%3)) {runScript("PogodaObninsk");} // обновим курс валюты каждые 4 часа if (!($h%4)) {callMethod("cbr.update");} } else {say ("Проверить погоду и курсы валют пока не могу, так как нет доступа в интеренет. Попробую сделать это через один час. ",1); } //Проверка IP внешнего интернета //runScript("inetInfo",array("mode"=>'getinfo')); if ($h=="02") { runScript("Sun"); } if ($h=="04") { runScript("maintenance"); } setTimeOut('Weather', 'runScriptSafe(\'OpenWeatherMap\');', 300); /* //START openweather module $updateTime = gg('ow_setting.updateTime'); if($updateTime > 0) { $count = gg('ow_setting.countTime'); if($count >= $updateTime) { include_once(DIR_MODULES . 'app_openweather/app_openweather.class.php'); $app_openweather = new app_openweather(); $app_openweather->get_weather(gg('ow_city.id')); sg('ow_setting.countTime', 1); } else { $count++; sg('ow_setting.countTime', $count); } } // END openweather module $windDirection = array('С', 'ССВ', 'СВ', 'ВСВ', 'В', 'ВЮВ', 'ЮВ', 'ЮЮВ', 'Ю', 'ЮЮЗ', 'ЮЗ', 'ЗЮЗ', 'З', 'ЗСЗ', 'СЗ', 'ССЗ', 'С'); $degree = gg('ow_fact.wind_direction'); $direction = $windDirection[round($degree / 22.5)]; sg('ow_fact.wind_directionTXT', $direction); */ //Состояние памяти системы //RunScript('SysInfo'); //дни рождения, проверять при условии разрешения в установках и в 9-00 /* if ((gg("Sets.checkBirthday"))&&($h=="09")) { runScript("birthday"); } */
Свойства класса:
Методы класса:
// МЕТОД check $todo = $this->getProperty("todo"); // установим внутреннюю кодировку символов mb_internal_encoding("UTF-8"); $td = explode("|", $todo); if (isset($params["task"])) { $ct = $params["task"]; for($i = 0; ($i < sizeof($td)); $i++) { // выделим и сохраним первый символ $check = mb_substr($td[$i], 0, 1); // обрежем строку, не будем отображать первый символ + или - $task = mb_substr($td[$i], 1); // если совпадает номер строки if ($i == $ct) { // инвентируем check $check = ($check == "+") ? "-" : "+"; $tcheck = ($check == "+") ? ""выполненно"" : ""не выполнено""; $sayTodo = gg("Sets.sayTodo"); if ($sayTodo) { say ("Todo задача: "".$task."" - отмечена как ".$tcheck,($sayTodo-2)); } } $td[$i] = $check.$task; } $todo = implode("|", $td); $this->setProperty("todo", $todo); } // выполним подготовку для отображения // callMethod("TodoList.view");
// МЕТОД delete $todo = $this->getProperty("todo"); $dt = $params["task"]; // получаем номер строки на удаление $td = explode("|", $todo); // Считываем всё в массив for($i = 0; $i < sizeof($td); $i++) { if($i == $dt) { $sayTodo = gg("Sets.sayTodo"); if ($sayTodo) { say ("Из листа todo удалена задача: "".mb_substr($td[$i], 1).""",($sayTodo-2)); } unset($td[$i]); } } $todo = implode("|", $td); $this->setProperty("todo", $todo); // выполним подготовку для отображения // callMethod("TodoList.view");
// МЕТОД new if (isset($params["task"])) { $todo = $this->getProperty("todo"); $mytask = "-".$params["task"]; // строка задачи $sayTodo = gg("Sets.sayTodo"); if ($sayTodo) { say ("В лист todo добавлена задача: "".$params["task"].""",($sayTodo-2)); } $todo = $todo."|".$mytask; // добавляем с разделителем $this->setProperty("todo", $todo); }
// МЕТОД view - подготовка кода для отображения $todo = $this->getProperty("todo"); // установим внутреннюю кодировку символов mb_internal_encoding("UTF-8"); $td = explode("|", $todo); $str_cod = '<div id="list"> <div class="new"> <input id="newtask" placeholder="New Item" type="text"> <button onClick="btnRunClicked();" class="fa fa-plus"></button> </div> <div class="list">'; for($i = 1; $i < sizeof($td); $i++) { // выделим и сохраним первый символ $check = mb_substr($td[$i], 0, 1); // обрежем строку, не будем отображать первый символ + или - $task = mb_substr($td[$i], 1); // начинаем формировать код hsl(196,'.(73-24*(($i-1)%2)).'%,50%) $str_cod = $str_cod.' <div class="item" id="taskbox_'.$i.'" style ="background: hsl('.(190+$i*6).',73%,50%);"> <span id="task_'.$i.'"'; // если певый символ "+" то значит задание "выполнено" if ($check == "+") { $str_cod = $str_cod.' class="checked"'; } $str_cod = $str_cod.'>'.$task.'</span>'; $str_cod = $str_cod.' <div class="rightblock"> <button id="check_'.$i.'" class="check fa fa-check" onClick="checkClicked('.$i.');"></button> <button id="delete_'.$i.'" class="delete fa fa-times" onClick="deleteClicked('.$i.');"></button> </div> </div>'; } $str_cod = $str_cod.' </div> </div>'; // записываем получившийся код $this->setProperty("StreamingCodeScene",$str_cod); $str_cod_css = "<style>".$this->getProperty("menuCSS")."</style>"; $str_cod_js = "<script type='text/javascript'>".$this->getProperty("JS")."</script>"; $str_cod = $str_cod_css.$str_cod_js.$str_cod; $this->setProperty("StreamingCodeMenu",$str_cod);
Объекты класса:
// ****************************************************************** // * TO DO app - by Vovix - 30.11.2015 г. - v 3.1 * // ****************************************************************** // создадим класс и объекты addClass('ToDo'); addClassObject('ToDo','TodoList'); addClassProperty('ToDo','StreamingCodeMenu'); // HTML для меню addClassProperty('ToDo','StreamingCodeScene'); // HTML для сцен addClassProperty('ToDo','menuCSS'); // CSS для меню addClassProperty('ToDo','sceneCSS'); // CSS для сцены addClassProperty('ToDo','JS'); // общий код javascript addClassProperty('ToDo','todo'); // сам лист to do // $this->setProperty('todo', '- to do list by Vovix -'); $menuCSS=' @import url("/css/font-awesome/css/font-awesome.min.css"); #item123 { /* здесь item123 - это номер ID пункта меню в котором он размещен */ padding: 0; } #list { position: relative; /* width: calc(100% + 40px); */ /* margin: 0 -20px 0 -20px; */ width: 100%; margin: 0; } #list .new { width: 100%; height: 50px; padding: 0; margin: 0; } #list .new #newtask { float: left; width: calc(100% - 76px); height: 50px; padding: 0; margin: 0; background: #333333; text-indent: 8px; } #list .new input { font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size: 14px; color: #FFF; text-align: justify; line-height: normal; outline: 0; border: 0; border-radius: 0px; text-shadow: none; } #list .new #newtask::-webkit-input-placeholder { color: rgba(255, 255, 255, 0.5); } #list .new button { cursor: pointer; float: right; width: 76px; height: 50px; padding: 0; outline: 0; border: 0; border-radius: 0px; margin: -9px 0 0 0; background: #111111; font-size: 24px; color: #FFF; } #list .list .item { clear: both; width: 100%; height: 38px; margin: 0; } #list .list .item span { cursor: default; float: left; width: calc(100% - 76px); height: 20px; padding: 9px 0 0 0; margin: 0; outline: 0; border: 0; background: transparent; text-indent: 8px; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size: 14px; color: #FFF; text-align: justify; text-shadow: none; } #list .list .item span.checked { opacity: .5; text-decoration: line-through; } #list .list .item .rightblock { float: right; width: 76px; height: 38px; padding: 0; margin: 0; } #list .list .item .rightblock button { cursor: pointer; float: left; width: 38px; height: 38px; padding: 0px; margin: 0; outline: 0; border: 0; border-radius: 0px; background: rgba(0,0,0,0.1); font-size: 20px; color: #FFF; } '; $this->setProperty('menuCSS', $menuCSS); $sceneCSS=' #list { position: relative; width: 100%; max-height: 528px; overflow: auto; margin: 0; } #list .new #newtask { float: left; width: calc(100% - 100px); height: 100px; padding: 0; margin: 0; outline: 0; border: 0; background: #333333; line-height: 50px; text-indent: 25px; } #list .new input { font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size: 28px; color: #FFF; text-align: justify; line-height: normal; outline: 0; border: 0; border-radius: 0px; text-shadow: 0px; } #list .new #newtask::-webkit-input-placeholder { color: rgba(255, 255, 255, 0.5); } #list .new button { cursor: pointer; float: right; width: 100px; height: 100px; padding: 0; margin: 0; outline: 0; border: 0; border-radius: 0px; background: #111111; font-size: 84px; color: #FFF; } #list .list .item { clear: both; width: 100%; height: 50px; margin: 0; padding: 5px 0 0 0; } #list .list .item span { cursor: default; float: left; width: calc(100% - 150px); height: 50px; padding: 0; margin: 0; outline: 0; border: 0; background: transparent; text-indent: 25px; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size: 28px; color: #FFF; text-align: justify; line-height: normal; } #list .list .item span.checked { opacity: .5; text-decoration: line-through; } #list .list .item .rightblock { float: right; padding: 0; margin: -2px 0 0 0; } #list .list .item button{ cursor: pointer; float: left; width: 50px; height: 50px; padding: 0; margin: 0; outline: 0; border: 0; box-shadow: 0 0 3px rgba(0,0,0,0.2); background: rgba(0,0,0,0.1); font-size: 32px; color: #FFF; } '; $this->setProperty('sceneCSS', $sceneCSS); $JS=' function btnRunClicked() { var newtask = $("#newtask").val(), ni = $("div.item").length + 1; $("#newtask").val(""); if (newtask) { var task1 = String(newtask); var codItem1 = \'<div class="item" id="taskbox_\' + ni + \'" style ="background: hsl(\' + (190+ni*6) + \',73%,50%);">\'; var codItem2 = \'<span id="task_\' + ni + \'">\' + task1 + \'</span>\'; var codItem3 = \'<div class="rightblock"><button id="check_\' + ni + \'" class="check fa fa-check ui-btn ui-shadow ui-corner-all" onClick="checkClicked(\' + ni +\');"></button>\'; var codItem4 = \'<button id="delete_\' + ni + \'" class="delete fa fa-times ui-btn ui-shadow ui-corner-all" onClick="deleteClicked(\' + ni + \');"></button></div></div>\'; $.get( "/objects/", { object:"TodoList", op:"m", m:"new", task:newtask } ); setTimeout(function() { $.get( "/objects/", { object:"TodoList", op:"m", m:"view" } ) }, 100); $(codItem1 + codItem2 + codItem3 + codItem4).appendTo("div.list"); return false; } } function checkClicked(ctask) { if (ctask) { $.get( "/objects/", { object:"TodoList", op:"m",m:"check", task:ctask } ); $("#task_"+ctask).toggleClass("checked"); setTimeout(function() { $.get( "/objects/", { object:"TodoList", op:"m", m:"view" } ) }, 100); return false; } } function deleteClicked(dtask) { if (dtask) { $.get( "/objects/", { object:"TodoList", op:"m", m:"delete", task:dtask } ); $("#taskbox_"+dtask).remove(); setTimeout(function() { $.get( "/objects/", { object:"TodoList", op:"m", m:"view" } ) }, 100); return false; } } '; $this->setProperty('JS', $JS); $view=' // МЕТОД view - подготовка кода для отображения $todo = $this->getProperty("todo"); // установим внутреннюю кодировку символов mb_internal_encoding("UTF-8"); $td = explode("|", $todo); $str_cod = \'<div id="list"> <div class="new"> <input id="newtask" placeholder="New Item" type="text"> <button onClick="btnRunClicked();" class="fa fa-plus"></button> </div> <div class="list">\'; for($i = 1; $i < sizeof($td); $i++) { // выделим и сохраним первый символ $check = mb_substr($td[$i], 0, 1); // обрежем строку, не будем отображать первый символ + или - $task = mb_substr($td[$i], 1); // начинаем формировать код hsl(196,\'.(73-24*(($i-1)%2)).\'%,50%) $str_cod = $str_cod.\' <div class="item" id="taskbox_\'.$i.\'" style ="background: hsl(\'.(190+$i*6).\',73%,50%);"> <span id="task_\'.$i.\'"\'; // если певый символ "+" то значит задание "выполнено" if ($check == "+") { $str_cod = $str_cod.\' class="checked"\'; } $str_cod = $str_cod.\'>\'.$task.\'</span>\'; $str_cod = $str_cod.\' <div class="rightblock"> <button id="check_\'.$i.\'" class="check fa fa-check" onClick="checkClicked(\'.$i.\');"></button> <button id="delete_\'.$i.\'" class="delete fa fa-times" onClick="deleteClicked(\'.$i.\');"></button> </div> </div>\'; } $str_cod = $str_cod.\' </div> </div>\'; // записываем получившийся код $this->setProperty("StreamingCodeScene",$str_cod); $str_cod_css = "<style>".$this->getProperty("menuCSS")."</style>"; $str_cod_js = "<script type=\'text/javascript\'>".$this->getProperty("JS")."</script>"; $str_cod = $str_cod_css.$str_cod_js.$str_cod; $this->setProperty("StreamingCodeMenu",$str_cod); '; addClassMethod('ToDo', 'view', $view); $check=' // МЕТОД check $todo = $this->getProperty("todo"); // установим внутреннюю кодировку символов mb_internal_encoding("UTF-8"); $td = explode("|", $todo); if (isset($params["task"])) { $ct = $params["task"]; for($i = 0; ($i < sizeof($td)); $i++) { // выделим и сохраним первый символ $check = mb_substr($td[$i], 0, 1); // обрежем строку, не будем отображать первый символ + или - $task = mb_substr($td[$i], 1); // если совпадает номер строки if ($i == $ct) { // инвентируем check $check = ($check == "+") ? "-" : "+"; $tcheck = ($check == "+") ? ""выполненно"" : ""не выполнено""; $sayTodo = gg("Sets.sayTodo"); if ($sayTodo) { say ("Todo задача: "".$task."" - отмечена как ".$tcheck,($sayTodo-2)); } } $td[$i] = $check.$task; } $todo = implode("|", $td); $this->setProperty("todo", $todo); } // выполним подготовку для отображения // callMethod("TodoList.view"); '; addClassMethod('ToDo', 'check', $check); $delete = ' // МЕТОД delete $todo = $this->getProperty("todo"); $dt = $params["task"]; // получаем номер строки на удаление $td = explode("|", $todo); // Считываем всё в массив for($i = 0; $i < sizeof($td); $i++) { if($i == $dt) { $sayTodo = gg("Sets.sayTodo"); if ($sayTodo) { say ("Из листа todo удалена задача: "".mb_substr($td[$i], 1).""",($sayTodo-2)); } unset($td[$i]); } } $todo = implode("|", $td); $this->setProperty("todo", $todo); // выполним подготовку для отображения // callMethod("TodoList.view"); '; addClassMethod('ToDo', 'delete', $delete); $new = ' // МЕТОД new if (isset($params["task"])) { $todo = $this->getProperty("todo"); $mytask = "-".$params["task"]; // строка задачи $sayTodo = gg("Sets.sayTodo"); if ($sayTodo) { say ("В лист todo добавлена задача: "".$params["task"].""",($sayTodo-2)); } $todo = $todo."|".$mytask; // добавляем с разделителем $this->setProperty("todo", $todo); } '; addClassMethod('ToDo', 'new', $new); callMethod("TodoList.view");
Свойства класса:
Методы класса:
//say("ТЦЛ",1); sg('TV_TCL.RemoteVisible',1); sg('Rostel_Hall.RemoteVisible',0); sg('Rostel_Bed.RemoteVisible',0); sg('TV_LG.RemoteVisible',0);
//say("элджи",1); sg('TV_LG.RemoteVisible',1); sg('TV_TCL.RemoteVisible',0); sg('Rostel_Hall.RemoteVisible',0); sg('Rostel_Bed.RemoteVisible',0);
//say("ростел спальня",1); sg('Rostel_Bed.RemoteVisible',1); sg('Rostel_Hall.RemoteVisible',0); sg('TV_TCL.RemoteVisible',0); sg('TV_LG.RemoteVisible',0);
//say("ростел зал",1); sg('Rostel_Hall.RemoteVisible',1); sg('Rostel_Bed.RemoteVisible',0); sg('TV_TCL.RemoteVisible',0); sg('TV_LG.RemoteVisible',0);
Объекты класса:
say("ТЦЛ 3",1);
say("ТЦЛ 2",1);
say("ТЦЛ 1",1);
//say("ТЦЛ повер",1); RunScript('TVon_Hall'); //setTimeOut('Rostel_Hall',"RunScript('Rostel_Hall');",5);
//say("ТЦЛ муте",1); $NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 73; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val );
say("ТЦЛ 0",1);
say("ТЦЛ 7",1);
say("ТЦЛ 6",1);
say("ТЦЛ 5",1);
say("ТЦЛ 4",1);
say("ТЦЛ лево",1);
say("ТЦЛ вправо",1);
say("ТЦЛ бэк",1);
say("ТЦЛ канал +",1);
say("ТЦЛ канал -",1);
say("ТЦЛ вверх",1);
say("ТЦЛ вниз",1);
//say("ТЦЛ звук -",1); $NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 72; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val );
//say("ТЦЛ звук +",1); $NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 71; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val );
say("ТЦЛ канал -",1);
say("ТЦЛ канал +",1);
say("ТЦЛ 9",1);
say("ТЦЛ соурс",1);
say("ТЦЛ 8",1);
say("ТЦЛ окей",1);
//say("Ростел зал 7",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 313; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',313);
//say("Ростел зал 0",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 213; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',213);
//say("Ростел зал 4",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 913; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',913);
//say("Ростел зал 5",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 956; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',956);
//say("Ростел зал 6",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 302; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',302);
//say("Ростел зал вверх",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 94; //$val = 00bfd02f; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',94);
//say("Ростел зал канал -",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 92; //$val = 00bf38c7; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',92);
//say("Ростел зал вниз",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 95; //$val = 00bff00f; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',95);
//say("Ростел зал влево",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 96; //$val = 00bf926d; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',96);
//say("Ростел зал 11",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 309; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',309);
//say("Ростел зал 10",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 316; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',316);
//say("Ростел зал окей",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 93; //$val = 00bfb04f; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',93);
//say("Ростел зал вправо",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 97; //$val = 00bf52ad; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',97);
//say("Ростел зал 3",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 007; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',007);
//say("Ростел зал 2",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 922; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',922);
//say("Ростел зал 8",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 303; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',303);
//say("Ростел зал канал +",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 91; //$val = 00bf18e7; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',91);
//say("Ростел зал муте",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 73; //$val = 00f3f0c0; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',73);
//say("Ростел зал повер",1); /* $NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 90; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',90);
//say("Ростел зал звук -",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 72; //$val = 00f2e0d1; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',72);
//say("Ростел зал звук +",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 71; //$val = 00f2f0d0; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',71);
say("Ростел зал канал +",1);
say("Ростел зал канал -",1);
//say("Ростел зал бэк",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 98; //$val = 00bf40bf; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',98);
//say("Ростел зал 9",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 304; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',304);
//say("Ростел зал 1",1); /*$NId = 0; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 900; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Livingroom.IR_send',900);
//say("Ростел спальня 1",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 900; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',900);
//say("Ростел спальня повер",1); /* $NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 90; //$val = 00bf48b7; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',90);
//say("Ростел спальня муте",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 83; //$val = 20df906f; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',83);
say("Ростел спальня канал +",1);
say("Ростел спальня канал -",1);
//say("Ростел спальня звук +",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 81; //$val = 20df40bf; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',81);
//say("Ростел спальня звук -",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 82; //$val = 20dfc03f; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',82);
//say("Ростел спальня 9",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 304; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',304);
//say("Ростел спальня 8",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 303; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',303);
//say("Ростел спальня бэк",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 98; //$val = 00bf40bf; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',98);
//say("Ростел спальня 5",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 956; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',956);
//say("Ростел спальня 4",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 913; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',913);
//say("Ростел спальня 3",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 7; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',7);
//say("Ростел спальня 2",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 922; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',922);
//say("Ростел спальня вниз",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 95; //$val = 00bff00f; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',95);
//say("Ростел спальня влево",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 96; //$val = 00bf926d; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',96);
//say("Ростел спальня 6",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 302; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',302);
//say("Ростел спальня 7",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 313; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',313);
//say("Ростел спальня 0",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 213; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',213);
//say("Ростел спальня 11",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 309; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',309);
//say("Ростел спальня Канал -",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 92; //$val = 00bf38c7; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',92);
//say("Ростел спальня 10",1); $NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 316; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val );
//say("Ростел спальня вправо",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 97; //$val = 00bf52ad; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',97);
//say("Ростел спальня окей",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 93; //$val = 00bfb04f; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',93);
//say("Ростел спальня Канал +",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 91; //$val = 00bf18e7; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',91);
//say("Ростел спальня вверх",1); /*$NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 94; //$val = 00bfd02f; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val ); */ sg('Bedroom.IR_send',94);
say("Элджи 8",1);
say("Элджи соурс",1);
say("Элджи 0",1);
say("Элджи Канал +",1);
say("Элджи Канал -",1);
say("Элджи 4",1);
say("Элджи 5",1);
say("Элджи 6",1);
say("Элджи 7",1);
say("Элджи 3",1);
say("Элджи муте",1);
//say("Элджи повер",1); RunScript('TVon_Bed'); //setTimeOut('Rostel_Bed',"runScript('Rostel_Bed');",5);
say("Элджи 1",1);
say("Элджи 2",1);
//say("Элджи звук -",1); $NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 82; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val );
say("Элджи 9",1);
say("Элджи канал +",1);
say("Элджи канал -",1);
//say("Элджи звук +",1); $NId = 25; $SId = 3; $mType = 1; $ack = 0; $SubType = 32; $val = 81; include_once(DIR_MODULES . 'mysensor/mysensor.class.php'); $notify = new mysensor(); $notify->cmd( "$NId;$SId;$mType;$ack;$SubType;" . $val );
Свойства класса:
Методы класса:
Свойства класса:
Объекты класса:
Методы класса:
Объекты класса:
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']); } }
Свойства класса:
Методы класса:
//Установим флаг "дома" if (!$this->getProperty('isHome')) { $this->setProperty('isHome',1); } //Сброс собрался домой /* if ($this->getProperty('isGoingHome')) { $this->setProperty('isGoingHome',0); } */ //Сброс присутствия $ot=$this->object_title; $alive_timeout=30*60; clearTimeOut($ot."_isHome"); setTimeOut($ot.'_isHome',"sg('".$ot.".isHome',0);",$alive_timeout);
$ot = $this->object_title; $updatedTime = $this->getProperty('CoordinatesUpdatedTimestamp'); $passed = time() - $updatedTime; $newTimeout=0; if ($passed<10) { $newTimeout = 10; $this->setProperty('updatedText',LANG_DEVICES_PASSED_NOW); } elseif ($passed<60) { $newTimeout = 10; $this->setProperty('updatedText',$passed.' '.LANG_DEVICES_PASSED_SECONDS_AGO); } elseif ($passed<60*60) { $newTimeout = 60; $this->setProperty('updatedText',round($passed/60).' '.LANG_DEVICES_PASSED_MINUTES_AGO); } elseif ($passed<20*60*60) { //just time $newTimeout = 60 * 60; $h0=(int)date('G',time()); $h1=(int)date('G',$updatedTime); if ($h0>$h1) { $this->setProperty('updatedText','сегодня в '.date('H:i',$updatedTime)); //небыло перехода суток } else { $this->setProperty('updatedText','вчера в '.date('H:i',$updatedTime)); //был переход суток } } else { //time and date $this->setProperty('updatedText',date('d.M.Y H:i',$updatedTime));// } if ($newTimeout > 0) { setTimeOut($ot.'_updateTime','callMethod("'.$ot.'.setUpdatedText");',$newTimeout); }
$Coordinates=$this->getProperty('Coordinates'); $lat=substr($Coordinates,0,strpos($Coordinates,',')); $lon=substr($Coordinates,strpos($Coordinates,',')+1); //$this->setProperty('latitude',$lat); //$this->setProperty('longitude',$lon); if($this->getProperty('HomeDistance')>75){ $data_file='http://geocode-maps.yandex.ru/1.x/?geocode=E'.$lon.',N'.$lat; $xml=simplexml_load_file($data_file); $res=$xml->{'GeoObjectCollection'}->{'featureMember'}[0]->{'GeoObject'}->{'metaDataProperty'}->{'GeocoderMetaData'}->{'AddressDetails'}->{'Country'}->{'AddressLine'}; $this->setProperty('Location',$res); }else{ $this->setProperty('Location','Дом'); $this->callMethod('gotHome'); }
$charg=$this->getProperty('Charging'); $level=$this->getProperty('BattLevel'); if (!$charg) { if ($params['NEW_VALUE']>0 && $params['NEW_VALUE']<15 && $params['NEW_VALUE']<$params['OLD_VALUE']) { $last_register=registeredEventTime($this->object_title . 'LowBatteryNotification'); // проверяем когда в последний раз срабатывало событие "Уведомиление о низком заряде батареи у пользователя" if (!$last_register || (time()-$last_register)>3600) { say('Заряд телефона у ' . $this->getProperty('Name') . $params['NEW_VALUE'] . '%. Скоро сядет.'); registerEvent($this->object_title . 'LowBatteryNotification',$this->name,1); // регистрируем событие "Уведомление о низком заряде батареи у пользователя" } } } if ($charg){ $this->setProperty('BattPic','icon-83'); } else { if ($level>90 && $level<=100){ $this->setProperty('BattPic','icon-89'); $this->setProperty('BattColor','lime'); } elseif ($level>70 && $level<=90){ $this->setProperty('BattPic','icon-88'); $this->setProperty('BattColor','lime'); } elseif ($level>50 && $level<=70){ $this->setProperty('BattPic','icon-87'); $this->setProperty('BattColor','greenyellow'); } elseif ($level>30 && $level<=50){ $this->setProperty('BattPic','icon-86'); $this->setProperty('BattColor','yellow'); } elseif ($level>10 && $level<=30){ $this->setProperty('BattPic','icon-85'); $this->setProperty('BattColor','orange'); } elseif ($level<=10){ $this->setProperty('BattPic','icon-84'); $this->setProperty('BattColor','red'); } }
//$params["LOCATION_OBJECT"], $params["LOCATION"]
//$params["LOCATION_OBJECT"], $params["LOCATION"]
// Если ночь и кто-то дома то не оповещать $night=getGlobal("NightMode.active"); $nobody=getGlobal("NightMode.active"); if (($night == 0) && ($nobody != 0)){ return; } $this->callMethod("SendEMail", $params); //$this->callMethod("SendSMS", $params);
$gps=$this->getProperty('isHome'); $wifi=$this->getProperty('online'); //registerEvent('presence',$this->name,2); if (!$gps && $wifi==2) { $this->setProperty('presence','0'); $this->setProperty('NameColor','orange'); } else { $this->setProperty('presence','1'); $this->setProperty('NameColor','lime'); } if ($wifi<2) { $this->setProperty('NetworkPic','icon-wifi'); } else { $this->setProperty('NetworkPic',''); }
$last = $this->getProperty("isHomeTime"); $wifi = $this->getProperty('online'); // Установка флага $this->setProperty("isHome", 1); $this->setProperty("isHomeUpdate", time()); $this->setProperty("isHomeTime", date("d-m-Y H:i:s",time())); //$this->callMethod('Home'); // Приветствовать if ($wifi > 0) { if (time()-$last >= (4*60*60)) if ($this->getProperty("Greeting") == 1) say("Здравствуйте ".$this->getProperty("SayName")."\nДобро пожаловать!"); } // Сброс присутствия $ot=$this->object_title; $alive_timeout = 30*60; clearTimeOut($ot."_isHome"); setTimeOut($ot."_isHome","sg('".$ot.".isHome',0);",$alive_timeout);
$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"));
Объекты класса:
Малоярославец, Россия
На форуме: ahelper
© 2021 - Site Built By SergeJey | Публичный договор
SmartLiving