Свойства класса:
Методы класса:
// counter (количество оборотов) passed (секунд)
$counter=$params['counter'];
$passed=$params['passed'];
$old_counter=$this->getProperty("counter");
if ($counter>0) {
$old_counter+=$counter;
$this->setProperty("counter",$old_counter);
$this->setProperty("power",round($old_counter/150));
}
if ($passed>0) {
$speed=round((($counter*60*60/$passed)/150),2);
$this->setProperty("speed",$speed);
}
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date('H:i'));Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty('LastRun',date('Y-m-d H:i:s'));$name='Cron_'.$this->object_title;
SQLSelectOne("DELETE FROM jobs WHERE title='".$name."'");Объекты класса:
runScript('rate1h');runScript('rate24h');CallMethod("Sun.calculateSunsetSunrise");if (!isOnline('Internet'))
{ return; }
else {
//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
runScript(weather_resume);
}runScript('avgTemp',$data);Свойства класса:
Методы класса:
if ($this->getProperty('status')) {
$this->callMethod('switch');
}if (!$this->getProperty('status')) {
$this->callMethod('switch');
}$url='http://'.$this->getProperty('host').'/?CLICK,'.$this->getProperty('pin');
getURL($url,0);Объекты класса:
Методы класса:
$lat=gg('Sun.latitude'); // широта 55.553964
$long=gg('Sun.longitude'); // долгота 39.744074
$sun_info = date_sun_info(time(), $lat, $long);
foreach ($sun_info as $key => $val) {
if ($key == 'sunrise') {
$sunrise = $val;
echo 'Восход: '.date("H:i", $sunrise).'<br>';
setGlobal('Sun.SunRiseTime',date("H:i", $sunrise));
}
if ($key == 'sunset') {
$sunset = $val;
$day_length = $sunset - $sunrise;
echo 'Заход: '.date("H:i", $sunset).'<br>';
echo 'Долгота дня: '.gmdate("H:i", $day_length).'<br>';
setGlobal('Sun.SunSetTime',date("H:i", $sunset));
setGlobal('Sun.LongTag',gmdate("H:i", $day_length));
}
if ($key == 'transit') {
echo 'В зените: '.date("H:i", $val).'<br>';
setGlobal('Sun.Transit',date("H:i", $val));
}
if ($key == 'civil_twilight_begin') {
echo 'Начало утренних сумерек: '.date("H:i", $val).'<br>';
setGlobal('Sun.civil_begin',date("H:i", $val));
}
if ($key == 'civil_twilight_end') {
echo 'Конец вечерних сумерек: '.date("H:i", $val).'<br>';
setGlobal('Sun.civil_end',date("H:i", $val));
}
}$new_volume = $params['VALUE'];
say("Изменилась громкость до ".$new_volume." процентов",0);
$this->setProperty('volumeLevel',$new_volume);
$volume=round(65535*$new_volume/100);
safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume);
Объекты класса:
$command=$params['command'];
$short_command='';
$dt=recognizeTime($command,$short_command);
if (preg_match('/скажи сколько врем/is',$command)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята',2);
return;
}
global $voicemode;
$voicemode='on';
say('Сейчас '.timeNow(),2);
} elseif (preg_match('/сколько время/is',$command)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята');
echo $short_command;
return;
}
say('Сейчас '.timeNow());
} elseif (preg_match('/повтори (.+)/is',$command,$m) || preg_match('/скажи (.+)/is',$command,$m)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята',2);
return;
}
global $voicemode;
$voicemode='on';
say($m[1],2);
} else {
say('Неизвестная команда...',2);
}say("Отключено питание");Свойства класса:
Методы класса:
//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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//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Объекты класса:
$h=(int)date('G',time());
$m=date('i',time());
setGlobal('timeNow',date('H:i'));
setGlobal('ThisComputer.minute',$m);
$homeStatus=date('H:i');
if (getGlobal('NobodyHomeMode.active')) {
$homeStatus.=' Дома никого нет';
} else {
$homeStatus.=' Дома кто-то есть';
}
$homeStatus.=' Улица: '.getGlobal('ws.tempOutside').' C;';
$homeStatus.=' Петруша: '.getGlobal('Peter.seenAt');
$homeStatus.=' ('.getGlobal('Peter.CoordinatesUpdated').');';
$homeStatus.=' '.getGlobal('Security.stateDetails');
$homeStatus.=' '.getGlobal('System.stateDetails');
$homeStatus.=' '.getGlobal('Communication.stateDetails');
setGlobal('HomeStatus',$homeStatus);
// Темное время суток режим
if (timeBetween(getGlobal('Sun.SunRiseTime'),getGlobal('Sun.SunSetTime')) && getGlobal('DarknessMode.active')=="1") {
callMethod('DarknessMode.deactivate');
} elseif (!timeBetween(getGlobal('Sun.SunRiseTime'),getGlobal('Sun.SunSetTime')) && getGlobal('DarknessMode.active')!="1") {
callMethod('DarknessMode.activate');
}
// Ночной режим
if (timeBetween(gg('HomeMode.NightModeTimeOff'),gg('HomeMode.NightModeTimeOn')) && gg('NightMode.active')=='1') {
callMethod('NightMode.deactivate');
} elseif (!timeBetween(gg('HomeMode.NightModeTimeOff'),gg('HomeMode.NightModeTimeOn')) && gg('NightMode.active')!=='1') {
callMethod('NightMode.activate');
}
/*
if (timeIs("06:30") && (gg("EconomMode.active")=="1")) {
say("Скоро хозяева должны проснуться, разогреваюсь");
callMethod('EconomMode.deactivate');
}
if (isWeekDay() && timeIs("17:30") && (gg("EconomMode.active")=="1")) {
say("Скоро хозяева должны прийти с работы, разогреваюсь");
callMethod('EconomMode.deactivate');
}
*/
if ((timeIs("23:30") || timeIs("08:00")) && (gg("EconomMode.active")!="1") && (gg("NobodyHomeMode.active")=="1")) {
say("Похоже никого нет сегодня, можно сэкономить немного.");
callMethod('EconomMode.activate');
}
// напомнить, что нужно готовиться выходить из дома
if (isWeekDay() && !gg('GuestsMode.active')) {
if (timeIs('08:10') || timeIs('08:20')) {
say('Сейчас '.timeNow(),1);
}
}
// Find iPhone (tracker)
// Если активен ночной режим и нахожусь дома, то проверять pauseGPS * 10
if (gg('NightMode.active') AND (gg('Peter.HomeDistance') < 300))
{ $gps_delay = (gg('Peter.pauseGPS') * 10); }
// Если выключен ночной режим и нахожусь дома, то проверять pauseGPS * 5
elseif (!gg('NightMode.active') AND (gg('Peter.HomeDistance') < 300))
{ $gps_delay = (gg('Peter.pauseGPS') * 5); }
// Если выключен ночной режим и не нахожусь дома, то проверять pauseGPS
elseif (!gg('NightMode.active') AND (gg('Peter.HomeDistance') > 300))
{ $gps_delay = gg('Peter.pauseGPS'); }
if ((time() - gg('Peter.CoordinatesUpdatedTimestamp')) > $gps_delay*60) {
findMyiPhone(gg('Peter.AppleID'), gg('Peter.ApplePass'));
}
/*
// напомнить, что нужно выходить из дома
if (timeIs('08:30')) {
$status="";
$status.=' Температура за окном '.getGlobal('ow_fact.temperature')." градусов цельсия.";
$tm=(float)getGlobal('ow_fact.temperature');
if ($tm<-10) {
$status.=' Осторожно, очень холодно.';
} elseif ($tm<0) {
$status.=' Просто холодно.';
} elseif ($tm<5) {
$status.=' Довольно холодно. На мотоцикле я бы не рекомендовала сегодня ехать.';
} elseif ($tm<12) {
$status.=' Весьма прохладно.';
}
$status.=' Восход солнца сегодня в '.getGlobal('SunRiseTime').',';
$status.=' закат в '.getGlobal('SunSetTime').'.';
say($status,1);
}
if (timeIs('08:50')) {
say('Уже '.timeNow().' Пора собираться и выходить.',1);
//say('Напоминаю про задачи на сегодня.',1);
//runScript('readWunderTasks');
}
if (timeIs('21:30')) {
say('Алиса желает вам спокойной ночи. Не забудьте проветрить комнату перед сном.',1);
}
}
if (($h>=9) && !getGlobal('NobodyHomeMode.active')) {
if ($m=="00") {
say('Сейчас '.timeNow(),1);
}
}
if ($m=="01" || $m=="16" || $m=="31") {
runScript('checkZal');
runScript('checkKotel');
// callMethod("Valve.refresh");
}
*/
/*
if (gg('ThisComputer.AlarmStatus') && timeIs(gg('ThisComputer.AlarmTime'))) {
runScript('MorningAlarm');
}
*/
/* шторы
if (timeIs('08:00') && gg('needOpenCurtains')) {
//callMethod('BedroomCurtains.open');
runScript('moveCurtainsBedroom',array('open'=>1));
runScript('moveCurtains',array('open'=>1));
setGlobal('needOpenCurtains',0);
}
*/
/*
$led_status=gg('timeNow').' '.gg('ws.tempOutside').'/'.gg('sensorZal.temp');
if (gg('ThisComputer.DayOfWeekTXT')=='среда' && timeBefore('11:00')) {
$led_status.=' Take out trash!';
}
sg('ledboard',$led_status);
runScript('garageVentCheck'); // вентиляция гаража
*/
setGlobal('ThisComputer.hour',date('H'));Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date('H:i'));
if ($this->getProperty('active') == '1') {
say("Режим ".$this->getProperty('title')." активирован.");
} else {
say("Режим ".$this->getProperty('title')." выключен.");
}$this->setProperty('active',1);$this->setProperty('active',0);Объекты класса:
setGlobal('minMsgLevel','2');setGlobal('minMsgLevel','1');/*
runScript('moveCurtainsBedroom',array('close'=>1));
callScript('moveCurtains',array('close'=>1));
if (!getGlobal('NobodyhomeMode.active') && gg('AutoLightLivingroom')) {
callMethod("noo8.turnOn"); //подсветка мебели в зале
//проверяем, если всё везде выключено, то включаем свет
$check=array('noo7','lcw2','lcw3','lcw5','lcw1','lcw7','lcw8');
$turned_on=0;
foreach($check as $l) {
if (gg($l.'.status')) {
$turned_on=1;
break;
}
}
if (!$turned_on) {
say('А чего это мы в темноте сидим?',2);
callMethod('lcw3.turnOn'); //подветка неон
callMethod('lcw5.turnOn'); //люстра
callMethod('lcw1.turnOn'); //бар
}
}
*//*
if (timeAfter('06:40')) {
//callMethod('BedroomCurtains.open'); // открываем шторы
runScript('moveCurtainsBedroom',array('open'=>1));
runScript('moveCurtains',array('open'=>1));
setGlobal('needOpenCurtains',0);
} else {
setGlobal('needOpenCurtains',1);
}
runScript('turnOffLights');
**//*
callMethod("netping_pwr1.turnoff"); // выключаем насос горячей воды
runScript("checkZal");
if (timeBetween('23:00', '7:00')) {
say("Хотя скорее всего все спят :) Ночь ведь!");
}
runScript("turnOffLights");
$check=getObjectsByProperty('groupEco','==','1');
foreach($check as $obj) {
if (gg($obj.'.status')) {
callMethod($obj.'.turnOff');
usleep(500000);
}
}
if (gg('VLCPlayer.isPlaying')) {
runScript('playPause');
}
*//*
callMethod("netping_pwr1.turnon"); // включаем насос горячей воды
runScript("checkZal");
if (getGlobal('DarknessMode.active')) {
}
*//*
say("По-моему никого нет дома...");
setGlobal('somebodyHome',0); // ставим глобальный флаг на то что никого нет дома
//callMethod("MiLamp4.setColor",array('color'=>'#ff0000'));
//setGlobal('somebodyHomeText','Никого нет дома');
if (timeBetween('23:30','06:00')) {
say('Видимо все спят...');
} else {
say('Все куда-то ушли...');
}
runScript('takeCare');
if (!getGlobal('EconomMode.active')) {
callMethod('EconomMode.activate');
}
if (timeBetween('09:00','12:00') && (gg('RobotCleaning.passedDone')<=1)) {
runScript('startRoomba');
}
*//*
if (getGlobal('EconomMode.active')) {
callMethod('EconomMode.deactivate');
}
//callMethod("MiLamp4.setColor",array('color'=>'#00ff00'));
//setTimeOut('milamp4turnoff','callMethod("MiLamp4.turnOff");',10*60);
setGlobal('somebodyHome',1); // ставим глобальный флаг на то что кто-то дома
//setGlobal('somebodyHomeText','Дома кто-то есть');
say("Обнаружено движение.");
*/Свойства класса:
Методы класса:
$this->setProperty('status',$params['status']);
if ($this->getProperty('LinkedRoom')) {
$ob=$this->getProperty('LinkedRoom');
callMethod($ob.'.OnActivity');
}
$this->callMethod('onChange');$status=$this->getProperty("status");
if ($status) {
$this->callMethod('turnOn');
} else {
$this->callMethod('turnOff');
}$status=$this->getProperty("status");
if ($status) {
$this->callMethod('turnOff');
} else {
$this->callMethod('turnOn');
}$this->setProperty("status",0);$this->setProperty("status",1);Свойства класса:
Объекты класса:
getURL('http://localhost:8085/?4:0',0);getURL('http://localhost:8085/?4:1',0);getURL('http://localhost:8085/?6:0',0);getURL('http://localhost:8085/?6:1',0);Свойства класса:
Методы класса:
$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");
$this->setProperty('SomebodyHere',0);
$this->callMethod("updateActivityStatus");$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";Объекты класса:
Свойства класса:
Свойства класса:
Методы класса:
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date('Y-m-d H:i:s'));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=30*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
if (!isset($params['h'])) {
return;
}
$old_hum=$this->getProperty('humidity');
$h=round($params['h'],1);
if ($h>100) return;
$this->setProperty('humidity',$h);
if ($params['uptime']) {
$this->setProperty('uptime',$params['uptime']);
}
if ($h>$old_temp) {
$d=1;
} elseif ($h<$old_temp) {
$d=-1;
} else {
$d=0;
}
$this->setProperty('direction',$d);
$linked_room=$this->getProperty("LinkedRoom");
if ($linked_room) {
setGlobal($linked_room.'.Humidity',$h);
}Объекты класса:
Свойства класса:
Методы класса:
if ($params['status']) {
$this->setProperty('status',$params['status']);
}
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date('Y-m-d H:i:s'));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=96*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty('updated',time()); // выставляем время срабатывания сенсора
$this->setProperty("updatedTime",date('Y-m-d H:i:s'));
$this->setProperty('alive',1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=24*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout*60);
if ($params['status']) {
$this->setProperty('motionDetected',1);
clearTimeOut($this->object_title.'_detected');
setTimeOut($this->object_title.'_detected',"setGlobal('".$this->object_title.".motionDetected',0);",30);
$linked_room=$this->getProperty('LinkedRoom');
if ($linked_room!='') {
callMethod($linked_room.'.onActivity');
}
/*
if ($this->object_title=='sensorMovement3' || $this->object_title=='sensorMovementRemote1' || $this->object_title=='sensorMovementRemote2') {
//|| $this->object_title=='sensorMovement5'
return; // не реагируем на движение в спальне, по ip-сенсорам и по сенсору на втром этаже
*/
}
ClearTimeOut("nobodyHome");
SetTimeOut("nobodyHome","callMethod('NobodyHomeMode.activate');", 1*60*60); // выполняем если целый час никого не было
if (getGlobal('NobodyHomeMode.active')) {
callMethod('NobodyHomeMode.deactivate');
}
/*
$last_register=registeredEventTime('inhouseMovement'); // проверяем когда в последний раз срабатывало событие "движение внутри дома"
registerEvent('inhouseMovement',$this->name,2); // регистрируем событие "движение внутри дома"
if (timeBetween('05:00', '12:00') && ((time()-$last_register)>2*60*60)) {
runScript('Greeting'); // запускаем скрипт "доброе утро"
}
}
*/Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date('Y-m-d H:i:s'));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) { $alive_timeout=30; }
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout*60);
if (!isset($params['t'])) { return; }
$old_temp = $this->getProperty('Temperature');
$t = round($params['t'],2);
$delta = $old_temp - $t;
if (($t < '-80') OR ($t > '80')) { return; }
else
{
if (abs($delta) >= $this->getProperty('delta'))
{
$this->setProperty('Temperature',$t);
if ($t>$old_temp) {
$d=1;
} elseif ($t<$old_temp) {
$d=-1;
} else {
$d=0;
}
$this->setProperty('direction',$d);
$linked_room=$this->getProperty("LinkedRoom");
if ($linked_room) {
setGlobal($linked_room.'.Temperature',$t);
}
if ($this->getProperty('alarm') == 0)
{
$tMax = $this->getProperty("tMax");
$tMin = $this->getProperty("tMin");
if (($t < $tMin) OR ($t > $tMax))
{
$this->setProperty('alarm',1);
say("Внимание. Критическая температура датчика". $ot, 3);
}
}
}
}
Объекты класса:
runScript('TermostatGarage');Свойства класса:
Методы класса:
Объекты класса:
$details=array();
$red_state=0;
$yellow_state=0;
$cycles=array('states'=>'цикл проверки состояния','main'=>'главный цикл','execs'=>'цикл запуска команд','scheduler'=>'цикл планировщика');
foreach($cycles as $k=>$v) {
$tm=getGlobal('ThisComputer.cycle_'.$k.'Run');
if (time()-$tm>5*60) {
$red_state=1;
$details[]="Остановлен ".$v;
}
}
$cycles=array('websockets'=>'цикл вебсокетов','ping'=>'цикл пинг','webvars'=>'цикл веб переменных');
foreach($cycles as $k=>$v) {
$tm=getGlobal('ThisComputer.cycle_'.$k.'Run');
if (time()-$tm>10*60) {
$yellow_state=1;
$details[]="Остановлен ".$v;
}
}
$tmp=SQLSelectOne("SELECT ID FROM system_errors WHERE ACTIVE>0 LIMIT 1");
if ($tmp['ID']) {
$yellow_state=1;
$details[]="Сохранена системная ошибка";
}
$cycles=array('phase1'=>'Фаза 1','phase2'=>'Фаза 2','phase3'=>'Фаза 3');
foreach($cycles as $k=>$v) {
$tm=getGlobal($k.'.voltage');
if ($tm<180) {
$red_state=1;
$details[]=$v." обесточена";
}
}
/*
if (isOnline('Контроллер Arduino 2')!==1) {
$red_state=1;
$details[]="Недоступен исполнительный контроллер";
}
*/
/*
$onlines_yellow=array(
'MegaD'=>'Контроллер освещения (2й этаж)',
'Контроллер Arduino_RF_RCV'=>'RF-приёмник',
'Контроллер Arduino Light Controller'=>'Контроллер освещения'
);
foreach($onlines_yellow as $k=>$v) {
if (isOnline($k)!==1) {
$yellow_state=1;
$details[]="Недоступен ".$v;
}
}
$onlines_red=array(
'Контроллер Arduino Relay'=>'Контроллер реле',
'Контроллер Arduino 1'=>'Контроллер датчиков'
);
foreach($onlines_red as $k=>$v) {
if (isOnline($k)!==1) {
$red_state=1;
$details[]="Недоступен ".$v;
}
}
*/
// Проверка всех сенсоров системы на alive
$sensors=array();
$objects = getObjectsByClass("Sensors");
foreach($objects as $object)
{
$obj_title = $object['TITLE'];
$obj_id = $object['ID'];
$obj=getObject($obj_title);
$sensors[$obj_title] = $obj_title;
}
foreach($sensors as $k=>$v) {
if (gg($k.'.alive') == '0') {
$yellow_state=1;
$details[]="Сенсор ".$v." не обновляется";
}
}
// Проверка всех сенсоров температуры на alarm
$sensors=array();
$objects = getObjectsByClass("Temperature");
foreach($objects as $object)
{
$obj_title = $object['TITLE'];
$obj_id = $object['ID'];
$obj=getObject($obj_title);
$sensors[$obj_title] = $obj_title;
}
foreach($sensors as $k=>$v) {
if (gg($k.'.alarm') == '1') {
$red_state=1;
$details[]="Критическая температура датчика ".$v;
}
}
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;
if (!isOnline('Internet')) {
$yellow_state=1;
$details[]="Нет доступа в Интернет";
}
/*
$balance=(int)getGlobal('Dialog.balance');
if ($balance<100000) {
$yellow_state=1;
$details[]="Низкий баланс на счету за Интернет";
}
if (!isOnline('192.168.0.2')) {
$red_state=1;
$details[]="Не доступен шлюз и беспроводная сеть";
}
*/
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;
if ((gg('EntryGates.status')==0) && (gg('GarageGates.status')==0)) {
$yellow_state=1;
$details[]="Ворота и гараж открыты";
} elseif (gg('EntryGates.status')==0) {
$yellow_state=1;
$details[]="Ворота открыты.";
}
if ((gg('NobodyHomeMode.active') == '1' OR gg('SecurityArmedMode.active') == '1') && gg('EntryGates.status')==0 && gg('GarageGates.status')==0) {
$red_state=1;
$message_to_iPhone = "Дома никого нет, а ворота и гараж открыты";
$details[] = $message_to_iPhone;
say($message_to_iPhone,3);
messageToMyiPhone(gg('Peter.AppleID'), gg('Peter.ApplePass'), $message_to_iPhone, 'Тревога', 1, 0);
}
/*
if (!isOnline("Камера (второй этаж)")) {
$yellow_state=1;
$details[]="Камера на втором этаже недоступна";
}
*/
/*
if (!isOnline("192.168.0.116")) {
$yellow_state=1;
$details[]="Камера в мастерской недоступна";
}
*/
/*
if (!isOnline("192.168.0.11")) {
$yellow_state=1;
$details[]="Камера в гостиной недоступна";
}
*/
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');
}Свойства класса:
Методы класса:
$ot=$this->object_title;
setTimeOut($ot."_alive", $func, $this->getProperty('pauseGPS')); Объекты класса:
, Россия
© 2026 SJLab | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving