Свойства класса:
Методы класса:
$this->setProperty('lastTimestamp',time()); $user_id = intval($this->getProperty('user')); if ($user_id) { $user = SQLSelectOne("SELECT * FROM users WHERE ID=".$user_id); $obj = $user['LINKED_OBJECT']; if ($obj) { cm($obj.'.gotHome'); } }
Объекты класса:
Свойства класса:
Методы класса:
include_once(DIR_MODULES . 'telegram/telegram.class.php'); $telegram_module = new telegram(); $telegram_module->sendMessageToAll('Ошибка пылесоса: '.gg('Cleaner.error_code').' '.gg('Cleaner.error_text'));
include_once(DIR_MODULES . 'telegram/telegram.class.php'); $state = gg('Cleaner.state'); $state_text = gg('Cleaner.state_text'); if ($state == 3) $state_text = 'Ожидаю команды'; elseif ($state == 5) $state_text = 'Начал уборку'; elseif ($state == 6) $state_text = 'Возвращаюсь домой'; elseif ($state == 8) $state_text = 'Заряжаюсь'; elseif ($state == 10) $state_text = 'Остановил уборку'; elseif ($state == 11) $state_text = 'Убираю часть комнаты'; elseif ($state == 16) $state_text = 'Иду к цели'; elseif ($state == 17) $state_text = 'Убираю зону'; else $state_text = $state.' '.$state_text; $telegram_module = new telegram(); $telegram_module->sendMessageToAll('Пылесос: '.$state_text);
sg('Cleaner.command','find_me');
sg('Cleaner.command','app_charge');
sg('Cleaner. command','app_start');
sg('Cleaner.command','app_pause');
sg('Cleaner.command','app_spot');
sg('Cleaner.command','app_stop');
//{"result":["ok"],"id":45145710} $result = gg('Cleaner.result'); $result = @json_decode($result,1); if ($result && $result['result']) { if ($result['result'][0] == 'ok') { include_once(DIR_MODULES . 'telegram/telegram.class.php'); $telegram_module = new telegram(); $telegram_module->sendMessageToAll('Пылесос: Команда принята'); } }
Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty('volumeLevel',$params['VALUE']); if (IsWindowsOs()) { $volume=round(65535*$params['VALUE']/100); safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume); } else { safe_exec('amixer sset PCM,0 '.$params['VALUE'].'%'); } say("Изменилась громкость до ".$params['VALUE']." процентов");
Объекты класса:
$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); }
say("Отключено питание");
Свойства класса:
Методы класса:
$this->setProperty('LastRun',date('Y-m-d H:i:s'));
$name='Cron_'.$this->object_title; SQLExec("DELETE FROM jobs WHERE title='".$name."'");
Свойства класса:
Методы класса:
//$params["USER_OBJECT"]
//$params["USER_OBJECT"]
Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/processHomebridgeMQTT.inc.php');
Объекты класса:
Свойства класса:
Методы класса:
$ip = $this->getProperty('ip'); $token = $this->getProperty('token'); $code = $params['code'] ? $params['code'] : $this->getProperty('code'); echo getURL('http://localhost/ajax/xiaomimiio.html?op=test_api_cmd&dip='.$ip.'&dtoken='.$token.'&dcmd=miIO.ir_play&dopt={"freq":"38400","code":"'.$code.'"}');
$ip = $this->getProperty('ip'); $token = $this->getProperty('token'); $this->setProperty('code', ''); $result = getURL('http://localhost/ajax/xiaomimiio.html?op=test_api_cmd&dip='.$ip.'&dtoken='.$token.'&dcmd=miIO.ir_read&dopt={"key":"1"}'); $result = json_decode($result,1); if ($result && $result['result'] && $result['result']['code']) { echo $result['result']['code']; $this->setProperty('code',$result['result']['code']); } else { var_dump($result); }
//variable $ip; //variable $token; $ip = $this->getProperty('ip'); $token = $this->getProperty('token'); getURL('http://localhost/ajax/xiaomimiio.html?op=test_api_cmd&dip='.$ip.'&dtoken='.$token.'&dcmd=miIO.ir_learn&dopt={"key":"1"}');
Объекты класса:
Свойства класса:
Методы класса:
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'); } }
Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty('active',1);
$this->setProperty('active',0);
$this->setProperty("updated",time()); $this->setProperty("updatedTime",date('H:i')); if ($this->getProperty('active')) { say("Режим ".$this->getProperty('title')." активирован."); } else { say("Режим ".$this->getProperty('title')." выключен."); }
Объекты класса:
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} */
$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_activate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_deactivate.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
$this->setProperty("status",0);
$this->setProperty("status",1);
$status=$this->getProperty("status"); if ($status) { $this->callMethod('turnOff'); } else { $this->callMethod('turnOn'); }
$status=$this->getProperty("status"); if ($status) { $this->callMethod('turnOn'); } else { $this->callMethod('turnOff'); }
Свойства класса:
Методы класса:
$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} */
$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); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_onIdle.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
$this->callMethod('refresh_status'); if ($this->getProperty('status') == 0) { cm('IR_Remote.play', array('code'=>'Z6VDADACAACJBgAAhhEAAKURAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjEBAQAAAAAAAQEBAAAAAAAAAQAAAAAAAAEAAQEBAQEBAA')); $this->setProperty('status',1); sleep(3); for($i=0;$i<=50;$i++) { $this->callMethod('RunAction', array('key'=>'VOLDOWN')); usleep(100000); } for($i=0;$i<=6;$i++) { $this->callMethod('RunAction', array('key'=>'VOLUP')); usleep(100000); } }
$this->callMethod('refresh_status'); if ($this->getProperty('status') == 1) { cm('IR_Remote.play', array('code'=>'Z6VDADACAACJBgAAhhEAAKURAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjEBAQAAAAAAAQEBAAAAAAAAAQAAAAAAAAEAAQEBAQEBAA')); $this->setProperty('status',0); }
$this->callMethod('refresh_status'); if ($this->getProperty('status') == 0) { $this->callMethod('turnOn'); } else { $this->callMethod('turnOff'); }
//error_reporting(E_ALL); $tvip = $this->getProperty('ip');//"192.168.1.96"; //ЗАМЕНИТЬ!!! $myip = "192.168.1.200"; //ЗАМЕНИТЬ!!! $mymac = "b8-27-eb-cd-ab-f3"; // Я менял, думаю надо. $appstring = "iphone..iapp.samsung"; //Оставляем $tvappstring = "iphone.".($this->getProperty('model')).".iapp.samsung"; //Я вставил свою модель $remotename = "Home Samsung Remote"; //Оставляем echo "Content-type: text/html\n\n"; $sock = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 1, 'usec' => 0)); socket_set_option($sock, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 1, 'usec' => 0)); $result = socket_connect($sock, $tvip, '55000'); if( $result === false) { $this->setProperty('status',0); } else { $this->setProperty('status',1); }
//error_reporting(E_ALL); $tvip = $this->getProperty('ip');//"192.168.1.96"; //ЗАМЕНИТЬ!!! $myip = "192.168.1.200"; //ЗАМЕНИТЬ!!! $mymac = "b8-27-eb-cd-ab-f3"; // Я менял, думаю надо. $appstring = "iphone..iapp.samsung"; //Оставляем $tvappstring = "iphone.".($this->getProperty('model')).".iapp.samsung"; //Я вставил свою модель $remotename = "Home Samsung Remote"; //Оставляем echo "Content-type: text/html\n\n"; $sock = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); $result = socket_connect($sock, $tvip, '55000'); if( $result === false) { $this->setProperty('status',0); return; } //Normal remote keys //KEY_0 //KEY_1 //KEY_2 //KEY_3 //KEY_4 //KEY_5 //KEY_6 //KEY_7 //KEY_8 //KEY_9 //KEY_UP //KEY_DOWN //KEY_LEFT //KEY_RIGHT //KEY_MENU //KEY_PRECH //KEY_GUIDE //KEY_INFO //KEY_RETURN //KEY_CH_LIST //KEY_EXIT //KEY_ENTER //KEY_SOURCE //KEY_AD //KEY_PLAY //KEY_PAUSE //KEY_MUTE //KEY_PICTURE_SIZE //KEY_VOLUP //KEY_VOLDOWN //KEY_TOOLS //KEY_POWEROFF //KEY_CHUP //KEY_CHDOWN //KEY_CONTENTS //KEY_W_LINK //Media P //KEY_RSS //Internet //KEY_MTS //Dual //KEY_CAPTION //Subt //KEY_REWIND //KEY_FF //KEY_REC //KEY_STOP //Bonus buttons not on the normal remote: //KEY_TV //Don't work/wrong codes: //KEY_CONTENT //KEY_INTERNET //KEY_PC //KEY_HDMI1 //KEY_OFF //KEY_POWER //KEY_STANDBY //KEY_DUAL //KEY_SUBT //KEY_CHANUP //KEY_CHAN_UP //KEY_PROGUP //KEY_PROG_UP $ipencoded = base64_encode($myip); $macencoded = base64_encode($mymac); $messagepart1 = chr(0x64) . chr(0x00) . chr(strlen($ipencoded)) . chr(0x00) . $ipencoded . chr(strlen($macencoded)) . chr(0x00) . $macencoded . chr(strlen(base64_encode($remotename))) . chr(0x00) . base64_encode($remotename); $part1 = chr(0x00) . chr(strlen($appstring)) . chr(0x00) . $appstring . chr(strlen($messagepart1)) . chr(0x00) . $messagepart1; socket_write($sock, $part1, strlen($part1)); echo $part1; echo "\n"; $messagepart2 = chr(0xc8) . chr(0x00); $part2 = chr(0x00) . chr(strlen($appstring)) . chr(0x00) . $appstring . chr(strlen($messagepart2)) . chr(0x00) . $messagepart2; socket_write($sock, $part2, strlen($part2)); echo $part2; echo "\n"; //Preceding sections all first time only if (isset($params['key'])) { //Send remote key $key = "KEY_" . $params["key"]; $messagepart3 = chr(0x00) . chr(0x00) . chr(0x00) . chr(strlen(base64_encode($key))) . chr(0x00) . base64_encode($key); $part3 = chr(0x00) . chr(strlen($tvappstring)) . chr(0x00) . $tvappstring . chr(strlen($messagepart3)) . chr(0x00) . $messagepart3; socket_write($sock,$part3,strlen($part3)); echo $part3; echo "\n"; } else if (isset($params["text"])) { //Send text, e.g. in YouTube app's search, N.B. NOT BBC iPlayer app. $text = $params["text"]; $messagepart3 = chr(0x01) . chr(0x00) . chr(strlen(base64_encode($text, ""))) . chr(0x00) . base64_encode($text, ""); $part3 = chr(0x01) . chr(strlen($appstring)) . chr(0x00) . $appstring . chr(strlen($messagepart3)) . chr(0x00) . $messagepart3; socket_write($sock,$part3,strlen($part3)); echo $part3; echo "\n"; } socket_close($sock); echo "\n\n";
Объекты класса:
sg('Relay19.status',$this->getProperty('status'));
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_setUpdatedText.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SDevices_statusUpdated.php');
require(DIR_MODULES.'devices/SDevices_logicAction.php');
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SButtons_pressed.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCameras_takeSeries.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCameras_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_switch.php');
require(DIR_MODULES.'devices/SControllers_turnOff.php');
require(DIR_MODULES.'devices/SControllers_turnOn.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_levelWorkUpdated.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SDimmers_turnOn.php');
require(DIR_MODULES.'devices/SDimmers_turnOff.php');
require(DIR_MODULES.'devices/SDimmers_levelUpdated.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_switch.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_turnOn.php'); /* end injection of {SDevices} */
Свойства класса:
Объекты класса:
cm('TV1.switch');
cm('TV1.turnOn');
cm('TV1.turnOff');
file_get_contents("http://192.168.1.110/?lednum=3&ledstate=1");
file_get_contents("http://192.168.1.110/?lednum=3&ledstate=0");
file_get_contents("http://192.168.1.110/?lednum=2&ledstate=0");
file_get_contents("http://192.168.1.110/?lednum=2&ledstate=1");
file_get_contents("http://192.168.1.110/?lednum=4&ledstate=0");
file_get_contents("http://192.168.1.110/?lednum=4&ledstate=1");
$status = $this->getProperty('status'); if ($status != 0) { cm('Сonditioner.run', array('prop' => 'on')); } else { cm('Сonditioner.run', array('prop' => 'off')); }
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SRGB_turnOff.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_setColor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SRGB_colorUpdated.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_switchEnable.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_enable.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_disable.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_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_refreshStats.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCounters_valueWorkUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/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');
Объекты класса:
/* // Включить свет if (gg('Light_09.status') != 1 && gg('XiMotion01.status') == 1) { callMethod('Light_09.turnOn'); } */ //Выключить Свет if (gg('Light_09.status') == 1 && gg('XiMotion01.status') != 1) { callMethod('Light_09.turnOff'); }
$ot=$this->object_title; if (!isset($params['statusUpdated'])) { setTimeout($ot.'_motion_timer_status', '', 3); } if (isset($params['VALUE']) && !$params['VALUE'] && !isset($params['statusUpdated'])) { $this->setProperty('status', 0); return; } $motion_timeout=$this->getProperty('timeout'); // seconds timeout if (!$motion_timeout) { $motion_timeout=20; // timeout by default } $nobodysHome=getGlobal('NobodyHomeMode.active'); if (!isset($params['statusUpdated'])) { $this->setProperty('status', 1); } setTimeout($ot.'_motion_timer', 'setGlobal("'.$ot.'.status", 0);', $motion_timeout); if ($nobodysHome && $this->getProperty('ignoreNobodysHome')) { return; } $this->callMethod('logicAction'); $linked_room=$this->getProperty('linkedRoom'); if ($nobodysHome) { callMethodSafe('NobodyHomeMode.deactivate', array('sensor'=>$ot, 'room'=>$linked_room)); } //ClearTimeOut("nobodyHome"); //SetTimeOut("nobodyHome","callMethodSafe('NobodyHomeMode.activate');", 1*60*60); if ($linked_room) { callMethodSafe($linked_room.'.onActivity', array('sensor'=>$ot)); }
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SOpenClose_statusUpdated.php');
Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SSensors_valueUpdated.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SBatterySensors_valueWorkVoltageUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SBatterySensors_valueVoltageUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SBatterySensors_valueUpdated.php'); /* end injection of {SDevices} */ $normal = $this->getProperty('normalValue'); $objects = $this->getProperty('LinkedDevices'); $objects = explode(',',$objects); foreach($objects as $obj) { sg($obj.'.StatusLowBattery', $normal ? 0: 1); }
Объекты класса:
Свойства класса:
Объекты класса:
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SPowerSensors_loadStatusChanged.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SPowerSensors_valueUpdated.php'); /* end injection of {SDevices} */
Объекты класса:
if ($this->getProperty('value') != 0) { say('У нас утечка газа! Нужно открыть окна!', 2); }
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/STempHumSensors_valueUpdated.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
$normal = $this->getProperty('normalValue'); $objects = $this->getProperty('LinkedDevices'); $objects = explode(',',$objects); foreach($objects as $obj) { sg($obj.'.StatusLowBattery', $normal ? 0: 1); }
$this->setProperty('value',($this->getProperty('value_1000')/1000));
Методы класса:
/* 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; $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'); }
$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'); }
Свойства класса:
Методы класса:
//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');
$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')); setGlobal('DayOfMonthNum',date('d')); $month = array(1=>'Янв','Фев','Мар','Апр','Май','Июн','Июл','Авг','Сен','Окт','Ноя','Дек'); $weeks = array(1=>'Понедельник','Вторник','Среда','Четверг','Пятница','Суббота','Воскресение'); setGlobal('MonthTXTalt',$month[date('n')]); setGlobal('DayOfWeekTXT',$weeks[date('N')]); $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'); sg("DarknessMode.active",0); } elseif (!timeBetween(getGlobal('SunRiseTime'),getGlobal('SunSetTime')) && getGlobal('isDark')!="1") { setGlobal("isDark",1); callMethod('DarknessMode.activate'); sg("DarknessMode.active",1); } 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'); } runScript('Minutes');
Свойства класса:
Методы класса:
Свойства класса:
Объекты класса:
Методы класса:
Объекты класса:
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"]
if ($this->getProperty("atHome") == 0) { say(($this->object_description ? $this->object_description : $this->object_title)." дома",2); } $this->setProperty("atHome",1); $this->setProperty("lastUpdateTime",time()); $this->setProperty("lastUpdateDate",date("Y-m-d H:i:s",time()));
if ($this->getProperty("atHome") == 1) { say(($this->object_description ? $this->object_description : $this->object_title)." не дома",2); } $this->setProperty("atHome",0); $this->setProperty("lastUpdateTime",time()); $this->setProperty("lastUpdateDate",date("Y-m-d H:i:s",time()));
Объекты класса:
Свойства класса:
Методы класса:
Объекты класса:
$cnt1 = $this->getProperty('count1') / 100; $this->setProperty('value1', $cnt1); $cnt2 = $this->getProperty('count2') / 100; $this->setProperty('value2', $cnt2); $cnt3 = $this->getProperty('count3'); $val3 = $this->getProperty('value3'); $this->setProperty('value3', $cnt3); if ($cnt3 > 0) sg('Leak01.status',1); else sg('Leak01.status',0); if ($cnt3 > 0 && $cnt3 != $val3) { say((String) 'У нас потоп! Краны перекрыты. count=' . (String) $cnt3 , 2); }
$this->setProperty('value3', '0'); $this->setProperty('count3', '0'); sg('Leak01.status',0);
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
cm('IR_Remote.play', array('code'=>$this->getProperty($params['prop'])));
Объекты класса:
, Россия
Веб-сайт:
http://home.akeb.ru
© 2025 - Site Built By SergeJey | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving