Свойства класса:
Методы класса:
$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("Отключено питание");
Свойства класса:
Методы класса:
if ($this->getProperty('online')==1) { $this->setProperty('status',1); } else { $this->setProperty('status',0); }
$shutdown = shell_exec("/usr/bin/net rpc shutdown -t 3 -f -C shutdown -U ".$this->getProperty('login')."%".$this->getProperty('password')." -I ".$this->getProperty('ip'));
Объекты класса:
Свойства класса:
Методы класса:
//$params["USER_OBJECT"]
//$params["USER_OBJECT"]
Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/processHomebridgeMQTT.inc.php');
Объекты класса:
Свойства класса:
Методы класса:
//$this->callMethod('GetStatus'); if ($this->getProperty('pause')==1) {$this->callmethod('Pause'); $this->callmethod('videoPause');} else {$this->callmethod('Play'); $this->callmethod('videoPlay');};
$output=file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Application.GetProperties","params":{"properties":["volume"]}}'); $dec=json_decode($output); $result=$dec -> {result} -> {volume}; $currentVol=$this->getProperty('volume'); if ($currentVol != $result) { $this->setProperty('volume',$result); }; //var_dump($result);
$output=file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc": "2.0", "method": "PVR.GetChannels", "params": {"channelgroupid": "alltv", "properties" :["channel","channelnumber"]},"id": 1}'); $dec=json_decode($output); $result=$dec -> {result} -> {channels}; //foreach ($result as $i => $value) {var_dump($value[$i]);} foreach ($result as $i => $value){ $channels[$i] = array('channelid' => ($result[$i] -> {channelid}), 'channelnumber' => ($result[$i] -> {channelnumber})); }; var_dump($channels); $this->setProperty('channels',$channels);
$output=file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc": "2.0", "method": "PVR.GetChannels", "params": {"channelgroupid": "alltv", "properties" :["channel","channelnumber"]},"id": 1}'); $dec=json_decode($output); $result=$dec -> {result} -> {channels}; $channel = $this->getProperty('channel'); foreach ($result as $i => $value){ $channels[$i] = array('channelid' => ($result[$i] -> {channelid}), 'channelnumber' => ($result[$i] -> {channelnumber})); }; foreach ($channels as $i => $value){ if($channels[$i]['channelnumber'] == $channel){ $channelid = $channels[$i]['channelid']; }}; $url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc'; $data = array('jsonrpc' => '2.0', 'id' => '1', 'method' => 'Player.Open', 'params' => array('item' => array('channelid' => $channelid))); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, FALSE, $context); //if ($result === FALSE) { /* Handle error */ }; //var_dump($channels);
//file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.PlayPause","params":{"playerid":0,"play":true}}'); $url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc'; $data = array('jsonrpc' => '2.0', 'id' => '1', 'method' => 'Player.PlayPause', 'params' => array('playerid' => 1, 'play' => true)); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, FALSE, $context); if ($result === FALSE) { /* Handle error */ }; //var_dump($result); $this->callMethod('getSpeed');
//file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.PlayPause","params":{"playerid":0,"play":false}}'); $url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc'; $data = array('jsonrpc' => '2.0', 'id' => '1', 'method' => 'Player.PlayPause', 'params' => array('playerid' => 1, 'play' => false)); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, FALSE, $context); if ($result === FALSE) { /* Handle error */ }; //var_dump($result); $this->callMethod('getSpeed');
$output=file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.GetProperties","params":{"playerid":0,"properties":["speed"]}}'); $dec=json_decode($output); $res=$dec->{'result'}->speed; $this->setProperty('speed', $res); $output1=file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["title", "album", "artist"], "playerid": 0 }, "id": "AudioGetItem"}'); $dec1=json_decode($output1); $item=$dec1->{'result'}->item; $album=$item->album; $title=$item->title; $artist=$item->artist[0]; $statusString=$artist."-".$title."-".$album; $this->setProperty('album', $album); $this->setProperty('title', $title); $this->setProperty('artist', $artist); $this->setProperty('statusString',$statusString);
$output=file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}'); $dec=json_decode($output); $result=$dec->{'result'}; $type=$result[0]->type; switch ($type){ case 'audio': $this->callmethod('GetAudio'); $this->setProperty('audio', 1); $this->setProperty('video', 0); $this->setProperty('icon', 'fa-music'); break; case 'video': $this->callmethod('GetVideo'); $this->setProperty('audio', 0); $this->setProperty('video', 1); $this->setProperty('icon', 'fa-youtube-play'); break; default: $this->setProperty('audio', 0); $this->setProperty('video', 0); $this->setProperty('icon', 'fa-stop'); } $this->callmethod('getVolume');
$output=file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.GetProperties","params":{"playerid":1,"properties":["speed"]}}'); $dec=json_decode($output); $res=$dec->{'result'}->speed; $this->setProperty('speed', $res); $output1=file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["title", "album", "artist", "season", "episode", "showtitle", "tvshowid"], "playerid": 1 }, "id": "VideoGetItem"}'); $dec1=json_decode($output1); $item=$dec1->{'result'}->item; $album=$item->album; $title=$item->title; $artist=$item->artist[0]; //$this->setProperty('album', $album); $this->setProperty('title', $title); //$this->setProperty('artist', $artist); print_r($item);
$output=file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.GetProperties","params":{"playerid":0,"properties":["speed"]}}'); $dec=json_decode($output); $res=$dec->{'result'}->speed; $this->setProperty('speed', $res);
//file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.PlayPause","params":{"playerid":0,"play":true}}'); $url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc'; $data = array('jsonrpc' => '2.0', 'id' => '1', 'method' => 'Player.PlayPause', 'params' => array('playerid' => 0, 'play' => true)); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, FALSE, $context); if ($result === FALSE) { /* Handle error */ }; //var_dump($result); $this->callMethod('getSpeed');
//file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.GoTo","params":{"playerid":0,"to":"next"}}'); $url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc'; $data = array('jsonrpc' => '2.0', 'id' => '1', 'method' => 'Player.GoTo', 'params' => array('playerid' => 0, 'to' => 'next')); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, FALSE, $context); if ($result === FALSE) { /* Handle error */ }; //var_dump($result); $this->callMethod('getSpeed');
//file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Application.SetVolume","params":{"volume":'.$this->getProperty('volume').'}}'); $vol = $this->getProperty('volume'); $ivol =(int)$vol; $url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc'; $data = array('jsonrpc' => '2.0', 'id' => '1', 'method' => 'Application.SetVolume', 'params' => array('volume' => $ivol)); //var_dump($data); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, FALSE, $context); if ($result === FALSE) { /* Handle error */ }; //var_dump($result); $this->callMethod('getSpeed');
//file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.GoTo","params":{"playerid":0,"to":"previous"}}'); $url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc'; $data = array('jsonrpc' => '2.0', 'id' => '1', 'method' => 'Player.GoTo', 'params' => array('playerid' => 0, 'to' => 'previous')); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, FALSE, $context); if ($result === FALSE) { /* Handle error */ }; //var_dump($result); $this->callMethod('getSpeed');
//file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.PlayPause","params":{"playerid":0,"play":false}}'); $url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc'; $data = array('jsonrpc' => '2.0', 'id' => '1', 'method' => 'Player.PlayPause', 'params' => array('playerid' => 0, 'play' => false)); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, FALSE, $context); if ($result === FALSE) { /* Handle error */ }; //var_dump($result); $this->callMethod('getSpeed');
//file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.Open","params":{"item":{"partymode"}}'); $url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc'; $data = array('jsonrpc' => '2.0', 'id' => '1', 'method' => 'Player.Open', 'params' => array('item' => array('partymode'))); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, FALSE, $context); if ($result === FALSE) { /* Handle error */ }; //var_dump($result); $this->callMethod('getSpeed');
//file_get_contents("http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.PlayPause","params":{"playerid":0}}'); $url = "http://".$this->getProperty('ip').":".$this->getProperty('port').'/jsonrpc'; $data = array('jsonrpc' => '2.0', 'id' => '1', 'method' => 'Player.PlayPause', 'params' => array('playerid' => 0)); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data) ) ); $context = stream_context_create($options); $result = file_get_contents($url, FALSE, $context); if ($result === FALSE) { /* Handle error */ }; //var_dump($result); $this->callMethod('getSpeed');
Объекты класса:
Свойства класса:
Свойства класса:
Методы класса:
//sleep(1); $state = file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?pt=".$this->getProperty('Port')."&cmd=get"); if($_GET['m'] == 2) { // прилетело сообщение о длинном нажатии say("длинное нажатие",2); } $Port = $this->getProperty('Port'); $Letter = substr($Port, -1); if ($Letter == "A") { $state = substr($state,0,2); } if ($Letter == "B") { $state = substr($state, -2); } if ($state == "ON") { $this->setProperty('Status', 1); } else { $this->setProperty('Status', 0); }
file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?cmd=".$this->getProperty('Port').":0"); $this->setProperty('Status', 0);
file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?cmd=".$this->getProperty('Port').":1"); $this->setProperty('Status', 1);
file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?cmd=".$this->getProperty('Port').":2"); $state = file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?pt=".$this->getProperty('Port')."&cmd=get"); $Port = $this->getProperty('Port'); $Letter = substr($Port, -1); if ($Letter == "A") { $state = substr($state,0,2); } if ($Letter == "B") { $state = substr($state, -2); } if ($state == "ON") { $this->setProperty('Status', 1); } else { $this->setProperty('Status', 0); }
Объекты класса:
file_get_contents('http://192.168.10.197:8080/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.PlayPause","params":{"playerid":0}}');
callMethod('KodiKitchen.Pause'); callMethod("SMDR_Kitchen2.turnOff"); callMethod("SMDR_Kitchen1.turnOff");
//runScript("turnOffEverything"); //say('Выключаю всё',2); if (timeOutExists('HallMotionDay')!=0){ ClearTimeOut('HallMotionDay'); say('Таймер сброшен',2); } if (timeOutExists('HallMotionNight')!=0){ ClearTimeOut('HallMotionNight'); say('Таймер сброшен',2); }
runScript("turnOffLight"); say("Выключаю весь свет",2);
Свойства класса:
Методы класса:
$val = file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?pt=".$this->getProperty('Port')."&cmd=get"); $val = substr($val,5,5); $this->setProperty('Value', $val);
Объекты класса:
Свойства класса:
Методы класса:
$level=$this->getProperty('battery'); $this->setProperty('battPic','fa fa-battery-empty'); //здесь продумать нужно if ($level > 88 && $level <= 100) { $this->setProperty("battPic",'fa fa-battery-full'); $this->setProperty("BattColor", '#7CFC00'); } else if ($level > 62 && $level <= 88) { $this->setProperty("battPic",'fa fa-battery-three-quarters'); $this->setProperty("BattColor", '#7CFC00'); } else if ($level > 37 && $level <= 62) { $this->setProperty("battPic",'fa fa-battery-half'); $this->setProperty("BattColor", '#FF8C00'); } else if ($level > 12 && $level <= 37) { $this->setProperty("battPic",'fa fa-battery-quarter'); $this->setProperty("BattColor", '#800000'); } else if ($level < 12) { $this->setProperty("battPic",'fa fa-battery-empty'); $this->setProperty("BattColor", '#800000'); }
$Online=$this->getProperty('Online'); if (!$Online) { $this->setProperty('NameColor','orange'); } else { $this->setProperty('NameColor','green'); }
$this->setProperty('command', 'app_pause');
$this->setProperty('command', 'app_stop');
$this->setProperty('command', 'app_start');
$this->setProperty('command', 'app_charge');
Объекты класса:
Объекты класса:
Свойства класса:
Методы класса:
$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} */ if (gg("KodiKitchen.AutoNightMode")=="1"){ setGlobal("KodiKitchen.volume",gg("KodiKitchen.NightVolume"));} if (gg("KodiBedroom.AutoNightMode")=="1"){ setGlobal("KodiBedroom.volume",gg("KodiBedroom.NightVolume"));}
setGlobal('minMsgLevel','1'); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nightmode_deactivate.php'); /* end injection of {SDevices} */ setGlobal("KodiKitchen.volume",100);
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiGatewayRGB_injects.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} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_activate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_deactivate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiGatewayRGB_injects.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} */
$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} */
Методы класса:
Объекты класса:
/* begin injection of {app_radio} */ include_once(DIR_MODULES.'app_radio/app_radio.class.php'); $app_radio = new app_radio(); if(is_array($params)) { foreach($params as $key=>$value) { switch((string)$key) { case 'sta': $app_radio->change_station($params['sta'], $app_radio); break; case 'cmd': $app_radio->control($params['cmd']); break; case 'vol': $app_radio->set_volume($params['vol'], $app_radio); break; default: if($value == 'play' || $value == 'stop') $app_radio->control($value); elseif(strpos($value, 'vol') === 0) $app_radio->set_volume((int)substr($value, 3), $app_radio); elseif(strpos($value, 'sta:') === 0) $app_radio->change_station(substr($value, 4), $app_radio); } } } /* end injection of {app_radio} */
Свойства класса:
Методы класса:
$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"); $somebodyhome=0; 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']; $somebodyhome=1; } } $somebodyHomeText="Кто-то дома: ".implode(", ",$res_rooms); } if($somebodyhome==0){$somebodyHomeText="Никого нет дома. Были в ".date('H:i',$rooms[0]['time'])." (".$rooms[0]['room'].")";} 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} */
Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SDevices_statusUpdated.php');
/* 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/SButtons_pressed.php');
Объекты класса:
TuyaIR('bfb127e321a503e00dhbos', 'power');
Свойства класса:
Методы класса:
/* 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} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCameras_takeSeries.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
if ($this->getProperty('yandex') == '1') { $this->callMethod('turnOn'); } else { $this->callMethod('turnOff'); }
require(DIR_MODULES.'devices/SControllers_switch.php');
require(DIR_MODULES.'devices/SControllers_turnOn.php');
require(DIR_MODULES.'devices/SControllers_turnOff.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_statusUpdated.php'); /* end injection of {SDevices} */
/* 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_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_switch.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_statusUpdated.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?cmd=".$this->getProperty('Port').":2"); $state = file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?pt=".$this->getProperty('Port')."&cmd=get"); $Port = $this->getProperty('Port'); $Letter = substr($Port, -1); if ($Letter == "A") { $state = substr($state,0,2); } if ($Letter == "B") { $state = substr($state, -2); } if ($state == "ON") { $this->setProperty('status', 1); } else { $this->setProperty('status', 0); }
$state = file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?pt=".$this->getProperty('Port')."&cmd=get"); $Port = $this->getProperty('Port'); $Letter = substr($Port, -1); if ($Letter == "A") { $state = substr($state,0,2); } if ($Letter == "B") { $state = substr($state, -2); } if ($state == "ON") { $this->setProperty('status', 1); } else { $this->setProperty('status', 0); }
file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?cmd=".$this->getProperty('Port').":1"); $this->setProperty('status', 1);
file_get_contents("http://".$this->getProperty('ipAddress')."/".$this->getProperty('Password')."/?cmd=".$this->getProperty('Port').":0"); $this->setProperty('status', 0);
Объекты класса:
Объекты класса:
if (timeBetween(getGlobal('NightModeEnd'),getGlobal('NightModeStart'))) { callMethod('SMDR_Koridor.turnOn'); } else { callMethod('XiRgb01.turnOn'); }
Свойства класса:
Методы класса:
/* 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} */
Объекты класса:
$color = $this->getProperty('Color'); $r = 255 - hexdec($color[0].$color[1]); $g = 255 - hexdec($color[2].$color[3]); $b = 255 - hexdec($color[4].$color[5]); $out = "http://192.168.10.14/sec/?cmd=10:".$r.";12:".$g.";13:".$b; file_get_contents($out);
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_turnOn.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_disable.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_tempDown.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_tempUp.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_valueUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiGatewayRGB_action.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiGatewayRGB_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiGatewayRGB_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiGatewayRGB_brightnessUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiGatewayRGB_colorUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiHumidifier_modeSilent.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiHumidifier_modeMeduim.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiHumidifier_modeHigh.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiHumidifier_modeAuto.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiRoborockVacuum_charge.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiRoborockVacuum_start.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiRoborockVacuum_stop.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiRoborockVacuum_pause.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiRoborockVacuum_errorUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiRoborockVacuum_stateUpdated.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_alert.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_unblockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_statusUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions_unblockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions_blockSensor.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SMotions_motionDetected.php');
Объекты класса:
$timeout=gg('Hall.LightTimeout'); $state = file_get_contents("http://192.168.10.14/sec/?pt=7&cmd=get"); $state = substr($state,0,2); #$isTriggered=gg('megadMotion04.status'); #if ($isTriggered=='0') if ($state == "ON") { callMethod('SMDR_Koridor.turnOff'); } else { setTimeout('HallMotionDay',"callMethod('megadMotion04.timerEnd');",$timeout); };
$timeout=gg('Hall.LightTimeout'); if (timeOutExists('HallMotionDay')!=0){ setTimeout('HallMotionDay',"callMethod('megadMotion04.timerEnd');",$timeout); } if (timeOutExists('HallMotionNight')!=0){ setTimeout('HallMotionNight',"callMethod('XiRgb01.turnOff');",$timeout); } if (gg('Hall.LightAuto')==1){ if (gg('NightMode.active')==0) { if (gg('SMDR_Koridor.status')==0){ callMethod('SMDR_Koridor.turnOn'); setTimeout('HallMotionDay',"callMethod('megadMotion04.timerEnd');",$timeout); } } else { if (gg('XiRgb01.status')==0){ callMethod('XiRgb01.turnOn'); setTimeout('HallMotionNight',"callMethod('XiRgb01.turnOff');",$timeout); } } }
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_switch.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_open.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_close.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenClose_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenClose_unblockSensor.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SOpenClose_statusUpdated.php');
Объекты класса:
if ($this->getProperty('status')==1){ runScriptSafe('CheckUsersAtHome'); }
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_unblockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_alert.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_blockSensor.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SSensors_valueUpdated.php');
Свойства класса:
Методы класса:
/* 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} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SBatterySensors_valueWorkVoltageUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Свойства класса:
Свойства класса:
Методы класса:
/* 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} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_alert.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_unblockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_statusUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
if ($this->getProperty('current') > $this->getProperty('treshold')) { $this->setProperty('Status', 1); } else { $this->setProperty('Status', 0); };
Свойства класса:
Методы класса:
$this->setProperty('targetStatus',0); if ($this->getProperty('Status')!=0) { TuyaIR('bfb127e321a503e00dhbos', 'power'); }; setTimeout($params['object'].'_timer', "callMethod('".$params['object'].".recheck');", 20);
$target = $this -> getProperty('targetStatus'); $status = $this -> getProperty('Status'); if ($target != $status) { if ($target == 1){ $this -> callMethod('turnOn'); } else{ $this -> callMethod('turnOff'); } };
$this->setProperty('targetStatus',1); if ($this->getProperty('Status')==0) { TuyaIR('bfb127e321a503e00dhbos', 'power'); }; setTimeout($params['object'].'_timer', "callMethod('".$params['object'].".recheck');", 30);
Объекты класса:
TuyaIR('bfb127e321a503e00dhbos', 'power');
Свойства класса:
Методы класса:
Объекты класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiGatewayRGB_injects.php'); /* end injection of {SDevices} */
$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'); }
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SXiGatewayRGB_injects.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'); }
Свойства класса:
Методы класса:
//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');
//0 - выходной,1 - рабочий function weekDay($date = null,$new = null) { if(!isset($date)) $date = time(); if(!isset($new)) $new = 0; $this_year = (int) date('Y', $date); $file_load = './cms/cached/calendar.xml';//локально //Загружаем если год меняется $calend = file_get_contents($file_load); $order = array("\r\n", "\n", "\r", "<",">" ); $newstr = str_replace($order, " ", $calend); $pos = strpos( $newstr, 'calendar year='.'"'.$this_year.'"'); if($pos===false || $new == 1){ //Загружаем производственный календарь $productionCalendar = @file_get_contents('http://xmlcalendar.ru/data/ru/' . $this_year . '/calendar.xml'); } if ($productionCalendar) { //Если прочитали без ошибок file_put_contents($file_load,$productionCalendar);//Запишем на всякий случай)) } else { //Если не прочиталось $productionCalendar = $calend;// Возьмем ранее загруженный календарь } //Проверяем сегодняшний день по производственному календарю (рабочий или нет) $weekDay = -1; $this_date = date('m.d', $date); $calend = new SimpleXMLElement($productionCalendar); foreach ($calend->days->day as $day) { $type = $day->attributes()->t; //тип дня: 1 - выходной день, 2 - короткий день, 3 - рабочий день (суббота/воскресен) $CalDate = $day->attributes()->d; //дата if ($this_date == $CalDate) { //debmes(' >>>'.$this_date.' type of day='.$type); if ($type == 1) { //выходной $weekDay = 0; } elseif ($type == 2) {//Короткий день $weekDay = 1; } elseif ($type == 3) { //3 - рабочий день (суббота/воскресен) $weekDay = 1; } } } //Если в производственном календаре ничего не нашлось if ($weekDay == -1) { if (date('w', $date) == 0 || date('w', $date) == 6) { $weekDay = 0; } else { $weekDay = 1; } } return $weekDay; } setGlobal('ThisComputer.WorkDay',weekDay());
$h=(int)date('G',time()); $m=date('i',time()); $weekDay=date('N',time()); // Проверка состояния реле if ($m%5 == 0) { $objects=getObjectsByClass("MegaDRelay"); foreach($objects as $obj) { callMethod($obj['TITLE'].".Check");} } if ($m%5 == 0) { $objects=getObjectsByClass("SMegaRelays"); foreach($objects as $obj) { callMethod($obj['TITLE'].".Check");} } // Проверка состояния пылесоса if ($m%5 == 0) { setGlobal("miioButton06.status",getGlobal("myRobot.in_cleaning")); } //Проверка статуса kodi if ($m%5 == 0) { $objects=getObjectsByClass("Kodi"); foreach($objects as $obj) { callMethod($obj['TITLE'].".GetStatus");} } //Считывание температуры if ($m%15 == 0) { $objects=getObjectsByClass("MegaDTempSensor"); foreach($objects as $obj) { callMethod($obj['TITLE'].".GetTemperature");} } //Управлние вентилятором в ванной if ($m%5 == 0){ $BathHum=gg("XiSensor_humidity03.value"); $BedHum=gg("XiSensor_humidity02.value"); if (gg("ThisComputer.BathroomVentAuto") == "Опорн"){ if (($BathHum-$BedHum)>10){ callMethod("SMDR_BathroomVent.turnOn"); } else { callMethod("SMDR_BathroomVent.turnOff"); }} elseif(gg("ThisComputer.BathroomVentAuto") == "Фикс"){ if ($BathHum>gg("ThisComputer.BathroomVentLevel")){ callMethod("SMDR_BathroomVent.turnOn"); } else { callMethod("SMDR_BathroomVent.turnOff"); } } } if (timeBetween(getGlobal('NightModeEnd'),getGlobal('NightModeStart')) && getGlobal('clockChimeEnabled')) { if ($m=="00") { say(timeNow(),1); } } setGlobal('timeNow',date('H:i')); //Проверка присутствия пользователей if ($m%2) { runScriptSafe('CheckUsersAtHome'); } if ($m%15 == 0) { $inhome=0; //Проверка есть ли люди дома по WIFI и GPS $objects=getObjectsByClass('Users'); foreach($objects as $obj){ if (gg($obj['TITLE'].'.presence')==1){ $inhome=1; callMethod('Relay09.switch'); break; } } } $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 ($weekDay<6){ $nmEnd = getGlobal('NightModeEnd'); $nmStart = getGlobal('NightModeStart'); } else { $nmEnd = getGlobal('NightModeEnd1'); $nmStart = getGlobal('NightModeStart1'); } if (timeBetween($nmEnd,$nmStart) && getGlobal('isNight')=="1") { setGlobal("isNight",0); callMethod('NightMode.deactivate'); } elseif (!timeBetween($nmEnd,$nmStart) && getGlobal('isNight')!="1") { setGlobal("isNight",1); callMethod('NightMode.activate'); } if (timeIs("03:00")) { runScript("systemMaintenance"); } if (gg('ThisComputer.AlarmStatus') && timeIs(gg('ThisComputer.AlarmTime'))) { runScript('MorningAlarm'); }
Свойства класса:
Методы класса:
$charg=$this->getProperty('Charging'); $level=$this->getProperty('BattLevel'); $this->setProperty('battPic','fa fa-battery-empty'); //здесь продумать нужно if ($charg==1) { $this->setProperty("battPic",'fa fa-plug'); } else { if ($level > 88 && $level <= 100) { $this->setProperty("battPic",'fa fa-battery-full'); $this->setProperty("BattColor", '#7CFC00'); } else if ($level > 62 && $level <= 88) { $this->setProperty("battPic",'fa fa-battery-three-quarters'); $this->setProperty("BattColor", '#7CFC00'); } else if ($level > 37 && $level <= 62) { $this->setProperty("battPic",'fa fa-battery-half'); $this->setProperty("BattColor", '#FF8C00'); } else if ($level > 12 && $level <= 37) { $this->setProperty("battPic",'fa fa-battery-quarter'); $this->setProperty("BattColor", '#800000'); } else if ($level < 12) { $this->setProperty("battPic",'fa fa-battery-empty'); $this->setProperty("BattColor", '#800000'); } }
$gps=$this->getProperty('atHomeGPS'); $wifi=$this->getProperty('atHomeWiFi'); //registerEvent('presence',$this->name,2); if (!$gps && !$wifi) { $this->setProperty('presence','0'); $this->setProperty('NameColor','orange'); } else { $this->setProperty('presence','1'); $this->setProperty('NameColor','green'); } if ($wifi) { $this->setProperty('NetworkPic','wifi'); } else { $this->setProperty('NetworkPic',''); }
@include_once(ROOT . 'languages/devices_' . SETTINGS_SITE_LANGUAGE . '.php'); @include_once(ROOT . 'languages/devices_default' . '.php'); $ot = $this->object_title; $updatedTime = $this->getProperty('CoordinatesUpdatedTimestamp'); $passed = time() - $updatedTime; $newTimeout=0; if ($passed<10) { $newTimeout = 10; $this->setProperty('updatedText',LANG_DEVICES_PASSED_NOW); } elseif ($passed<60) { $newTimeout = 10; $this->setProperty('updatedText',$passed.' '.LANG_DEVICES_PASSED_SECONDS_AGO); } elseif ($passed<60*60) { $newTimeout = 60; $this->setProperty('updatedText',round($passed/60).' '.LANG_DEVICES_PASSED_MINUTES_AGO); /* } elseif ($passed<12*60*60) { $newTimeout = 60 * 60; $this->setProperty('updatedText',round($passed/60/60).' '.LANG_DEVICES_PASSED_HOURS_AGO); */ } elseif ($passed<20*60*60) { //just time $newTimeout = 60 * 60; $this->setProperty('updatedText',date('H:i',$updatedTime)); } else { //time and date $this->setProperty('updatedText',date('Y-m-d H:i',$updatedTime));// } if ($newTimeout > 0) { setTimeOut($ot.'_updateTime','callMethod("'.$ot.'.setUpdatedText");',$newTimeout); }
$Coordinates=$this->getProperty("Coordinates"); $lat=substr($Coordinates,0,strpos($Coordinates,",")); $lon=substr($Coordinates,strpos($Coordinates,",")+1); $this->setProperty('latitude',$lat); $this->setProperty('longitude',$lon); if($this->getProperty('HomeDistance')>100){ $data_file="http://geocode-maps.yandex.ru/1.x/?geocode=E".$lon.",N".$lat; // адрес xml файла $xml = simplexml_load_file($data_file); // раскладываем xml на массив $res=$xml->{'GeoObjectCollection'}->{'featureMember'}[0]->{'GeoObject'}->{'metaDataProperty'}->{'GeocoderMetaData'}->{'AddressDetails'}->{'Country'}->{'AddressLine'}; $this->setProperty("Location",$res); }else{ $this->setProperty("Location",'Дом'); $this->callMethod('gotHome'); }
//Сброс присутствия $ot=$this->object_title; $alive_timeout=5*60; setTimeOut($ot.'_isHome',"sg('".$ot.".AtHomeWiFi',0);",$alive_timeout); $last=$this->getProperty('isHomeTime'); $this->setProperty('isHomeTime',time()); $this->setProperty('isHomeUpdate',date('Y-m-d H:i',time())); //Установка флага и проверка на $status $status=$this->getProperty('AtHomeWiFi'); if (!$status) { $this->setProperty('AtHomeWiFi',1); } //Приветствовать //$GMailUnread=$this->getProperty('GMailUnread'); if ($this->getProperty('Greeting') == 1) { if (time()-$last>=(3*60*60)) { say('Здравствуйте '.$this->getProperty('fullName').'!',1); /* if ($GMailUnread>0) { say('У Вас '.myMorph($GMailUnread,' непрочитанное письмо!',' непрочитанных письма!',' непрочитанных писем!')); }*/ } } //Сброс "nobodyHome", "простые устройства" //ClearTimeOut('nobodyHome');
//$params["LOCATION_OBJECT"], $params["LOCATION"]
//$params["LOCATION_OBJECT"], $params["LOCATION"]
Объекты класса:
Свойства класса:
Методы класса:
$level=$this->getProperty('Level'); $this->setProperty('battPic','fa fa-battery-empty'); //здесь продумать нужно if ($level > 88 && $level <= 100) { $this->setProperty("battPic",'fa fa-battery-full'); $this->setProperty("BattColor", '#7CFC00'); } else if ($level > 62 && $level <= 88) { $this->setProperty("battPic",'fa fa-battery-three-quarters'); $this->setProperty("BattColor", '#7CFC00'); } else if ($level > 37 && $level <= 62) { $this->setProperty("battPic",'fa fa-battery-half'); $this->setProperty("BattColor", '#FF8C00'); } else if ($level > 12 && $level <= 37) { $this->setProperty("battPic",'fa fa-battery-quarter'); $this->setProperty("BattColor", '#800000'); } else if ($level < 12) { $this->setProperty("battPic",'fa fa-battery-empty'); $this->setProperty("BattColor", '#800000'); }
Объекты класса:
, Россия
На форуме: Harmer
© 2025 - Site Built By SergeJey | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving