Свойства класса:
Методы класса:
if (gg("AlarmWeekDay.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenuRun",Вкл);
setGlobal("AlarmMenu.AlarmMenuLed",1);
}elseif(gg("AlarmWeekEnd.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenuRun",Вкл);
setGlobal("AlarmMenu.AlarmMenuLed",1);
}elseif(gg("AlarmOne.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenuRun",Вкл);
setGlobal("AlarmMenu.AlarmMenuLed",1);
}else {
setGlobal("AlarmMenu.AlarmMenuRun",Выкл);
setGlobal("AlarmMenu.AlarmMenuLed",0);
}
if (gg("AlarmWeekDay.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenu1Run",Вкл);
}else {
setGlobal("AlarmMenu.AlarmMenu1Run",Выкл);
}
if (gg("AlarmWeekEnd.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenu2Run",Вкл);
}else {
setGlobal("AlarmMenu.AlarmMenu2Run",Выкл);
}
if (gg("AlarmOne.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenu3Run",Вкл);
}else {
setGlobal("AlarmMenu.AlarmMenu3Run",Выкл);
}
Объекты класса:
if (isWeekDay()){ // сегодня рабочий день
// все проснулись
setGlobal("SleepAllMode.active",0);
say(getGlobal('AlarmWeekDay.AlarmText'),5);
// включим радио
callMethod("RadioSetting.RadioPlay");
// запланируем выключить радио через 10 минут
SetTimeOut("AlarmWeekDay_RadioStop",'callMethod("RadioSetting.RadioStop");', 60*10);
// запланируем выключить радио
// AddScheduledJob("AlarmWeekDay_RadioStop",'callMethod("Radio.RadioStop");', recognizeTime("в 6:55"));
// запланируем напоминание о выходе из дома и доклад погоды
// AddScheduledJob("AlarmWeekDay_timeNow1",'callMethod("сколько время.action");', recognizeTime("в 06:45"));
// AddScheduledJob("AlarmWeekDay_timeNow1",'callMethod("сколько время.action");', recognizeTime("в 7:00"));
// AddScheduledJob("AlarmWeekDay_Pogoda", 'callMethod("прогноз погоды.action");', recognizeTime("в 07:05"));
// AddScheduledJob("AlarmWeekDay_TaskExist1",'callMethod("TaskExistMode.modeChanged");', recognizeTime("в 7:07"));
// AddScheduledJob("AlarmWeekDay_timeNow2",'callMethod("сколько время.action");', recognizeTime("в 7:10"));
// AddScheduledJob("AlarmWeekDay_Pogoda", 'callMethod("погода при движении в зале.action");', recognizeTime("в 07:05"));
// AddScheduledJob("AlarmWeekDay_timeNow3",'callMethod("сколько время.action");', recognizeTime("в 7:20"));
// AddScheduledJob("AlarmWeekDay_timeNow4",'callMethod("сколько время.action");', recognizeTime("в 7:30"));
// Запланируем в 17-00 на 30 минут включить вытяжку и вентиляцию
// AddScheduledJob("AlarmWeekDay_vent30min",'runScript("ventilyation30min");', recognizeTime("в 17:00"));
// если на улице темно
// if(timeBetween(gg("YandexSamara.SunSet"),gg("YandexSamara.SunRise"))){
// плавное включение Бра в спальне
// callMethod("NooLiteD_SpalnyaBra.dim",array("value"=>5));
// SetTimeOut("nl_lowOn_SpalnyaBra",'runScript("nl_lowOn_SpalnyaBra");', 60);
// Запланируем выключить его через полчаса
// SetTimeOut("AlarmWeekEnd_BraOff",'callMethod("NooLiteD_SpalnyBra.turnOff");', 30*60);
// }
}
//if (isWeekDay()){ // сегодня рабочий день
// say('сегодня рабочий день!');
// включим радио
// exec("templates_alt\maestro.m3u");
// sg("Radio.RadioIsPlay",1);
// запланируем выключить радио
// AddScheduledJob("AlarmWeekDay_RadioStop",'sg("Radio.RadioIsPlay",0);', recognizeTime("в 6:55"));
// запланируем напоминание о выходе из дома и доклад погоды
// AddScheduledJob("AlarmWeekDay_timeNow",'callMethod("сколько время.action");', recognizeTime("в 7:10"));
// AddScheduledJob("AlarmWeekDay_Pogoda", 'callMethod("погода при движении в зале.action");', recognizeTime("в 07:05"));
// AddScheduledJob("AlarmWeekDay_timeNow",'callMethod("сколько время.action");', recognizeTime("в 7:20"));
// AddScheduledJob("AlarmWeekDay_timeNow",'callMethod("сколько время.action");', recognizeTime("в 7:30"));
// // все проснулись
// setGlobal("SleepAllMode.active",0);
//}$stR=(gg("AlarmWeekDay.AlarmRing"));
$urlU=gg("AlarmWeekEnd.URLR.URLR");
switch ($stR){
case 'Мелодия':
$urlR=$urlU.'/requests/status.xml?command=in_play&input=file:///C:/_majordomo/htdocs/templates_alt/AlarmRing/alarm2.mp3';
break;
case 'Сигнал':
$urlR=$urlU.'/requests/status.xml?command=in_play&input=file:///C:/_majordomo/htdocs/templates_alt/AlarmRing/alarm7.mp3';
break;
case 'Радио':
$urlR=$urlU.'/requests/status.xml?command=in_play&input=http://212.56.209.70:8000/maestro';
break;
}
if (gg("AlarmWeekDay.ControlRing")) {
getURL($urlR,0);
}else {
callMethod("AlarmWeekDay.AlarmRingStop");
}
setGlobal('AlarmWeekDay.UrlAlarmRing',$urlR);getURL(gg('AlarmWeekDay.UrlAlarmRing'),0);getURL(gg("AlarmWeekEnd.URLR").'/requests/status.xml?command=pl_stop',0);$vol=gg("AlarmWeekDay.AlarmVolume");
$url=gg("AlarmWeekDay.URLR");
getURL($url.'/requests/status.xml?command=volume&val='.$vol,0);if (gg("AlarmWeekDay.ControlRing")) {
}else {
callMethod("AlarmWeekDay.AlarmRingStop");
sg("AlarmWeekDay.ControlRing",0);
}// это однократный будильник, выключем его
sg("AlarmOne.AlarmOn",0);
setGlobal("AlarmMenu.AlarmMenu3Run",Выкл);
callMethod("AlarmOne.AlarmMenuImg");
// все проснулись
setGlobal("SleepAllMode.active",0);
say(getGlobal('AlarmOne.AlarmText'),5);
// включим радио
callMethod("RadioSetting.RadioPlay");
// запланируем выключить радио через 10 минут(1час)
SetTimeOut("AlarmOne_RadioStop",'callMethod("RadioSetting.RadioStop");', 60);
// если на улице темно
if(timeBetween(gg("YandexSamara.SunSet"),gg("YandexSamara.SunRise"))){
// плавное включение Бра в спальне
callMethod("NooLiteD_SpalnyaBra.dim",array("value"=>5));
SetTimeOut("nl_lowOn_SpalnyaBra",'runScript("nl_lowOn_SpalnyaBra");', 60);
// Запланируем выключить его через полчаса
SetTimeOut("AlarmWeekEnd_BraOff",'callMethod("NooLiteD_SpalnyBra.turnOff");', 30*60);
}
// это однократный будильник, выключем его
//sg("AlarmOne.AlarmOn",0);
//setGlobal("AlarmMenu.AlarmMenu3Run",Выкл);
//setGlobal("AlarmMenu.AlarmMenuRun",Выкл);
//setGlobal("AlarmMenu.AlarmMenuLed",5);
//setGlobal("Radio.RadioIsPlay",1);
//getURL(gg('Radio.UrlStancia'),0);
//setGlobal("Radio.RadioPlayBeginTime",time());
//setGlobal("Radio.RadioMenuOn",Вкл);
//setGlobal("Radio.RadioLedOn",10);
//say("Включаю радио");if (gg("AlarmOne.ControlRing")) {
}else {
callMethod("AlarmOne.AlarmRingStop");
sg("AlarmOne.ControlRing",0);
}$vol=gg("AlarmOne.AlarmVolume");
$url=gg("AlarmOne.URLR");
getURL($url.'/requests/status.xml?command=volume&val='.$vol,0);getURL(gg("AlarmOne.UrlAlarmRing").'/requests/status.xml?command=pl_stop',0);getURL(gg('AlarmOne.UrlAlarmRing'),0);$stR=(gg("AlarmOne.AlarmRing"));
$urlU=gg("AlarmWeekEnd.URLR");
switch ($stR){
case 'Мелодия':
$urlR=$urlU.'/requests/status.xml?command=in_play&input=file:///C:/_majordomo/htdocs/templates_alt/AlarmRing/alarm2.mp3';
break;
case 'Сигнал':
$urlR=$urlU.'/requests/status.xml?command=in_play&input=file:///C:/_majordomo/htdocs/templates_alt/AlarmRing/alarm7.mp3';
break;
case 'Радио':
$urlR=$urlU.'http://localhost/popup/app_101ru.html?ajax=1&op=playstation&id=390';
break;
}
if (gg("AlarmOne.ControlRing")) {
getURL($urlR,0);
}else {
callMethod("AlarmOne.AlarmRingStop");
}
setGlobal('AlarmOne.UrlAlarmRing',$urlR);if (gg("AlarmWeekDay.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenuRun",Вкл);
setGlobal("AlarmMenu.AlarmMenuLed",1);
}elseif(gg("AlarmWeekEnd.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenuRun",Вкл);
setGlobal("AlarmMenu.AlarmMenuLed",1);
}elseif(gg("AlarmOne.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenuRun",Вкл);
setGlobal("AlarmMenu.AlarmMenuLed",1);
}else {
setGlobal("AlarmMenu.AlarmMenuRun",Выкл);
setGlobal("AlarmMenu.AlarmMenuLed",0);
}
if (isWeekEnd()){ // сегодня выходной день
// все проснулись
setGlobal("SleepAllMode.active",0);
say(getGlobal('AlarmWeekEnd.AlarmText'),5);
// включим радио
callMethod("RadioSetting.RadioPlay");
// запланируем выключить радио через 25 минут
SetTimeOut("AlarmWeekEnd_RadioStop",'callMethod("RadioSetting.RadioStop");', 60*25);
// запланируем напоминание о точном времени и доклад погоды
// SetTimeOut("AlarmWeekEnd_timeNow1",'callMethod("сколько время.action");', 60*30);
// SetTimeOut("AlarmWeekEnd_Pogoda", 'callMethod("погода на улице.action");', 60*35);
// SetTimeOut("AlarmWeekEnd_timeNow2",'callMethod("сколько время.action");', 60*40);
// SetTimeOut("AlarmWeekEnd_timeNow3",'callMethod("сколько время.action");', 60*50);
// если на улице темно
// if(timeBetween(gg("YandexSamara.SunSet"),gg("YandexSamara.SunRise"))){
// плавное включение Бра в спальне
// callMethod("NooLiteD_SpalnyaBra.dim",array("value"=>5));
// SetTimeOut("nl_lowOn_SpalnyaBra",'runScript("nl_lowOn_SpalnyaBra");', 60);
// Запланируем выключить его через полчаса
// SetTimeOut("AlarmWeekEnd_BraOff",'callMethod("NooLiteD_SpalnyBra.turnOff");', 30*60);
// }
}
//if (isWeekEnd()){ // сегодня выходной день
// say('сегодня выходной день!');
// включим радио
//
//getURL(gg('AlarmWeekEnd.UrlAlarmRing'),0);
//setGlobal("AlarmWeekEnd.AlarmPlayBeginTime ",time());
//
//say("Включаю сигнал");
//
// запланируем напоминание о выходе из дома и доклад погоды
// SetTimeOut("AlarmWeekDay_timeNow",'callMethod("сколько время.action");', 60);
// SetTimeOut("AlarmWeekDay_Pogoda", 'callMethod("погода на улице.action");', 60*15);
// SetTimeOut("AlarmWeekDay_timeNow",'callMethod("сколько время.action");', 120);
// SetTimeOut("AlarmWeekDay_timeNow",'callMethod("сколько время.action");', 60*30);
// все проснулись
// setGlobal("SleepAllMode.active",0);
// запланируем выключить радио через 5минут (60*5)=300
// SetTimeOut("AlarmWeekEnd_AlarmRingStop",'callMethod("AlarmWeekEnd.AlarmRingStop");', 180);
//
//}$vol=gg("AlarmWeekEnd.AlarmVolume");
$url=gg("AlarmWeekEnd.URLR");
getURL($url.'/requests/status.xml?command=volume&val='.$vol,0);$stR=(gg("AlarmWeekEnd.AlarmRing"));
$urlU=gg("AlarmWeekEnd.URLR");
switch ($stR){
case 'Мелодия':
$urlR=$urlU.'/requests/status.xml?command=in_play&input=file:///C:/_majordomo/htdocs/templates_alt/AlarmRing/alarm2.mp3';
break;
case 'Сигнал':
$urlR=$urlU.'/requests/status.xml?command=in_play&input=file:///C:/_majordomo/htdocs/templates_alt/AlarmRing/alarm7.mp3';
break;
case 'Радио':
$urlR=$urlU.'/requests/status.xml?command=in_play&input=http://212.56.209.70:8000/maestro';
break;
}
if (gg("AlarmWeekEnd.ControlRing")) {
getURL($urlR,0);
}else {
callMethod("AlarmWeekEnd.AlarmRingStop");
}
setGlobal('AlarmWeekEnd.UrlAlarmRing',$urlR);getURL(gg("AlarmWeekEnd.URLR").'/requests/status.xml?command=pl_stop',0);if (gg("AlarmWeekEnd.ControlRing")) {
}else {
callMethod("AlarmWeekEnd.AlarmRingStop");
sg("AlarmWeekEnd.ControlRing",0);
}getURL(gg('AlarmWeekEnd.UrlAlarmRing'),0);if (gg("AlarmWeekDay.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenuRun",Вкл);
setGlobal("AlarmMenu.AlarmMenuLed",1);
}elseif(gg("AlarmWeekEnd.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenuRun",Вкл);
setGlobal("AlarmMenu.AlarmMenuLed",1);
}elseif(gg("AlarmOne.AlarmOn")) {
setGlobal("AlarmMenu.AlarmMenuRun",Вкл);
setGlobal("AlarmMenu.AlarmMenuLed",1);
}else {
setGlobal("AlarmMenu.AlarmMenuRun",Выкл);
setGlobal("AlarmMenu.AlarmMenuLed",0);
}
Свойства класса:
Методы класса:
$volume=round(65535*$params['VALUE']/100);
$this->setProperty('volumeLevel',$params['VALUE']);
safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume);
say("Изменилась громкость до ".$params['VALUE']." процентов");Объекты класса:
$command=$params['command'];
$short_command='';
$dt=recognizeTime($command,$short_command);
if (preg_match('/скажи сколько время/is',$command)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята',2);
return;
}
global $voicemode;
$voicemode='on';
say('Сейчас '.timeNow(),2);
} elseif (preg_match('/сколько время/is',$command)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята');
echo $short_command;
return;
}
say('Сейчас '.timeNow());
} elseif (preg_match('/повтори (.+)/is',$command,$m) || preg_match('/скажи (.+)/is',$command,$m)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята',2);
return;
}
global $voicemode;
$voicemode='on';
say($m[1],2);
} else {
say('Неизвестная команда...',2);
}say("Отключено питание");Свойства класса:
Методы класса:
$this->setProperty('LastRun',date('Y-m-d H:i:s'));$name='Cron_'.$this->object_title;
SQLExec("DELETE FROM jobs WHERE title='".$name."'");Свойства класса:
Методы класса:
Объекты класса:
Свойства класса:
Методы класса:
//$params['t']
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date("H:i",time()));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=30*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
if (!isset($params['h'])) {
return;
}
$old_temp=$this->getProperty('humidity');
$t=round($params['h'],1);
if ($t>100) return;
$this->setProperty('humidity',$t);
if ($params['uptime']) {
$this->setProperty('uptime',$params['uptime']);
}
if ($t>$old_temp) {
$d=1;
} elseif ($t<$old_temp) {
$d=-1;
} else {
$d=0;
}
$this->setProperty('direction',$d);
$linked_room=$this->getProperty("LinkedRoom");
if ($linked_room) {
setGlobal($linked_room.'.Humidity',$t);
}Объекты класса:
Свойства класса:
Методы класса:
$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('inhouseMovement'); // проверяем когда в последний раз срабатывало событие "движение внутри дома"
registerEvent('inhouseMovement',$this->name,2); // регистрируем событие "движение внутри дома"
if (timeBetween('05:00', '12:00') && ((time()-$last_register)>2*60*60)) {
runScript('Greeting'); // запускаем скрипт "доброе утро"
}
}Объекты класса:
Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty('active',1);$this->setProperty('active',0);Объекты класса:
setGlobal('minMsgLevel','2');
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/nightmode_activate.php');
/* end injection of {SDevices} */setGlobal('minMsgLevel','1');
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/nightmode_deactivate.php');
/* end injection of {SDevices} */
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/nobodyhomemode_activate.php');
/* end injection of {SDevices} */
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/nobodyhomemode_deactivate.php');
/* end injection of {SDevices} */Методы класса:
if ((int)$params['status']==1 || (int)$params['VALUE']==1) {
$url='http://192.168.0.112/command?8=ON';
getURL($url,0);
} else {
$url='http://192.168.0.112/command?8=OFF';
getURL($url,0);
}Объекты класса:
if ((int)$params['status']==1 || (int)$params['VALUE']==1) {
$url='http://192.168.0.112/command?8=ON';
getURL($url,0);
} else {
$url='http://192.168.0.112/command?8=OFF';
getURL($url,0);
}Методы класса:
cm('RadioSetting.Control','stop');cm('RadioSetting.Control','play');
cm('RadioSetting.Control','vol30');Объекты класса:
include_once(DIR_MODULES.'app_radio/app_radio.class.php');
$app_radio=new app_radio();
if(is_array($params))
{
if(isset($params['sta'])) $app_radio->change_station($params['sta'],$app_radio);
if(isset($params['cmd'])) $app_radio->control($params['cmd']);
if(isset($params['vol'])) $app_radio->set_volume($params['vol'],$app_radio);
}
else
{
if($params=='play' || $params=='stop') $app_radio->control($params);
else if(strpos($params, "vol")===0) $app_radio->set_volume((int)substr($params,3),$app_radio);
else if(strpos($params, "sta:")===0) $app_radio->change_station(substr($params,4),$app_radio);
}Свойства класса:
Методы класса:
$status=$this->getProperty("status");
if ($status) {
$this->callMethod('turnOn');
} else {
$this->callMethod('turnOff');
}$status=$this->getProperty("status");
if ($status) {
$this->callMethod('turnOff');
} else {
$this->callMethod('turnOn');
}$this->setProperty("status",0);$this->setProperty("status",1);Свойства класса:
Методы класса:
$cmdline='"c:\Program Files\nooLite\nooLite.exe" -api '.$params['command'];
$last_called=gg('NoolightCommandSend');
$min_delay=3;
$now=time();
if (($now-$last_called)>$min_delay) {
//safe_exec($cmdline);
$last_callled=$now;
sg('NoolightCommandSend',$last_called);
DebMes("Noolite instant exec: ".$cmdline);
system($cmdline);
//exec($cmdline);
} else {
if ($last_callled<$now) {
$last_callled=$now;
}
$last_called+=$min_delay;
sg('NoolightCommandSend',$last_called);
DebMes("Noolite scheduled job for ".date('H:i:s',$last_called));
AddScheduledJob("noolight".md5($cmdline),"safe_exec('".$cmdline."');",$last_called);
}
$this->setProperty("status",0);
//safe_exec('"c:\Program Files\nooLite\noolite.exe" -api -off_ch'.$this->getProperty("channel"));
$this->callMethod("sendCommand",array('command'=>'-off_ch'.$this->getProperty("channel")));$this->setProperty("status",1);
$this->callMethod("sendCommand",array('command'=>'-on_ch'.$this->getProperty("channel")));Свойства класса:
Методы класса:
$code1=$this->getProperty('Code1');
$code2=$this->getProperty('Code2');
safe_exec("c:\_majordomo\apps\arduino_gw\arduino_gw.exe rcon$code1:$code2;");
$this->setProperty("status",1);$code1=$this->getProperty('Code1');
$code2=$this->getProperty('Code2');
safe_exec("c:\_majordomo\apps\arduino_gw\arduino_gw.exe rcoff$code1:$code2;");
$this->setProperty("status",0);Свойства класса:
Методы класса:
$latestActivity=$this->getProperty('LatestActivity');
$this->setProperty('LatestActivity',time());
$this->setProperty('LatestActivityTime',date('H:i'));
$this->setProperty('SomebodyHere',1);
$ot=$this->object_title;
if ($this->getProperty("IdleDelay")) {
$activity_timeout=(int)$this->getProperty("IdleDelay");
} else {
$activity_timeout=10*60;
}
clearTimeOut($ot."_activity_timeout");
setTimeOut($ot."_activity_timeout","callMethod('".$ot.".onIdle');",$activity_timeout);
$this->callMethod("updateActivityStatus");
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/Rooms_onActivity.php');
/* end injection of {SDevices} */$this->callmethod('updateActivityStatus');
$this->setProperty('SomebodyHere',0);$rooms=getObjectsByClass("Rooms");
$total=count($rooms);
for($i=0;$i<$total;$i++) {
$rooms[$i]['room']=getGlobal($rooms[$i]['TITLE'].'.Title');
if (!$rooms[$i]['room']) {
$rooms[$i]['room']=$rooms[$i]['TITLE'];
}
$rooms[$i]['active']=getGlobal($rooms[$i]['TITLE'].'.SomebodyHere');
$rooms[$i]['time']=getGlobal($rooms[$i]['TITLE'].'.LatestActivity');
$rooms[$i]['diff']=time()-$rooms[$i]['time'];
}
function cmp($a, $b)
{
if ($a['diff'] == $b['diff']) {
return 0;
}
return ($a['diff'] < $b['diff']) ? -1 : 1;
}
usort($rooms,"cmp");
if (!$rooms[0]['active']) {
$somebodyHomeText="Никого нет дома. Были в ".date('H:i',$rooms[0]['time'])." (".$rooms[0]['room'].")";
} else {
$res_rooms=array();
for($i=0;$i<$total;$i++) {
if ($rooms[$i]['active']) {
$res_rooms[]=$rooms[$i]['room'];
}
}
$somebodyHomeText="Кто-то дома: ".implode(", ",$res_rooms);
}
setGlobal('somebodyHomeText',$somebodyHomeText);
//echo "Updated";Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SDevices_statusUpdated.php');
require(DIR_MODULES.'devices/SDevices_logicAction.php');
Методы класса:
require(DIR_MODULES.'devices/SButtons_pressed.php');
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SControllers_turnOn.php');
require(DIR_MODULES.'devices/SControllers_turnOff.php');
require(DIR_MODULES.'devices/SControllers_switch.php');
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SDimmers_levelUpdated.php');
require(DIR_MODULES.'devices/SDimmers_turnOn.php');
require(DIR_MODULES.'devices/SDimmers_turnOff.php');
Свойства класса:
Методы класса:
/* 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} */Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SMotions_motionDetected.php');
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SOpenClose_statusUpdated.php');
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SSensors_valueUpdated.php');
Методы класса:
Объекты класса:
echo "status received: ".$params['status'];
global $voicemode; $voicemode='off'; processCommand($params['message']);
Свойства класса:
Методы класса:
$this->setProperty("status",1);$this->setProperty("status",0);Объекты класса:
$url='http://192.168.0.120/command?6=OFF'; getURL($url,0);
if ((int)$params['status']==1 || (int)$params['VALUE']==1) {
$url='http://192.168.0.120/command?5=OFF';
getURL($url,0);
} else {
$url='http://192.168.0.120/command?5=ON';
getURL($url,0);
}$url='http://192.168.0.120/command?6=ON'; getURL($url,0);
if ((int)$params['status']==1 || (int)$params['VALUE']==1) {
$url='http://192.168.0.120/command?8=ON';
getURL($url,0);
} else {
$url='http://192.168.0.120/command?8=OFF';
getURL($url,0);
}$url='http://192.168.0.120/command?8=OFF'; getURL($url,0);
$url='http://192.168.0.120/command?8=ON'; getURL($url,0);
$url='http://192.168.0.120/command?9=ON'; getURL($url,0);
$url='http://192.168.0.120/command?9=OFF'; getURL($url,0);
if ((int)$params['status']==1 || (int)$params['VALUE']==1) {
$url='http://192.168.0.120/command?9=ON';
getURL($url,0);
} else {
$url='http://192.168.0.120/command?9=OFF';
getURL($url,0);
}$url='http://192.168.0.120/command?4=ON'; getURL($url,0);
if ((int)$params['status']==1 || (int)$params['VALUE']==1) {
$url='http://192.168.0.120/command?4=ON';
getURL($url,0);
} else {
$url='http://192.168.0.120/command?4=OFF';
getURL($url,0);
}$url='http://192.168.0.120/command?4=OFF'; getURL($url,0);
$url='http://192.168.0.120/command?6=OFF'; getURL($url,0);
if ((int)$params['status']==1 || (int)$params['VALUE']==1) {
$url='http://192.168.0.120/command?6=OFF';
getURL($url,0);
} else {
$url='http://192.168.0.120/command?6=ON';
getURL($url,0);
}$url='http://192.168.0.120/command?6=ON'; getURL($url,0);
$url='http://192.168.0.120/command?3=ON'; getURL($url,0);
$url='http://192.168.0.120/command?3=OFF'; getURL($url,0);
if ((int)$params['status']==1 || (int)$params['VALUE']==1) {
$url='http://192.168.0.120/command?3=ON';
getURL($url,0);
} else {
$url='http://192.168.0.120/command?3=OFF';
getURL($url,0);
}$url='http://192.168.0.120/command?7=ON'; getURL($url,0);
$url='http://192.168.0.120/command?7=OFF'; getURL($url,0);
if ((int)$params['status']==1 || (int)$params['VALUE']==1) {
$url='http://192.168.0.120/command?7=ON';
getURL($url,0);
} else {
$url='http://192.168.0.120/command?7=OFF';
getURL($url,0);
}$this->setProperty("status", 0);
file_get_contents("http://192.168.0.120/rgb?r=0&g=0&b=0");$red = $this->getProperty("Red");
$green = $this->getProperty("Green");
$blue = $this->getProperty("Blue");
$this->setProperty("status", 1);
file_get_contents("http://192.168.0.120/rgb?r={$red}&g={$green}&b={$blue}");if ((int)$params['status']==1 || (int)$params['VALUE']==1) {
callMethod("lightHallRGB.on");
} else {
callMethod("lightHallRGB.off");
}Свойства класса:
Методы класса:
Объекты класса:
$details=array();
$red_state=0;
$yellow_state=0;
if (!isOnline('ArduinoShild')) {
$yellow_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='green';
$state_title=LANG_GENERAL_GREEN;
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say(LANG_GENERAL_COMMUNICATION_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title.".");
say(implode(". ",$details));
} else {
say(LANG_GENERAL_COMMUNICATION_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title);
}
$this->callMethod('stateChanged');
}$details=array();
$red_state=0;
$yellow_state=0;
if (!isOnline('Internet')) {
$yellow_state=1;
$details[]=LANG_GENERAL_NO_INTERNET_ACCESS;
}
if ($red_state) {
$state='red';
$state_title=LANG_GENERAL_RED;
} elseif ($yellow_state) {
$state='yellow';
$state_title=LANG_GENERAL_YELLOW;
} else {
$state='green';
$state_title=LANG_GENERAL_GREEN;
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say(LANG_GENERAL_COMMUNICATION_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title.".");
say(implode(". ",$details));
} else {
say(LANG_GENERAL_COMMUNICATION_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title);
}
$this->callMethod('stateChanged');
}$details=array();
$red_state=0;
$yellow_state=0;
$cycles=array('states'=>'states','main'=>'main','execs'=>'exec','scheduler'=>'scheduler');
foreach($cycles as $k=>$v) {
$tm=getGlobal('ThisComputer.cycle_'.$k.'Run');
if (time()-$tm>5*60) {
$red_state=1;
$details[]=$v." ".LANG_GENERAL_CYCLE." ".LANG_GENERAL_STOPPED.".";
}
}
$cycles=array('ping'=>'ping','webvars'=>'webvars','watchfolders'=>'watch folders','rss'=>'RSS');
foreach($cycles as $k=>$v) {
$tm=getGlobal('ThisComputer.cycle_'.$k.'Run');
if (time()-$tm>10*60) {
$yellow_state=1;
$details[]=$v." ".LANG_GENERAL_CYCLE." ".LANG_GENERAL_STOPPED.".";
}
}
if ($red_state) {
$state='red';
$state_title=LANG_GENERAL_RED;
} elseif ($yellow_state) {
$state='yellow';
$state_title=LANG_GENERAL_YELLOW;
} else {
$state='green';
$state_title=LANG_GENERAL_GREEN;
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say(LANG_GENERAL_SYSTEM_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title.".");
say(implode(". ",$details));
} else {
say(LANG_GENERAL_SYSTEM_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title);
}
$this->callMethod('stateChanged');
}
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/system_checkstate.php');
/* end injection of {SDevices} */$details=array();
$red_state=0;
$yellow_state=0;
if ($red_state) {
$state='red';
$state_title=LANG_GENERAL_RED;
} elseif ($yellow_state) {
$state='yellow';
$state_title=LANG_GENERAL_YELLOW;
} else {
$state='green';
$state_title=LANG_GENERAL_GREEN;
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say(LANG_GENERAL_SECURITY_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title.".");
say(implode(". ",$details));
} else {
say(LANG_GENERAL_SECURITY_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title);
}
$this->callMethod('stateChanged');
}Свойства класса:
Методы класса:
//$params['t']
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date("H:i",time()));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=30*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
if (!isset($params['t'])) {
return;
}
$old_temp=$this->getProperty('temp');
$t=round($params['t'],1);
if ($t>110) return;
$this->setProperty('temp',$t);
if ($params['uptime']) {
$this->setProperty('uptime',$params['uptime']);
}
if ($t>$old_temp) {
$d=1;
} elseif ($t<$old_temp) {
$d=-1;
} else {
$d=0;
}
$this->setProperty('direction',$d);
$linked_room=$this->getProperty("LinkedRoom");
if ($linked_room) {
setGlobal($linked_room.'.Temperature',$t);
}Объекты класса:
Свойства класса:
Методы класса:
//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
//дни недели
$h=(int)date('G',time());
$day[0]="Воскресенье";
$day[1]="Понедельник";
$day[2]="Вторник";
$day[3]="Среда";
$day[4]="Четверг";
$day[5]="Пятница";
$day[6]="Суббота";
if (($h=="00")) {
sg("ThisComputer.Date",date( "d.m.Y", time()));
sg("ThisComputer.DaySK",$day[date("w")]);
}
// раскидываем дату и время если изменилось в Windows
$h=(int)date('G',time());
if (gg('ThisComputer.DateD')!=date("d", time())) {
$day[0]="воскресенье";
$day[1]="понедельник";
$day[2]="вторник";
$day[3]="среда";
$day[4]="четверг";
$day[5]="пятница";
$day[6]="суббота";
$month[1]="января";
$monthAlt[1]="ЯНВАРЬ";
$month[2]="февраля";
$monthAlt[2]="ФЕВРАЛЬ";
$month[3]="марта";
$monthAlt[3]="МАРТ";
$month[4]="апреля";
$monthAlt[4]="АПРЕЛЬ";
$month[5]="мая";
$monthAlt[5]="МАЙ";
$month[6]="июня";
$monthAlt[6]="ИЮНЬ";
$month[7]="июля";
$monthAlt[7]="ИЮЛЬ";
$month[8]="августа";
$monthAlt[8]="АВГУСТ";
$month[9]="сентября";
$monthAlt[9]="СЕНТЯБРЬ";
$month[10]="октября";
$monthAlt[10]="ОКТЯБРЬ";
$month[11]="ноября";
$monthAlt[11]="НОЯБРЬ";
$month[12]="декабря";
$monthAlt[12]="ДЕКАБРЬ";
sg("ThisComputer.DateD",date( "d", time()));
sg("ThisComputer.DateM",date( "m", time()));
sg("ThisComputer.DateY",date( "Y", time()));
sg("ThisComputer.Date",date( "d.m.Y", time()));
sg("ThisComputer.Day",$day[date("w")]);
sg("ThisComputer.Month",$month[date("n")]);
sg("ThisComputer.MonthAlt",$monthAlt[date("n")]);
}//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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Объекты класса:
$h=(int)date('G',time());
$m=date('i',time());
if (isWeekDay()) {
if (timeIs('23:52')) {
say('Пара ложиться спать',5); // просто проговорить фразу
}
}
if (($h>=8) && getGlobal('clockChimeEnabled')) {
if ($m=="00") {
say(timeNow(),1);
}
}
setGlobal('timeNow',date('H:i'));
$homeStatus=date('H:i');
if (getGlobal('NobodyHomeMode.active')) {
$homeStatus.=' Дома никого';
} else {
$homeStatus.=' Дома кто-то есть';
}
$homeStatus.=' '.getGlobal('Security.stateDetails');
$homeStatus.=' '.getGlobal('System.stateDetails');
$homeStatus.=' '.getGlobal('Communication.stateDetails');
setGlobal('HomeStatus',$homeStatus);
if (timeBetween(getGlobal('SunRiseTime'),getGlobal('SunSetTime')) && getGlobal('isDark')=="1") {
setGlobal("isDark",0);
callMethod('DarknessMode.deactivate');
} elseif (!timeBetween(getGlobal('SunRiseTime'),getGlobal('SunSetTime')) && getGlobal('isDark')!="1") {
setGlobal("isDark",1);
callMethod('DarknessMode.activate');
}
if (timeIs(getGlobal('SunRiseTime'))) {
say('Всходит солнце');
}
if (timeIs(getGlobal('SunSetTime'))) {
say('Солнце заходит',2);
}
if (timeIs("23:30") && (gg("EconomMode.active")!="1") && (gg("NobodyHomeMode.active")=="1")) {
say("Похоже никого нет сегодня, можно сэкономить немного.");
callMethod('EconomMode.activate');
}
if (timeIs('20:00')) {
callMethod('NightMode.activate');
} elseif (timeIs('08:00')) {
callMethod('NightMode.deactivate');
}
if (timeIs("03:00")) {
runScript("systemMaintenance");
}
if (gg('ThisComputer.AlarmStatus') && timeIs(gg('ThisComputer.AlarmTime'))) {
runScript('MorningAlarm');
}
//будильники
$objects=getObjectsByClass("AlarmClock");
foreach($objects as $obj) {
// переберем все будильники в системе
if (gg($obj['TITLE'].".AlarmOn") && timeIs(gg($obj['TITLE'].".AlarmTime"))) {
//если будильник включен и время совпало
callMethod($obj['TITLE'].".AlarmRun"); // выполним метод будильника
}
}
// получем ЧАСЫ и МИНУТЫ отдельно
$timeH=date("H", time());
$timeM=date("i", time());
sg("ThisComputer.timeH",$timeH);
sg("ThisComputer.timeM",$timeM);
if (timeIs('08:00'))
getURL('http://localhost/modules/app_postoffice/check_post.php',0);
if (timeIs('18:00'))
getURL('http://localhost/modules/app_postoffice/check_post.php',0); Методы класса:
Объекты класса:
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']);
}
}Свойства класса:
Методы класса:
$apiid = $this->getProperty("PhoneNumberAPI");
if ($apiid != ""){
$url="http://sms.ru/sms/send?api_id=".$apiid."&to=7".$this->getProperty("PhoneNumber")."&text=".urlencode($params['value']);
getURL($url,0);
}
//getUrl("http://sms.ru/sms/send?api_id=3C1E7977-C6F1-7634-121D-384FEAC57673&to=79213240005&text=hello+world");// Если ночь и кто-то дома то не оповещать
$night=getGlobal("NightMode.active");
$nobody=getGlobal("NightMode.active");
if (($night == 0) && ($nobody != 0)){
return;
}
//$this->callMethod("SendEMail", $params);
$this->callMethod("SendSMS", $params);Объекты класса:
Свойства класса:
Объекты класса:
Объекты класса:
, Россия