Свойства класса:
Методы класса:
$volume=round(65535*$params['VALUE']/100);
$this->setProperty('volumeLevel',$params['VALUE']);
safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume);
// ожидание в течении 1 секунды
sleep(1);
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("Отключено питание");//$VALUE=getGlobal('ThisComputer.VolumeLevel');
//$this->setProperty('volumeLevel',$params['VALUE']);
//safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume);
//say("Изменилась громкость до ".$VALUE." процентов");
//$volume=round(65535*$params['VALUE']/100);
//$this->setProperty('volumeLevel',$params['VALUE']);
//safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume);
//$volume=round(65535*$VALUE/100);
$VALUE=getGlobal('ThisComputer.VolumeLevel');
safe_exec('amixer -c 0 -q set PCM '.$VALUE.'% unmute');
//setGlobal('ThisComputer.MasterVolume', $VALUE);
say("Изменилась громкость до ".$VALUE." процентов");Свойства класса:
Методы класса:
/*$CounterESP = getGlobal('WaterHot.CounterESP');
$Counter10 = getGlobal('WaterHot.Counter10');
$Counter = getGlobal('WaterHot.Counter');
if($CounterESP>$Counter10){
setGlobal('WaterHot.Counter10', $CounterESP);
setGlobal('WaterHot.Counter', $Counter + ($CounterESP/100));
}
$CounterESP = getGlobal('WaterCold.CounterESP');
$Counter10 = getGlobal('WaterCold.Counter10');
$Counter = getGlobal('WaterCold.Counter');
if($CounterESP>$Counter10){
setGlobal('WaterCold.Counter10', $CounterESP);
setGlobal('WaterCold.Counter', $Counter + ($CounterESP/100));
}*/Объекты класса:
$CounterESP = getGlobal('WaterСold.CounterESP');
$Counter10 = getGlobal('WaterСold.Counter10');
$Counter = getGlobal('WaterСold.Counter');
// if($CounterESP>$Counter10){
//setGlobal('WaterСold.Counter10', $CounterESP);
setGlobal('WaterСold.Counter10', $Counter10+1);
setGlobal('WaterСold.Counter', $Counter + ($CounterESP/100));
setGlobal('WaterСold.DateUpdated', timeNow());
// }
//else
//{
//setGlobal('WaterСold.Counter10', $Counter10);
//}//$tmp = getGlobal('WaterHot.Counter10');
//setGlobal('WaterHot.Counter', 957.40 + ($tmp/100));
//$tmp = getGlobal('ESP02/cold');
//setGlobal('WaterHot.Counter', 957.40 + ($tmp/100));
$CounterESP = getGlobal('WaterHot.CounterESP');
$Counter10 = getGlobal('WaterHot.Counter10');
$Counter = getGlobal('WaterHot.Counter');
// if($CounterESP>$Counter10){
setGlobal('WaterHot.Counter10', $Counter10+1);
setGlobal('WaterHot.Counter', $Counter + ($CounterESP/100));
setGlobal('WaterHot.DateUpdated', timeNow());
//}
//else
//{
// setGlobal('WaterHot.Counter10', $Counter10);
//}
Свойства класса:
Методы класса:
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 (!isset($params['status'])) {
$params['status']=1;
}
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');
}
ClearTimeOut("nobodyHome");
SetTimeOut("nobodyHome","callMethod('NobodyHomeMode.activate');", 1*60*60); // выполняем если целый час никого не было
if (getGlobal('NobodyHomeMode.active')) {
callMethod('NobodyHomeMode.deactivate');
}
}Объекты класса:
Свойства класса:
Методы класса:
Объекты класса:
$tempYesterday = getHistoryValue("ow_fact.temperature", strtotime("-1 day"), true);
sg("ow_fact.tempYesterday", $tempYesterday);
//Расчет температуры "По ощущениям"
$t = gg('ow_fact.temperature'); // температура на улице
$h = gg('ow_fact.humidity'); // влажность на улице %
$w = gg('ow_fact.wind_speed'); // данные о ветре из прогноза OpenWeather m/s
$w = $w*3.6/1.609;//m/s -> mph
$tF = $t *1.8+32; // перевод температуры в Farenheit
if ($t > 26.6) { // Считаем HeatIndex по Rothfusz
$_f = -42.379 + 2.04901523*$tF + 10.14333127*$h - 0.22475541*$tF*$h - 0.00683783*$tF*$tF - 0.05481717*$h*$h + 0.00122874*$tF*$tF*$h + 0.00085282*$tF*$h*$h -0.00000199*$tF*$tF*$h*$h;
if(($tF < 112) && ( $h<13 )) { // If the RH is less than 13% and the temperature is between 80 and 112 degrees F, then the following adjustment is subtracted from HI:
$_f = $_f-((13-$h)/4)*sqrt((17-abs($tF-95.))/17);
}
if(($tF < 88) && ($h > 85)) { // On the other hand, if the RH is greater than 85% and the temperature is between 80 and 87 degrees F, then the following adjustment is added to HI:
$_f = $_f + (($h - 85) / 10) * ((87 - $tF) / 5); //ADJUSTMENT = [(RH-85)/10] * [(87-T)/5]
}
} else if ($t <= 10) { // Считаем фактор WindChild
$_f = 35.74 + (0.6215 * $tF) - (35.75 * pow($w, 0.16)) + ((0.4275 * $tF) * pow($w, 0.16));
} else { //считаем по упрощенной формуле
$_f = 0.5*($tF+61+(($tF-68)*1.2)+($h*0.094));
}
// переводим в цельсии
$rf = round(($_f-32)/1.8,1);
sg("ow_fact.realFell", $rf);Свойства класса:
Методы класса:
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date('H:i'));
if ($this->getProperty('active')) {
say("Режим ".$this->getProperty('title')." активирован.");
} else {
say("Режим ".$this->getProperty('title')." выключен.");
}$this->setProperty('active',1);$this->setProperty('active',0);Объекты класса:
setGlobal('minMsgLevel','2');
/* 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/econommode_activate.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/nobodyhomemode_activate.php');
/* end injection of {SDevices} */
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/nobodyhomemode_deactivate.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
$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);Объекты класса:
getURL('http://192.168.1.50/gpio?st=1&pin=15', 0);getURL('http://192.168.1.50/gpio?st=0&pin=15', 0);brLinkCommand('off_Main_light_bedroom');brLinkCommand('on_Main_light_bedroom');Свойства класса:
Методы класса:
$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->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";
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/Rooms_updateActivityStatus.php');
/* end injection of {SDevices} */Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SDevices_statusUpdated.php');
require(DIR_MODULES.'devices/SDevices_logicAction.php');
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SDevices_setUpdatedText.php');
/* end injection of {SDevices} */Методы класса:
require(DIR_MODULES.'devices/SButtons_pressed.php');
Объекты класса:
Свойства класса:
Методы класса:
/* 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} *//* 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');
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SDimmers_levelUpdated.php');
require(DIR_MODULES.'devices/SDimmers_turnOn.php');
require(DIR_MODULES.'devices/SDimmers_turnOff.php');
Объекты класса:
//brLinkCommand('switch_left_light_bedroom');//brLinkCommand('switch_Main_light_bedroom');//brLinkCommand('switch_right_light_bedroom');Свойства класса:
Методы класса:
/* 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/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} */Свойства класса:
Методы класса:
//$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=2*60*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
if (!isset($params['v'])) {
return;
}
$old_v=$this->getProperty('value');
$v=round($params['v'],1);
$this->setProperty('value',$v);
if ($params['uptime']) {
$this->setProperty('uptime',$params['uptime']);
}
if ($v>$old_v) {
$d=1;
} elseif ($v<$old_v) {
$d=-1;
} else {
$d=0;
}
$this->setProperty('direction',$d);
/*
$linked_room=$this->getProperty("LinkedRoom");
if ($linked_room) {
setGlobal($linked_room.'.Temperature',$v);
}
*/Свойства класса:
Методы класса:
Объекты класса:
$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');
}$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 ((int)gg('ThisComputer.SpaceProblems')>0) {
$red_state=1;
$details[]="Недостаточно места на диске (".gg('ThisComputer.SpaceProblems_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_SYSTEM_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title.".");
say(implode(". ",$details),2);
} else {
say(LANG_GENERAL_SYSTEM_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title,2);
}
$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 (!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');
}Свойства класса:
Методы класса:
//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 yaWeather module*/
/*$updateTime = gg('yw_setting.updateTime');
if($updateTime > 0){
$count = gg('yw_setting.countTime');
if($count >= $updateTime){
include_once(DIR_MODULES.'app_yaweather/app_yaweather.class.php');
$app_yaweather=new app_yaweather();
$app_yaweather->get_weather(gg('yw_setting.city_id'));
sg('yw_setting.countTime',1);
} else {
$count++;
sg('yw_setting.countTime',$count);
}
}*/ /* END yaWeather*/Объекты класса:
$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');
}
//Обновление состояний устройств broadlik
//if ($m!='00') {
//include_once(DIR_MODULES."dev_broadlink/dev_broadlink.class.php");
//$dev_broadlink=new dev_broadlink();
//$dev_broadlink->check_params();
//}
//уровень заряда батареи
runScript('BatteryChargeNotifications');
$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');
//Обновляем время восхода и время заката
setGlobal('ThisComputer.SunRiseTime', date('H:i',gg('ow_fact.sunrise')));
setGlobal('ThisComputer.SunSetTime', date('H:i',gg('ow_fact.sunset')));
//Обновляем значение погоды за вчера
if (timeIs("13:00")) { sg('ow_fact.tempYesterday',gg('ow_fact.temperature'));}
Свойства класса:
Объекты класса:
Методы класса:
Объекты класса:
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']);
}
}Объекты класса:
, Россия
На форуме: Alex77
© 2026 SJLab | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving