Методы класса:
Объекты класса:
// device lost //if ($params['user']=='admin') { //sg('admin.atHome',0); runScript('sendUserTelegram',$params['user']."вышел"); //}
// new device $tm=registeredEventTime('btcall'); if ((time()-$tm)>60 || $tm<0) { registerEvent('btcall'); } if ($params['new']) { //say('Обнаружено новое блютуз устройство'); } if ($params['user']=='admin') { //sg('admin.atHome',1); runScript('sendUserTelegram',"Тест BT дома"); //if(gg('EconomMode.active')==1) sg('EconomMode.active',0); }
setGlobal('Redmy'.'.'.'Status', '1'); setGlobal('Redmy'.'.'.'StatusText', 'Я дома');
Свойства класса:
Методы класса:
$volume=round(65535*$params['VALUE']/100); $this->setProperty('volumeLevel',$params['VALUE']); safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume); say("Изменилась громкость до ".$params['VALUE']." процентов");
Объекты класса:
say("Отключено питание");
$command=$params['command']; $short_command=''; $dt=recognizeTime($command,$short_command); if (preg_match('/скажи сколько врем/uis',$command)) { if ($dt>0) { addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt); say('Задача принята',2); return; } global $voicemode; $voicemode='on'; say('Сейчас '.timeNow(),2); } elseif (preg_match('/сколько время/uis',$command)) { if ($dt>0) { addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt); say('Задача принята'); echo $short_command; return; } say('Сейчас '.timeNow()); } elseif (preg_match('/повтори (.+)/uis',$command,$m) || preg_match('/скажи (.+)/uis',$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); }
if ($params['VALUE']){ $this->setProperty('volumeLevel',$params['VALUE']); } $volume = $this->getProperty('volumeLevel'); safe_exec('amixer set Master '.$volume.'% unmute'); //say("Изменилась громкость до ".$params['VALUE']." процентов");
Свойства класса:
Методы класса:
$this->setProperty('LastRun',date('Y-m-d H:i:s'));
$name='Cron_'.$this->object_title; SQLExec("DELETE FROM jobs WHERE title='".$name."'");
Объекты класса:
include(DIR_MODULES . 'backup/backup.class.php'); $backup_module = new backup(); $backup_module->create_backup();
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/processHomebridgeMQTT.inc.php');
Объекты класса:
Свойства класса:
Методы класса:
//$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=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'); // запускаем скрипт "доброе утро" } }
Методы класса:
Объекты класса:
require_once("./lib/OpenWeather/OpenWeather.php"); // Подключаем погодный класс $weather = new OpenWeather(); // наследуем класс $curWeather = $weather->GetWeather("ru","Moscow", "metric"); // получаем массив с данными о погоде $widget = $weather->GetCurrentWeatherWidget("ru","Moscow", "metric"); // html код с детализацией о погоде $temp = $curWeather->main->temp; // берём из массива температуру (7,19С) setGlobal('ThisComputer.TempOutside', $temp); // обновляем свойства setGlobal('ThisComputer.weatherFull', $widget); // обновляем свойства setGlobal('TempOutside.Temp', $temp); // обновляем свойства setGlobal('TempOutside.TempDetail', $widget); // обновляем свойства $this->setProperty('Temp',$temp); // обновляем свойства
Свойства класса:
Методы класса:
if ($params['NEW_VALUE']==$params['OLD_VALUE']) return; $this->setProperty("updated",time()); $this->setProperty("updatedTime",date('H:i')); $i=1; if ('WeekendMode.active' && ($this->getProperty('title')=='Темное время суток' || $this->getProperty('title')=='Ночной' || $this->getProperty('title')=='Никого нет дома')) $i=0; if ($this->getProperty('active')) { if ($this->getProperty('title')<>'auto') { say("Режим ".$this->getProperty('title')." активирован.",1); } } else { if ($this->getProperty('title')<>'auto') { say("Режим ".$this->getProperty('title')." выключен.",$i); } } Объекты класса:
$this->setProperty('active',1);
$this->setProperty('active',0);
Объекты класса:
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} */
$objects=getObjectsByProperty('groupSunrise','=','1'); if (is_array($objects)) { foreach($objects as $obj) { callMethod($obj.'.turnOff'); } } /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/darknessmode_deactivate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/darknessmode_activate.php'); /* end injection of {SDevices} */
$objects=getObjectsByProperty('groupEco','=','1'); if (is_array($objects)) { foreach($objects as $obj) { callMethod($obj.'.turnOff'); } } $objects=getObjectsByProperty('allOffGroup','=','1'); if (is_array($objects)) { foreach($objects as $obj) { callMethod($obj.'.turnOff'); } } /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/econommode_activate.php'); /* end injection of {SDevices} */
if (gg('DarknessMode.active')) { $objects=getObjectsByProperty('greetingOnGroup','=','1'); if (is_array($objects)) { foreach($objects as $obj) { callMethod($obj.'.turnOn'); } } } /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/econommode_deactivate.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/nobodyhomemode_activate.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
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); }
return; $this->callMethod("FadeIn");
return; $vol = getGlobal("RadioSetting.VolumeLevel"); $lastvol = getGlobal("RadioSetting.MuteLastVol"); //DebMes("FadeIn:".$vol."|".$lastvol); if ($vol+10 >= $lastvol) { // Устанавливаем последнюю громкость callMethod("RadioSetting.Control",array("vol"=>$lastvol)); // Выключаем признак setGlobal("RadioSetting.Mute", 0); } else { // Устанавливаем громкость callMethod("RadioSetting.Control",array("vol"=>$vol+10)); // Планируем запуск через 1 сек SetTimeOut("RadioFadeIn", 'callMethod("RadioSetting.FadeIn");', 1); }
return; // Останавлимваем таймеры ClearTimeOut("RadioFadeIn"); $mute = $this->getProperty("Mute"); if ($mute != 1){ // Сохраняем прошлую громкость $vol = $this->getProperty("VolumeLevel"); $this->SetProperty("LastRadioVolume", $vol); // Устанавливаем признак $this->SetProperty("Mute", 1); } // Установка громкости $mutvol = getGlobal("RadioSetting.MutVol"); if ($vol > $mutvol){ cm('RadioSetting.Control',array('vol'=>$mutvol)); }
Объекты класса:
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); }
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('turnOff'); } else { $this->callMethod('turnOn'); }
$this->setProperty("status",0);
$status=$this->getProperty("status"); if ($status) { $this->callMethod('turnOn'); } else { $this->callMethod('turnOff'); }
$this->setProperty("status",1);
Свойства класса:
Методы класса:
$latestActivity=$this->getProperty('LatestActivity'); $this->setProperty('LatestActivity',time()); $this->setProperty('LatestActivityTime',date('H:i')); if (!$this->getProperty('SomebodyHere')) { $this->setProperty('SomebodyHere',1); $this->callMethod('onNewActivity'); if ((time()-$latestActivity)>1*60*60) { $this->callMethod('onNewActivityLong'); } } /* $camera=$this->getProperty('LinkedCamera'); if ($camera) { callMethod($camera.'.activate'); } */ $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"); if ($this->object_title=='Bedroom' && timeBetween('23:00', '09:00')) { return; // не реагируем на движение в спальне } if (($this->object_title=='Kidroom' || $this->object_title=='GuestRoom' || $this->object_title=='Hall2' || 0 ) && getGlobal('NobodyHomeMode.active')) { return; // не реагируем внутренние датчики, если никого нет дома } ClearTimeOut("nobodyHome"); SetTimeOut("nobodyHome","callMethod('NobodyHomeMode.activate');", 1*60*60); // выполняем если целый час никого не было if (getGlobal('NobodyHomeMode.active')) { callMethod('NobodyHomeMode.deactivate',array('sensor'=>$params['sensor'],'room'=>$ot)); } $last_register=registeredEventTime('inhouseMovement'); // проверяем когда в последний раз срабатывало событие "движение внутри дома" registerEvent('inhouseMovement',$this->name,2); // регистрируем событие "движение внутри дома" if (!$last_register || ((time()-$last_register)>2*60*60)) { // срабатывало более 2х часов назад // if (timeBetween('06:00', '12:00')) { // движение замечено утром // runScript('morningGreeting'); // запускаем скрипт "доброе утро" // } } /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_onActivity.php'); /* end injection of {SDevices} */
$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"; /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_updateActivityStatus.php'); /* end injection of {SDevices} */
$this->setProperty('SomebodyHere',0); $this->callMethod("updateActivityStatus"); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_onIdle.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_setUpdatedText.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SDevices_logicAction.php');
require(DIR_MODULES.'devices/SDevices_statusUpdated.php');
Методы класса:
require(DIR_MODULES.'devices/SButtons_pressed.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCameras_takeSnapshot.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_updatePreview.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');
Свойства класса:
Методы класса:
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} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_valueUpdated.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_tempUp.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/SCounters_valueUpdated.php'); /* end injection of {SDevices} */
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_statusUpdated.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');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_statusUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
Объекты класса:
$details=array(); $red_state=0; $yellow_state=0; if (!isOnline('Internet')) { $yellow_state=1; // $details[]=LANG_GENERAL_NO_INTERNET_ACCESS; } if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; } else { $state='green'; $state_title=LANG_GENERAL_GREEN; } $new_details=implode(". ",$details); if ($this->getProperty("stateDetails")!=$new_details) { $this->setProperty('stateDetails',$new_details); } if ($this->getProperty('stateColor')!=$state) { $this->setProperty('stateColor',$state); $this->setProperty('stateTitle',$state_title); if ($state!='green') { say(LANG_GENERAL_COMMUNICATION_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title."."); say(implode(". ",$details)); } else { say(LANG_GENERAL_COMMUNICATION_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title); } $this->callMethod('stateChanged'); }
$details=array(); $red_state=0; $yellow_state=0; $cycles=array('states'=>'states','main'=>'main','execs'=>'exec','scheduler'=>'scheduler'); foreach($cycles as $k=>$v) { $tm=getGlobal('ThisComputer.cycle_'.$k.'Run'); if (time()-$tm>5*60) { $red_state=1; $details[]=$v." ".LANG_GENERAL_CYCLE." ".LANG_GENERAL_STOPPED."."; } } $cycles=array('ping'=>'ping','webvars'=>'webvars'); foreach($cycles as $k=>$v) { $tm=getGlobal('ThisComputer.cycle_'.$k.'Run'); if (time()-$tm>10*60) { $yellow_state=1; $details[]=$v." ".LANG_GENERAL_CYCLE." ".LANG_GENERAL_STOPPED."."; } } if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; } else { $state='green'; $state_title=LANG_GENERAL_GREEN; } $new_details=implode(". ",$details); if ($this->getProperty("stateDetails")!=$new_details) { $this->setProperty('stateDetails',$new_details); } if ($this->getProperty('stateColor')!=$state) { $this->setProperty('stateColor',$state); $this->setProperty('stateTitle',$state_title); if ($state!='green') { say(LANG_GENERAL_SYSTEM_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title."."); say(implode(". ",$details)); } else { say(LANG_GENERAL_SYSTEM_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title); } $this->callMethod('stateChanged'); } /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/system_checkstate.php'); /* end injection of {SDevices} */
$details=array(); $red_state=0; $yellow_state=0; if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; } else { $state='green'; $state_title=LANG_GENERAL_GREEN; } $new_details=implode(". ",$details); if ($this->getProperty("stateDetails")!=$new_details) { $this->setProperty('stateDetails',$new_details); } if ($this->getProperty('stateColor')!=$state) { $this->setProperty('stateColor',$state); $this->setProperty('stateTitle',$state_title); if ($state!='green') { say(LANG_GENERAL_SECURITY_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title."."); say(implode(". ",$details)); } else { say(LANG_GENERAL_SECURITY_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title); } $this->callMethod('stateChanged'); }
Свойства класса:
Методы класса:
//$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//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
Объекты класса:
$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'); runScript('OpenWeather');
$h=(int)date('G',time()); $m=date('i',time()); if (isWeekDay()) { } if (timeBetween(getGlobal('NightModeEnd'),getGlobal('NightModeStart')) && 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(gg('NightModeStart'))) { callMethod('NightMode.activate'); } elseif (timeIs(gg('NightModeEnd'))) { callMethod('NightMode.deactivate'); } if (timeIs("03:00")) { runScript("systemMaintenance"); } if (gg('ThisComputer.AlarmStatus') && timeIs(gg('ThisComputer.AlarmTime'))) { runScript('MorningAlarm'); }
Методы класса:
Объекты класса:
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']); } }
Свойства класса:
Методы класса:
//$params["LOCATION_OBJECT"], $params["LOCATION"]
//$params["LOCATION_OBJECT"], $params["LOCATION"]
//$xy=gg($this->object_title.'.Coordinates'); $xy=$this->getProperty("Coordinates"); //$adr=getadrfromxy($xy); $axy=explode(',',$xy) ; $par=array('zapros' => array($axy[0],$axy[1])); //$par=array('zapros' => array('36.8381656','60.6197382')); $adr=runScript('getaddrfromcoord', $par); //$adr=runScript('getaddrfromcoord', array('zapros' => array('36.8381656','60.6197382'))); sg($this->object_title.'.address', $adr); $spl=explode(',',$adr) ; sg($this->object_title.'.short_address', $spl[0]); /////// sg($this.'.address', $adr); $spl=explode(',',$adr) ; sg($this.'.short_address', $spl[0]);
if ($this->HomeDistanceKm<1) {sg($this->homeColor,'green');} else {sg($this->homeColor,'red');}
$this->setProperty('atHome',1);
$this->setProperty('atHome',1);
Объекты класса:
, Россия
На форуме: pervyhe
© 2025 - Site Built By SergeJey | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving