Свойства класса:
Методы класса:
$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']." процентов");
Объекты класса:
exec('sudo ps4-waker standby'); cm('PlayStation4Pro.refreshState');
exec('sudo ps4-waker'); cm('PlayStation4Pro.refreshState');
exec('sudo ps4-waker check', $res); $res = implode('', $res); $res = json_decode($res, true); //print_r($res); if ($res['status']=='Ok') { $this->setProperty('status',1); } else { $this->setProperty('status',0); }
if ($params['command']=='battlevel') { sg('ControlPanel.batteryLevel',$params['value']); sg('ControlPanel.batteryLevelUpdated'," ".date("Y-m-d H:i:s")); } if ($params['command']=='battoverheat') { sg('ControlPanel.batteryOverheatUpdated'," ".date("Y-m-d H:i:s")); } sg('ControlPanel.checked'," ".date("Y-m-d H:i:s"));
$ip_or_host ="192.168.65.151"; //ip удаленного устройства с ОС Windows shell_exec("sudo net rpc shutdown -t 3 -f -C shutdown -U Zarytska%nikitos1206 -I 192.168.65.151");
$ip_or_host ="192.168.65.151"; //ip удаленного устройства $mac_addres ="08:60:6E:86:6B:D4"; //mac удаленного устройства $port = '7'; $package = chr(255).chr(255).chr(255).chr(255).chr(255).chr(255); $parts_mac = explode(':', $mac_addres); for ($i=0; $i < 6; $i++) $transform_mac .= chr(hexdec($parts_mac[$i])); for($i = 1; $i <= 16; $i++) $package .= $transform_mac; $wol = fsockopen("udp://$ip_or_host", $port); for($i = 0; $i < 5; $i++) fwrite($wol, $package); fclose($wol);
$powerState = $this->getProperty('powerState'); if ($powerState != '1') { return; } $screenData = $this->getProperty('getcurrentscreenData'); preg_match('/(.*)\,Перейти вверх\,(.+?)\,.+\,(\d{1,2}\:\d{1,2})\,(\d{1,2}\:\d{1,2})/', $screenData, $matches); print_r($matches); $this->setProperty('currentApplication',$matches[1]); $this->setProperty('contentSource',$matches[1]); $this->setProperty('contentProgramTitle',$matches[2]); switch ($matches[1]) { case "MX Player": echo "MX Player"; break; case "Youtube": echo "Youtube"; break; case "HD Video": echo "HD Video"; break; }
$m = $this->getProperty('receivedMessageToParse'); $u = $this->getProperty('videoplayurl'); $i = 0; if ($a = explode(',', $m)) { if ($a[0] == 'mjdmlistfiles') { $mediawall.='<div class="container-fluid" style="height: 650px;overflow-y: scroll;">'; $mediawall.='<div class="row align-items-start">'; // echo 'ok: '.(((count($a)-1) % 2 == 0)?'even':'odd'); //odd while ($i < (count($a)-1)) { $curl = curl_init(); if ($i % 6 == 0) { $mediawall.='</div><div class="row align-items-start">'; } $filename = explode('/4K/', $a[$i+1]); $filetitle = substr($filename[1], 0, strripos($filename[1], '.')); $fileyear = substr($filetitle, -4, 4); $filetitle = urlencode(trim(substr($filetitle, 0, strripos($filetitle, ' ')))); $curlquery = 'https://api.themoviedb.org/3/search/movie?year='.$fileyear.'&include_adult=false&page=1&query='.$filetitle.'&language=ru-RU&api_key=666a298cee3c2322a5684c17db3e722d'; curl_setopt_array($curl, array( CURLOPT_URL => $curlquery, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_POSTFIELDS => "{}", )); $response = curl_exec($curl); $resparray = json_decode($response, true); print_r($resparray["results"]); $mediawall.='<div class="col-md-2" style="overflow: hidden;height: 250px;"><img class="poster" data-url="'.$u.$a[$i+1].'" style="height:250px;" src="https://image.tmdb.org/t/p/w500/'.$resparray["results"]["0"]["poster_path"].'"/></div>'; /* выводиться будет значение переменной $i перед её увеличением (post-increment) */ $i = $i+1; $err = curl_error($curl); curl_close($curl); } $mediawall.='</div>'; $mediawall.='</div>'; $mediawall.="<script> $('.poster').click( function(){ $.get($(this).attr('data-url'), function( data ) { alert('Фильм запущен на ТВ'); }); console.error($(this).attr('data-url')); } ); </script>"; echo $mediawall; $this->setProperty('MoviesList',$mediawall); if ($err) { echo "cURL Error #:" . $err; } else { print_r($resparray); } } }
$ipaddress = $this->getProperty('ipaddress'); //echo $ipaddress; callMethod('Button31.pressed'); getURL("http://".$ipaddress.":1817/?message=getcurrentscreen");
cm('Button27.pressed');
cm('Button28.pressed'); cm('Button28.pressed');
//$command=gg('AsusN65U.DHCPList'); if ($params['command']!='') { $wl=gg('AsusN65U.DHCPWhiteList'); $bl=gg('AsusN65U.DHCPBlackList'); $wlarr = json_decode($wl,true); $blarr = json_decode($bl,true); echo("<br/><pre>"); print_r($blarr); echo("</pre>"); sg('AsusN65U.DHCPListPrev',gg('AsusN65U.DHCPList')); $pl=gg('AsusN65U.DHCPListPrev'); $plarr = json_decode($pl,true); $command=$params['command']; preg_match('/\[\[.*\]\]/', $command, $matches); $json = preg_replace('/\[/', '{', $matches[0]); $json = preg_replace('/\]/', '}', $json); $json = preg_replace('/\{\{/', '', $json); $json = preg_replace('/\}\}/', '', $json); $macarr = []; $arr = explode("},{", $json); foreach($arr as $set) { $setarr = explode(",",$set); $macarr[$setarr[1]]["ip"] = $setarr[0]; $macarr[$setarr[1]]["mac"] = $setarr[1]; $macarr[$setarr[1]]["name"] = $setarr[2]; if ($plarr[$setarr[1]]===null) //в прошлый раз не было этого устройства { if ($wlarr[$setarr[1]]===null) //это устройство не в белом списке { $blarr[$setarr[1]]["ip"] = $setarr[0]; $blarr[$setarr[1]]["mac"] = $setarr[1]; $blarr[$setarr[1]]["name"] = $setarr[2]; $blarr[$setarr[1]]["lastConnection"] = date("Y-m-d H:i:s"); say('Подключено неизвестное устройство '.$setarr[2].' по адресу '.$setarr[0], 3); } else { say($setarr[2].'снова подключено по адресу '.$setarr[0]); } } if (($wlarr[$setarr[1]]===null)&&($blarr[$setarr[1]]!==null)) {//есть в вайтлист и есть в блеклист тогда нужно исключить из блэклист unset($blarr[$setarr[1]]); } } $json = json_encode($macarr); sg('AsusN65U.LastDHCPCheck', " ".date("Y-m-d H:i:s")); sg('AsusN65U.checked', " ".date("Y-m-d H:i:s")); sg('AsusN65U.DHCPList',$json); } $wl=json_encode($wlarr); $bl=json_encode($blarr); sg('AsusN65U.DHCPWhiteList',$wl); sg('AsusN65U.DHCPBlackList',$bl);
say("Отключено питание");
$command=$params['command']; $short_command=''; $dt=recognizeTime($command,$short_command); if (preg_match('/скажи сколько врем/uis',$command)) { if ($dt>0) { addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt); say('Задача принята',2); return; } global $voicemode; $voicemode='on'; say('Сейчас '.timeNow(),2); } elseif (preg_match('/сколько время/uis',$command)) { if ($dt>0) { addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt); say('Задача принята'); echo $short_command; return; } say('Сейчас '.timeNow()); } elseif (preg_match('/повтори (.+)/uis',$command,$m) || preg_match('/скажи (.+)/uis',$command,$m)) { if ($dt>0) { addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt); say('Задача принята',2); return; } global $voicemode; $voicemode='on'; say($m[1],2); } else { say('Неизвестная команда...',2); }
Свойства класса:
Методы класса:
$name='Cron_'.$this->object_title; SQLExec("DELETE FROM jobs WHERE title='".$name."'");
$this->setProperty('LastRun',date('Y-m-d H:i:s'));
Объекты класса:
callMethod('iotdmzholes_gps.refreshData');
cm('PlayStation4Pro.refreshState');
cm('videoprobki_info.RefreshData');
callMethod('iotdmzholes_balance.refreshData');
callMethod('iotdmzholes_miband.refreshData');
callMethod('iotdmzholes_phone.refreshData');
Объекты класса:
Свойства класса:
Методы класса:
//$params["USER_OBJECT"]
//$params["USER_OBJECT"]
Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/processHomebridgeMQTT.inc.php');
Объекты класса:
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
$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} */
if (isWeekDay()==1) { //groupSunrise $objects=getObjectsByProperty('groupSunrise','=',1); $total = count($objects); for ($i = 0; $i < $total; $i++) { callMethodSafe($objects[$i].'.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} */ cm('BlindsAll.turnOn');
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_deactivate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_activate.php'); /* end injection of {SDevices} */
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} */
Свойства класса:
Методы класса:
$this->setProperty('SomebodyHere',0); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_onIdle.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} */
$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} */
Объекты класса:
if ($this->getProperty('LightStatus')==0) { sg('HallYeeLamp.status', 0); cm('HallFrontDimmer.turnOff'); cm('HallTopDimmer.turnOff'); } else { sg('HallYeeLamp.status', 1); cm('HallFrontDimmer.turnOn'); cm('HallTopDimmer.turnOn'); }
if ($this->getProperty('LightStatus')==0) { sg('LivingroomLight01.status', '0'); sg('LivingroomLight02.status', '0'); sg('LivingroomLight03.status', '0'); sg('LivingroomLight04.status', '0'); //cm('StudioWallLight.turnOff'); //cm('HallTopDimmer.turnOff'); //sg("LivingroomLight04.bright","0"); } else { sg('LivingroomLight01.status', '1'); sg('LivingroomLight02.status', '1'); sg('LivingroomLight03.status', '1'); sg('LivingroomLight04.status', '1'); //sg('HallYeeLamp.status', 1); //cm('StudioWallLight.turnOn'); //cm('HallTopDimmer.turnOn'); }
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_setUpdatedText.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SDevices_logicAction.php');
require(DIR_MODULES.'devices/SDevices_statusUpdated.php');
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SButtons_pressed.php');
Объекты класса:
sg('Airconditioner.status', 0); $v = gg('TempSensor01.value'); sg('Airconditioner.currentTemp', '+'.$v);
sg('Airconditioner.status', 1); sg('Airconditioner.currentTemp', '+28');
$currentLightStatus = gg('Hall.LightStatus'); if ($currentLightStatus==0) { sg('Hall.LightStatus',1); } else { sg('Hall.LightStatus',0); }
sg('Airconditioner.status', 0); $v = gg('TempSensor01.value'); sg('Airconditioner.currentTemp', '+'.$v);
sg('Airconditioner.status', 1); sg('Airconditioner.currentTemp', '+23');
sg('Airconditioner.status', 1); sg('Airconditioner.currentTemp', '+20');
sg('Airconditioner.status', 0); $v = gg('TempSensor01.value'); sg('Airconditioner.currentTemp', '+'.$v);
sg('Airconditioner.status', 1); sg('Airconditioner.currentTemp', '+16');
Свойства класса:
Методы класса:
/* 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} */
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SControllers_turnOn.php');
require(DIR_MODULES.'devices/SControllers_turnOff.php');
require(DIR_MODULES.'devices/SControllers_switch.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_levelUpdated.php');
require(DIR_MODULES.'devices/SDimmers_turnOn.php');
require(DIR_MODULES.'devices/SDimmers_turnOff.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_statusUpdated.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_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_turnOff.php'); /* end injection of {SDevices} */
Объекты класса:
getUrl('http://192.168.65.172/cm?cmnd=Power%20Off');
getUrl('http://192.168.65.172/cm?cmnd=Power%20On');
$status = getUrl('http://192.168.65.141/on'); $status = getUrl('http://192.168.65.141/status'); $status_array = json_decode($status, true); $this->setProperty('status',$status_array['status']);
$status = getUrl('http://192.168.65.141/off'); $status = getUrl('http://192.168.65.141/status'); $status_array = json_decode($status, true); $this->setProperty('status',$status_array['status']);
getURL('http://192.168.65.189/?cmd=setd&target=1000&fadetime=2000&p=1'); sg('HallTopDimmer.target',1000);
getURL('http://192.168.65.189/?cmd=setd&target=0&fadetime=2000&p=1'); sg('HallTopDimmer.target',0);
$target = gg('HallTopDimmer.target'); if ($target == 0) { //getURL('http://192.168.65.189/?cmd=setd&target=1000&fadetime=2000&p=1'); //sg('HallTopDimmer.target',1000); callMethod('HallTopDimmer.turnOn'); } else { //getURL('http://192.168.65.189/?cmd=setd&target=1000&fadetime=2000&p=1'); //sg('HallTopDimmer.target',1000); callMethod('HallTopDimmer.turnOff'); }
getURL('http://192.168.65.188/?cmd=setd&target=1000&fadetime=2000&p=1'); sg('HallTopDimmer.target',1000);
getURL('http://192.168.65.188/?cmd=setd&target=0&fadetime=2000&p=1'); sg('HallTopDimmer.target',0);
$target = gg('HallFrontDimmer.target'); if ($target == 0) { //getURL('http://192.168.65.189/?cmd=setd&target=1000&fadetime=2000&p=1'); //sg('HallTopDimmer.target',1000); callMethod('HallFrontDimmer.turnOn'); } else { //getURL('http://192.168.65.189/?cmd=setd&target=1000&fadetime=2000&p=1'); //sg('HallTopDimmer.target',1000); callMethod('HallFrontDimmer.turnOff'); }
Свойства класса:
Методы класса:
Объекты класса:
cm('Button24.pressed'); //Blinds2 up=24 down=25 stop=26 cm('Button22.pressed'); //Blinds1 up=21 down=22 stop=23 $st = $this->getProperty('switchTime'); //timer for up|down state $this->setProperty('updownstate','2'); //2 - state uprising
cm('Button25.pressed'); //Blinds2 up=24 down=25 stop=26 cm('Button21.pressed'); //Blinds1 up=21 down=22 stop=23 $st = $this->getProperty('switchTime'); //timer for up|down state $this->setProperty('updownstate','3'); //3 - state downrising
cm('Button20.pressed'); //cm('Button23.pressed'); //cm('Button26.pressed'); $ut = $this->getProperty('updownstate'); if ($ut == '2') { $this->setProperty('updownstate','0'); } if ($ut == '3') { $this->setProperty('updownstate','1'); }
Свойства класса:
Методы класса:
/* 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_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_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_disable.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_valueUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_statusUpdated.php'); /* end injection of {SDevices} */
Объекты класса:
cm('Button08.pressed'); //ChemneyOnOff //cm('Button08.pressed'); //ChemneyOnOff cm('Button11.pressed'); //ChemneyLightsUp cm('Button11.pressed'); //ChemneyLightsUp cm('Button11.pressed'); //ChemneyLightsUp cm('Button11.pressed'); //ChemneyLightsUp cm('Button11.pressed'); //ChemneyLightsUp cm('Button11.pressed'); //ChemneyLightsUp sg('Chimney.currentTargetValue','+22');
cm('Button11.pressed'); //ChemneyLightsUp cm('Button11.pressed'); //ChemneyLightsUp cm('Button08.pressed'); sg('Chimney.currentTargetValue','');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCounters_valueWorkUpdated.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_valueUpdated.php'); /* end injection of {SDevices} */
Объекты класса:
$new_val = floatval($this->getProperty('calibratedValue')); echo "new_val: ".$new_val."</br>"; $ir = intval($this->getProperty('impulseRate')); echo "ir: ".$ir."</br>"; $new_sf = intval($new_val*100); echo "new_sf(new_val*100): ".$new_sf."</br>"; $tot = intval($this->getProperty('Total')); echo "tot: ".$tot."</br>"; $iv = floatval($tot/$ir); echo "iv(tot/ir): ".$iv."</br>"; $new_sv = intval($new_sf-$iv); echo "new_sv(new_sf-iv): ".$new_sv."</br>"; $old_sv = intval($this->getProperty('startValue')); echo "old_sv(startValue): ".$old_sv."</br>"; $this->setProperty('startValue', $new_sv); $this->setProperty('value', $new_val); callMethod('MainElectricityCounter.parseReceivedValues');
$sv = intval($this->getProperty('startValue')); $tot = intval($this->getProperty('Total')); $ir = intval($this->getProperty('impulseRate')); $s = intval($sv + $tot/$ir); $sf = floatval($s/100); $val = intval($this->getProperty('value')); if ($val<$sf) { $str = "".$s; $this->setProperty('value',$sf); $this->setProperty('d2',$str[0]); $this->setProperty('d3',$str[1]); $this->setProperty('d4',$str[2]); $this->setProperty('d5',$str[3]); $this->setProperty('d6',$str[4]); $this->setProperty('d7',$str[5]); $this->setProperty('calculatedValue',$sf); } else { $this->setProperty('calculatedValue',$sf); }
Свойства класса:
Методы класса:
/* 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/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_valueUpdated.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/SSmoke_statusUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SBinaryLight_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SBinaryLight_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SBinaryLight_switch.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SChromecast_playUrl.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SChromecast_stop.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SChromecast_volume.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SChromecast_mute-unmute.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SChromecast_seekprevious.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SChromecast_seeknext.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SChromecast_pause-unpause.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Scontrollee_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Scontrollee_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Scontrollee_switch.php'); /* end injection of {SDevices} */
Свойства класса:
Свойства класса:
Методы класса:
$item=getObjectsByProperty("Blended","=", "1"); $i = 0; foreach ($item as $cam) { $i++; } if ($i==2) { sg('ThisComputer.AllCamsBlended', 1); } else { sg('ThisComputer.AllCamsBlended', 0); }
$item=getObjectsByProperty("Blended","=", "1"); $i = 0; foreach ($item as $cam) { $i++; } if ($i==2) { sg('ThisComputer.AllCamsBlended', 1); } else { sg('ThisComputer.AllCamsBlended', 0); }
Объекты класса:
$str = exec("sudo ./hub-ctrl -h 0 -P 2 -p 1"); sg('DigitalSecurityCamera03.Blended',$str);
$ch = curl_init(); $ip = $this->getProperty('ADDRESS'); $url = 'http://'.$ip.'/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].Covers[0].EncodeBlend=true'; $username = $this->getProperty('Username'); $password = $this->getProperty('Password'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); $output = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); $this->setProperty('Blended','1');
$ch = curl_init(); $ip = $this->getProperty('ADDRESS'); $url = 'http://'.$ip.'/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].Covers[0].EncodeBlend=false'; $username = $this->getProperty('Username'); $password = $this->getProperty('Password'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); $output = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); $this->setProperty('Blended','0');
$ch = curl_init(); $ip = $this->getProperty('ADDRESS'); $url = 'http://'.$ip.'/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].Covers[0].EncodeBlend=true'; $username = $this->getProperty('Username'); $password = $this->getProperty('Password'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); $output = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); $this->setProperty('Blended','1');
$ch = curl_init(); $ip = $this->getProperty('ADDRESS'); $url = 'http://'.$ip.'/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].Covers[0].EncodeBlend=false'; $username = $this->getProperty('Username'); $password = $this->getProperty('Password'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); $output = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); $this->setProperty('Blended','0');
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_mute-unmute.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_next.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_previous.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_seeknext.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_seekprevious.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_stop.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_playUrl.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_playNextUrl.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_volume.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaRenderer_pause-unpause.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMediaServer_getFileList.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SYeelightSmartBulb_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SYeelightSmartBulb_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SYeelightSmartBulb_switch.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SYeelightSmartBulb_changecolor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SYeelightSmartBulb_changetemp.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
Объекты класса:
$details=array(); $red_state=0; $yellow_state=0; if ((int)gg('ControlPanel.batteryLevel')<20) { $red_state=1; $details[]="Низкий заряд батареи панели [".gg('ControlPanel.batteryLevel').'%].'; } if ((int)gg('ControlPanel.batteryLevel')<50) { $yellow_state=1; $details[]="Батарея панели разряжается [".gg('ControlPanel.batteryLevel').'%].'; } 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 (gg("LAN_1.loop1")=0) { if (1==0) { $red_state=1; $details[]="Отключилось внешнее 220 вольт. Система перешла на резервное питание."; } if ($red_state) { $state='red'; $state_title='Красный'; } elseif ($yellow_state) { $state='yellow'; $state_title='Жёлтый'; } else { $state='green'; $state_title='Зелёный'; } $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("Уровень системы электропитания изменился на ".$state_title.". ",5); say(implode(" ",$details),5); } else { say("Уровень системы электропитания восстановился на ".$state_title.". ",5); } $this->callMethod('stateChanged'); }
$details=array(); $red_state=0; $yellow_state=0; if (!isOnline('Raspberry_Pi')) { $red_state=1; $details[]="Нет доступа к Raspberry."; } $cputemptext=gg('ThisComputer.CPUTemp'); preg_match("/\d{2}\.\d+/i",$cputemptext,$rasptemp); if ((int)$rasptemp>80) { $red_state=1; $details[]="Высокая температура процессора (".$rasptemp[0].")"; } if ($red_state) { $state='red'; $state_title='Красный'; } elseif ($yellow_state) { $state='yellow'; $state_title='Жёлтый'; } else { $state='green'; $state_title='Зелёный'; } $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("Уровень системы изменился на ".$state_title.". "); say(implode(" ",$details)); } else { say("Уровень системы восстановился на ".$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'); }
$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'); }
Методы класса:
Объекты класса:
$command = $params['command']; $option = $params['option']; $amihost = $this->getProperty('amihost'); $amiport = $this->getProperty('amiport'); $amiusername = $this->getProperty('amiusername'); $amipassword = $this->getProperty('amipassword'); include_once ('./lib/phpagi/phpagi-asmanager.php'); if (!$params['command']) { DebMes (" Asterisk : Can't process empty command"); exit; }; if (!$amihost) { DebMes (" Asterisk : Can't process command - AMI is not configured"); exit; }; $com_man = new AGI_AsteriskManager(); if (!$com_man->connect($amihost.":".$amiport, $amiusername, $amipassword)) { DebMes (" Asterisk : Can't connect to AMI "); exit; }; $response = $com_man->$command($option); $com_man->disconnect(); if ($response['Response'] != 'Success') { DebMes (" Asterisk : Can't process command => ".$response['Message']); }; return $response; // For debug // DebMes (" Asterisk : Process command $command"); // DebMes ($response);
Свойства класса:
Методы класса:
//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'); // раскидываем дату и время если изменилось в Windows $h=(int)date('G',time()); if (gg('ThisComputer.DateD')!=date("d", time())) { $day[0]="воскресенье"; $day[1]="понедельник"; $day[2]="вторник"; $day[3]="среда"; $day[4]="четверг"; $day[5]="пятница"; $day[6]="суббота"; $month[1]="января"; $monthAlt[1]="ЯНВАРЬ"; $month[2]="февраля"; $monthAlt[2]="ФЕВРАЛЬ"; $month[3]="марта"; $monthAlt[3]="МАРТ"; $month[4]="апреля"; $monthAlt[4]="АПРЕЛЬ"; $month[5]="мая"; $monthAlt[5]="МАЙ"; $month[6]="июня"; $monthAlt[6]="ИЮНЬ"; $month[7]="июля"; $monthAlt[7]="ИЮЛЬ"; $month[8]="августа"; $monthAlt[8]="АВГУСТ"; $month[9]="сентября"; $monthAlt[9]="СЕНТЯБРЬ"; $month[10]="октября"; $monthAlt[10]="ОКТЯБРЬ"; $month[11]="ноября"; $monthAlt[11]="НОЯБРЬ"; $month[12]="декабря"; $monthAlt[12]="ДЕКАБРЬ"; sg("ThisComputer.DateD",date( "d", time())); sg("ThisComputer.DateM",date( "m", time())); sg("ThisComputer.DateY",date( "Y", time())); sg("ThisComputer.Date",date( "d.m.Y", time())); sg("ThisComputer.Day",$day[date("w")]); sg("ThisComputer.Month",$month[date("n")]); sg("ThisComputer.MonthAlt",$monthAlt[date("n")]); } //setTimeOut('Weather', 'runScriptSafe(\'OpenWeatherMap\');', 300);
$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); cm('BlindsAll.turnOn'); } 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'); } $timeH = date("H", time()); $timeM = date("i", time()); sg("ThisComputer.timeH",$timeH); sg("ThisComputer.timeM",$timeM); runScript("updateTVInfo");
Свойства класса:
Методы класса:
$charg=$this->getProperty('Charging'); $level=$this->getProperty('BattLevel'); $this->setProperty('battPic','fa fa-battery-empty'); //здесь продумать нужно if ($charg==1) { $this->setProperty("battPic",'fa fa-plug'); $this->setProperty("BattColor",'#87CEFA'); $this->setProperty("NameColor",'#FFFFFF'); } else { if ($level > 88 && $level <= 100) { $this->setProperty("battPic",'fa fa-battery-full'); $this->setProperty("BattColor",'#00FF00'); $this->setProperty("NameColor",'#00FF00'); } else if ($level > 62 && $level <= 88) { $this->setProperty("battPic",'fa fa-battery-three-quarters'); $this->setProperty("BattColor",'#9ACD32'); $this->setProperty("NameColor",'#9ACD32'); } else if ($level > 37 && $level <= 62) { $this->setProperty("battPic",'fa fa-battery-half'); $this->setProperty("BattColor",'#FFFF00'); $this->setProperty("NameColor",'#FFFF00'); } else if ($level > 12 && $level <= 37) { $this->setProperty("battPic",'fa fa-battery-quarter'); $this->setProperty("BattColor",'#FFA500'); $this->setProperty("NameColor",'#FFA500'); } else if ($level <= 12) { $this->setProperty("battPic",'fa fa-battery-empty'); $this->setProperty("BattColor",'#FF6347'); $this->setProperty("NameColor",'#FF6347'); } }
@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); }
function request($url,$post = 0){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ); // отправляем на curl_setopt($ch, CURLOPT_HEADER, 0); // пустые заголовки curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // возвратить то что вернул сервер curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // следовать за редиректами curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);// таймаут4 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt'); // сохранять куки в файл curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt'); curl_setopt($ch, CURLOPT_POST, $post!==0 ); // использовать данные в post if($post) curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $data = curl_exec($ch); curl_close($ch); return $data; } $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){ $url="https://maps.googleapis.com/maps/api/geocode/json?latlng=".$lat.",".$lon."&language=ru®ion=uk&key=AIzaSyAR3RnVjaFTK_z76Xx308aoeXRGuS2TgVY"; $response = request($url,$post = 0); $response_array = json_decode($response, true); $res = $response_array['results'][0]['formatted_address']; $this->setProperty("Location",$res); }else{ $this->setProperty("Location",'Дом'); $this->callMethod('gotHome'); }
//$params["LOCATION_OBJECT"], $params["LOCATION"]
//$params["LOCATION_OBJECT"], $params["LOCATION"]
Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty('lastUpdate',date("Y-m-d H:i:s"));
Объекты класса:
//CalledByMethodRefreshData $response = $this->getProperty('response'); $response_array = json_decode($response, true); $response2request = http_build_query($response_array['Request']); $gps_result = getUrl('http://192.168.65.200/gps.php?'.$response2request); $url = $this->getProperty('url'); $gps_result = getUrl($url."?op=markgps&ID=".$response_array['ID']);
function request($url,$post = 0){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ); // отправляем на curl_setopt($ch, CURLOPT_HEADER, 0); // пустые заголовки curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // возвратить то что вернул сервер curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // следовать за редиректами curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);// таймаут4 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt'); // сохранять куки в файл curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt'); curl_setopt($ch, CURLOPT_POST, $post!==0 ); // использовать данные в post if($post) curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $data = curl_exec($ch); curl_close($ch); return $data; } //$url = 'http://iotdmz.hol.es/gps.php?op=lastgps'; $url = $this->getProperty('url')."?op=lastgps"; $ret = request($url,$post = 0); preg_match('/(.+)/',$ret,$json); if ($json[1] != '{"ID":"", "Request":}') { $this->setProperty('response', $json[1]); }
function request($url,$post = 0){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ); // отправляем на curl_setopt($ch, CURLOPT_HEADER, 0); // пустые заголовки curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // возвратить то что вернул сервер curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // следовать за редиректами curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);// таймаут4 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt'); // сохранять куки в файл curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt'); curl_setopt($ch, CURLOPT_POST, $post!==0 ); // использовать данные в post if($post) curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $data = curl_exec($ch); curl_close($ch); return $data; } $url = $this->getProperty('url'); $login = $this->getProperty('login'); $password = $this->getProperty('password'); $ret = request($url,$post = 0); preg_match('/form_build_id\"\sid\=\"(form-.*)\"\svalue\=\"form/',$ret,$r); $formid = $r[1]; //$url = 'http://mobile.videoprobki.ua/road-condition/mob'; $post = array( 'name'=>$login, 'pass'=>$password, 'op'=>'%D0%92%D1%85%D0%BE%D0%B4', 'form_build_id'=>$formid, 'form_id'=>'user_login_block' ); $ret = request($url,$post); preg_match('/Загруженность дорог (\d+)/',$ret,$r); $this->setProperty('Level', $r[1]); $this->setProperty('val', 'Загруженность дорог '.$r[1].'%'); if ($r[1]>35 and $r[1] <=60) { $this->setProperty('Color', 'yellow'); } else if ($r[1]<=35) { $this->setProperty('Color', 'green'); } else if ($r[1]>60 and $r[1] <=100) { $this->setProperty('Color', 'red'); } $url = 'http://videoprobki.ua'; $ret = request($url,$post = 0); preg_match('/free_count.+(\d{3})/',$ret,$free_count); preg_match('/stick_count.+(\d+).+СВОБОДНО/',$ret,$stick_count); preg_match('/tube_count.+(\d+).+ТЯНУЧКИ/',$ret,$tube_count); preg_match('/crash_count.+(\d+).+ПРОБКИ/',$ret,$crash_count); $this->setProperty('free_count', $free_count[1]); $this->setProperty('stick_count', $stick_count[1]); $this->setProperty('tube_count', $tube_count[1]); $this->setProperty('crash_count', $crash_count[1]); $free_count_max = $this->getProperty('free_count_max'); $stick_count_max = $this->getProperty('stick_count_max'); $tube_count_max = $this->getProperty('tube_count_max'); $crash_count_max = $this->getProperty('crash_count_max'); if ($free_count_max<$free_count[1]) { $free_count_max=$free_count[1]; $this->setProperty('free_count_max',$free_count_max);} if ($stick_count_max<$stick_count[1]) { $stick_count_max=$stick_count[1]; $this->setProperty('stick_count_max',$stick_count_max);} if ($tube_count_max<$tube_count[1]) { $tube_count_max=$tube_count[1]; $this->setProperty('tube_count_max',$tube_count_max);} if ($crash_count_max<$crash_count[1]) { $crash_count_max=$crash_count[1]; $this->setProperty('crash_count_max',$crash_count_max);} if (($stick_count[1]==0)and($tube_count[1]==0)and($crash_count[1]==0)) { $this->setProperty('Level', 1); } else { $level = round(((($stick_count[1]*100)/$stick_count_max)+ (($tube_count[1]*100)/$tube_count_max)+ (($crash_count[1]*100)/$crash_count_max))/3,0); if ($level>=35 and $level <=60) { $this->setProperty('Color', 'yellow'); } else if ($level<35) { $this->setProperty('Color', 'green'); } else if ($level>60 and $level <=100) { $this->setProperty('Color', 'red'); } $this->setProperty('Level', round($level/10,0)); } $this->setProperty('val', 'СВОБОДНО: '.$free_count[1].' ТЯНУЧКИ:'.$stick_count[1].' ПРОБКИ:'.$tube_count[1].' АВАРИИ:'.$crash_count[1]);
function request($url,$post = 0){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ); // отправляем на curl_setopt($ch, CURLOPT_HEADER, 0); // пустые заголовки curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // возвратить то что вернул сервер curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // следовать за редиректами curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);// таймаут4 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt'); // сохранять куки в файл curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt'); curl_setopt($ch, CURLOPT_POST, $post!==0 ); // использовать данные в post if($post) curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $data = curl_exec($ch); curl_close($ch); return $data; } //$url = 'http://iotdmz.hol.es/balance.php?op=lastballance'; $url = $this->getProperty('url')."?op=lastballance"; $ret = request($url,$post = 0); preg_match('/(.+)/',$ret,$json); if ($json[1]!='{"ID":"", "Request":}') { $this->setProperty('response', $json[1]); }
//CalledByMethodRefreshData $response = $this->getProperty('response'); if ($response != '{"ID":"", "Request":}') { $response_array = json_decode($response, true); $response2request = http_build_query($response_array['Request']); $inum = $response_array['Request']['inum']; $op= $response_array['Request']['op']; $value = $response_array['Request']['value']; $pattern = '/(\d+)min.+\,\s+(\d+\.?\d+)GB\,\s+(\d+)SMS.+Tarif deystvuet do\s+(\d{2}.\d{2}.\d{2}).+Nomer deystvuet do\s+(\d{2}.\d{2}.\d{2})\./'; preg_match($pattern, $value, $matches, PREG_OFFSET_CAPTURE); //echo "<pre>"; //print_r($matches); //echo "</pre>"; $min = $matches[1][0]; $GB = $matches[2][0]; $sms = $matches[3][0]; $tariff_till = $matches[4][0]; $phone_till = $matches[5][0]; $objects=getObjectsByProperty('sim1_number', '=', $inum); sg($objects[0].'.sim1_minutes',$min); sg($objects[0].'.sim1_gb',$GB); sg($objects[0].'.sim1_sms',$sms); sg($objects[0].'.sim1_tariff_till',$tariff_till); sg($objects[0].'.sim1_phone_till',$phone_till); //{"inum":"0934966482","op":"ballance","value":"BEZLIM: zvonki na lifecell, sotsial'nye seti. 581min na drugie nomera, 17.99GB, 999SMS. Tarif deystvuet do 14.06.19. Nomer deystvuet do 17.05.20.,\u041e\u041a"} //$gps_result = getUrl('http://192.168.65.200/gps.php?'.$response2request); $url = $this->getProperty('url'); $gps_result = getUrl($url."?op=markballance&ID=".$response_array['ID']); }
//CalledByMethodRefreshData $response = $this->getProperty('response'); if ($response != '{"ID":"", "Request":}') { $response_array = json_decode($response, true); $response2request = http_build_query($response_array['Request']); $inum = $response_array['Request']['inum']; $op= $response_array['Request']['op']; $value = $response_array['Request']['value']; $objects=getObjectsByProperty('sim1_number', '=', $inum); sg($objects[0].'.'.$op, $value); //{"inum":"0934966482","op":"ballance","value":"BEZLIM: zvonki na lifecell, sotsial'nye seti. 581min na drugie nomera, 17.99GB, 999SMS. Tarif deystvuet do 14.06.19. Nomer deystvuet do 17.05.20.,\u041e\u041a"} //$gps_result = getUrl('http://192.168.65.200/gps.php?'.$response2request); $url = $this->getProperty('url'); $gps_result = getUrl($url."?op=markmiband&ID=".$response_array['ID']); }
function request($url,$post = 0){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ); // отправляем на curl_setopt($ch, CURLOPT_HEADER, 0); // пустые заголовки curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // возвратить то что вернул сервер curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // следовать за редиректами curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);// таймаут4 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt'); // сохранять куки в файл curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt'); curl_setopt($ch, CURLOPT_POST, $post!==0 ); // использовать данные в post if($post) curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $data = curl_exec($ch); curl_close($ch); return $data; } //$url = 'http://iotdmz.hol.es/miband.php?op=lastmiband'; $url = $this->getProperty('url')."?op=lastmiband"; $ret = request($url,$post = 0); preg_match('/(.+)/',$ret,$json); if ($json[1]!='{"ID":"", "Request":}') { $this->setProperty('response', $json[1]); }
//CalledByMethodRefreshData $response = $this->getProperty('response'); if ($response != '{"ID":"", "Request":}') { $response_array = json_decode($response, true); $response2request = http_build_query($response_array['Request']); $inum = $response_array['Request']['inum']; $op= $response_array['Request']['op']; $value = $response_array['Request']['value']; $objects=getObjectsByProperty('sim1_number', '=', $inum); sg($objects[0].'.BattLevel', $value['BattLevel']); sg($objects[0].'.Charging', $value['Charging']); //{"inum":"0934966482","op":"ballance","value":"BEZLIM: zvonki na lifecell, sotsial'nye seti. 581min na drugie nomera, 17.99GB, 999SMS. Tarif deystvuet do 14.06.19. Nomer deystvuet do 17.05.20.,\u041e\u041a"} //$gps_result = getUrl('http://192.168.65.200/gps.php?'.$response2request); $url = $this->getProperty('url'); $gps_result = getUrl($url."?op=markphonedata&ID=".$response_array['ID']); }
function request($url,$post = 0){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ); // отправляем на curl_setopt($ch, CURLOPT_HEADER, 0); // пустые заголовки curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // возвратить то что вернул сервер curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // следовать за редиректами curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);// таймаут4 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt'); // сохранять куки в файл curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt'); curl_setopt($ch, CURLOPT_POST, $post!==0 ); // использовать данные в post if($post) curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $data = curl_exec($ch); curl_close($ch); return $data; } //$url = 'http://iotdmz.hol.es/phone.php?op=lastphonedata'; $url = $this->getProperty('url')."?op=lastphonedata"; $ret = request($url,$post = 0); preg_match('/(.+)/',$ret,$json); if ($json[1]!='{"ID":"", "Request":}') { $this->setProperty('response', $json[1]); }
Методы класса:
include_once(DIR_MODULES."app_yatraffic/app_yatraffic.class.php"); $app_yatraffic=new app_yatraffic(); $app_yatraffic->get_traffic(gg("yt_settings.reg_id"));
Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'Yeelight/Yeelight_set_name.php');
require(DIR_MODULES.'Yeelight/Yeelight_set_rgb.php');
require(DIR_MODULES.'Yeelight/Yeelight_set_ct.php');
require(DIR_MODULES.'Yeelight/Yeelight_set_hsv.php');
('status',(('status')+1)%2);
require(DIR_MODULES.'Yeelight/Yeelight_getdata.php');
require(DIR_MODULES.'Yeelight/Yeelight_on_off.php');
require(DIR_MODULES.'Yeelight/Yeelight_set_bright.php');
Объекты класса:
Kiev, Ukraine
На форуме: Vip
© 2021 - Site Built By SergeJey | Публичный договор
SmartLiving