Class properties:
Class methods:
$volume=round(65535*$params['VALUE']/100); $this->setProperty('volumeLevel',$params['VALUE']); safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume); say("Изменилась громкость до ".$params['VALUE']." процентов");
Class objects:
say("Отключено питание");
Class properties:
Class methods:
//$params["USER_OBJECT"]
//$params["USER_OBJECT"]
Class objects:
Class properties:
Class methods:
$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);
Class objects:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/darknessmode_activate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/darknessmode_deactivate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_activate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_deactivate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/econommode_activate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/econommode_deactivate.php'); /* end injection of {SDevices} */
setGlobal('minMsgLevel','2'); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nightmode_activate.php'); /* end injection of {SDevices} */
setGlobal('minMsgLevel','1');
Class properties:
Class methods:
$latestActivity=$this->getProperty('LatestActivity'); $this->setProperty('LatestActivity',time()); $this->setProperty('LatestActivityTime',date('H:i')); $this->setProperty('SomebodyHere',1); $ot=$this->object_title; if ($this->getProperty("IdleDelay")) { $activity_timeout=(int)$this->getProperty("IdleDelay"); } else { $activity_timeout=10*60; } clearTimeOut($ot."_activity_timeout"); setTimeOut($ot."_activity_timeout","callMethod('".$ot.".onIdle');",$activity_timeout); $this->callMethod("updateActivityStatus"); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_onActivity.php'); /* end injection of {SDevices} */
$this->setProperty('SomebodyHere',0); /* 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 rooms_cmp($a, $b) { if ($a['diff'] == $b['diff']) { return 0; } return ($a['diff'] < $b['diff']) ? -1 : 1; } usort($rooms,"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} */
Class objects:
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_setUpdatedText.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_logicAction.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_keepAlive.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_batteryLevelUpdated.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SButtons_pressed.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* 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} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SControllers_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SControllers_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SControllers_switch.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_tempDown.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_tempUp.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_thermostatUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_fanSpeedUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_configUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_setTargetTemperature.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_setThermostatMode.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_setFanSpeedMode.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_setLevel.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_levelUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_levelWorkUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_turnOff.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_switch.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_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_statusUpdated.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMedias_pause.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMedias_setSource.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMedias_setChannel.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMedias_setVolume.php'); /* end injection of {SDevices} */
Class objects:
$this->setProperty("status",0);
$status=$this->getProperty("status"); if ($status) { $this->callMetod('turnOff'); } else { $this->callMetod('turnOn'); }
$this->setProperty("status",1);
$this->setProperty("status",1);
$this->setProperty("status",0);
$status=$this->getProperty("status"); if ($status) { $this->callMetod('turnOff'); } else { $this->callMetod('turnOn'); }
$this->setProperty("status",0);
$status=$this->getProperty("status"); if ($status) { $this->callMetod('turnOff'); } else { $this->callMetod('turnOn'); }
$this->setProperty("status",1);
Class properties:
Class methods:
/* 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} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_tempUp.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_tempDown.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_switchEnable.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_enable.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_disable.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_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_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_setTargetTemperature.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_valueUpdated.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/STVs_pause.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/STVs_setSource.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/STVs_setChannel.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/STVs_setVolume.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCounters_valueUpdated.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_refreshStats.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCounters_pulseDetected.php'); /* end injection of {SDevices} */
Class properties:
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_statusUpdated.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} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions_motionDetected.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions_unblockSensor.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* 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/SOpenable_setLevel.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_levelUpdated.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenClose_statusUpdated.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} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_valueUpdated.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} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_unblockSensor.php'); /* end injection of {SDevices} */
Class properties:
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLightSensors_valueUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLightSensors_periodMinValueUpdated.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* 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} */
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_statusUpdated.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} */
Class properties:
Class methods:
Class objects:
$details=array(); $red_state=0; $yellow_state=0; if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; } else { $state='green'; $state_title=LANG_GENERAL_GREEN; } $new_details=implode(". ",$details); if ($this->getProperty("stateDetails")!=$new_details) { $this->setProperty('stateDetails',$new_details); } if ($this->getProperty('stateColor')!=$state) { $this->setProperty('stateColor',$state); $this->setProperty('stateTitle',$state_title); if ($state!='green') { say(LANG_GENERAL_SECURITY_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title."."); say(implode(". ",$details)); } else { say(LANG_GENERAL_SECURITY_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title); } $this->callMethod('stateChanged'); }
$details=array(); $red_state=0; $yellow_state=0; $cycles=array('states'=>'states','main'=>'main','execs'=>'exec','scheduler'=>'scheduler'); foreach($cycles as $k=>$v) { $tm=getGlobal('ThisComputer.cycle_'.$k.'Run'); if (time()-$tm>5*60) { $red_state=1; $details[]=$v." ".LANG_GENERAL_CYCLE." ".LANG_GENERAL_STOPPED."."; } } $cycles=array('ping'=>'ping'); foreach($cycles as $k=>$v) { $tm=getGlobal('ThisComputer.cycle_'.$k.'Run'); if (time()-$tm>10*60) { $yellow_state=1; $details[]=$v." ".LANG_GENERAL_CYCLE." ".LANG_GENERAL_STOPPED."."; } } if ($red_state) { $state='red'; $state_title=LANG_GENERAL_RED; } elseif ($yellow_state) { $state='yellow'; $state_title=LANG_GENERAL_YELLOW; } else { $state='green'; $state_title=LANG_GENERAL_GREEN; } $new_details=implode(". ",$details); if ($this->getProperty("stateDetails")!=$new_details) { $this->setProperty('stateDetails',$new_details); } if ($this->getProperty('stateColor')!=$state) { $this->setProperty('stateColor',$state); $this->setProperty('stateTitle',$state_title); if ($state!='green') { say(LANG_GENERAL_SYSTEM_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title."."); say(implode(". ",$details)); } else { say(LANG_GENERAL_SYSTEM_STATE." ".LANG_GENERAL_RESTORED_TO." ".$state_title); } $this->callMethod('stateChanged'); } /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/system_checkstate.php'); /* end injection of {SDevices} */
$details=array(); $red_state=0; $yellow_state=0; if (!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'); }
Class properties:
Class methods:
Class objects:
$h=(int)date('G',time()); $m=date('i',time()); if (isWeekDay()) { } if (($h>=8) && getGlobal('clockChimeEnabled')) { if ($m=="00") { say(timeNow(),1); } } setGlobal('timeNow',date('H:i')); $homeStatus=date('H:i'); if (getGlobal('NobodyHomeMode.active')) { $homeStatus.=' Дома никого'; } else { $homeStatus.=' Дома кто-то есть'; } $homeStatus.=' '.getGlobal('Security.stateDetails'); $homeStatus.=' '.getGlobal('System.stateDetails'); $homeStatus.=' '.getGlobal('Communication.stateDetails'); setGlobal('HomeStatus',$homeStatus); if (timeBetween(getGlobal('SunRiseTime'),getGlobal('SunSetTime')) && getGlobal('isDark')=="1") { setGlobal("isDark",0); callMethod('DarknessMode.deactivate'); } elseif (!timeBetween(getGlobal('SunRiseTime'),getGlobal('SunSetTime')) && getGlobal('isDark')!="1") { setGlobal("isDark",1); callMethod('DarknessMode.activate'); } if (timeIs(getGlobal('SunRiseTime'))) { say('Всходит солнце'); } if (timeIs(getGlobal('SunSetTime'))) { say('Солнце заходит',2); } if (timeIs("23:30") && (gg("EconomMode.active")!="1") && (gg("NobodyHomeMode.active")=="1")) { say("Похоже никого нет сегодня, можно сэкономить немного."); callMethod('EconomMode.activate'); } if (timeIs('20:00')) { callMethod('NightMode.activate'); } elseif (timeIs('08:00')) { callMethod('NightMode.deactivate'); } if (timeIs("03:00")) { runScript("systemMaintenance"); } if (gg('ThisComputer.AlarmStatus') && timeIs(gg('ThisComputer.AlarmTime'))) { runScript('MorningAlarm'); } if ($m%30 == 0) {runScript("WeatherFromYandex");}// обновляем погоду с Яндекса каждые 30 минут
Class properties:
Class methods:
//$params["LOCATION_OBJECT"], $params["LOCATION"]
//$params["LOCATION_OBJECT"], $params["LOCATION"]
$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'); }
$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'); } else if ($level > 62 && $level <= 88) { $this->setProperty("battPic",'fa fa-battery-three-quarters'); } else if ($level > 37 && $level <= 62) { $this->setProperty("battPic",'fa fa-battery-half'); } else if ($level > 12 && $level <= 37) { $this->setProperty("battPic",'fa fa-battery-quarter'); } else if ($level < 12) { $this->setProperty("battPic",'fa fa-battery-empty'); } }
@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); }
Class objects:
@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); }
$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'); } else if ($level > 62 && $level <= 88) { $this->setProperty("battPic",'fa fa-battery-three-quarters'); } else if ($level > 37 && $level <= 62) { $this->setProperty("battPic",'fa fa-battery-half'); } else if ($level > 12 && $level <= 37) { $this->setProperty("battPic",'fa fa-battery-quarter'); } else if ($level < 12) { $this->setProperty("battPic",'fa fa-battery-empty'); } }
$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'); }
Class properties:
Class objects:
, Россия
© 2024 - Site Built By SergeJey | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Public agreement
SmartLiving