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("Отключено питание");
$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); }
cm("Informer_1.LoggerMessage");
Class properties:
Class methods:
//$params["USER_OBJECT"]
//$params["USER_OBJECT"]
Class objects:
Class properties:
Class methods:
//$params['t'] $this->setProperty("updated",time()); $this->setProperty("updatedTime",date("H:i",time())); $this->setProperty("alive",1); $ot=$this->object_title; $alive_timeout=(int)$this->getProperty("aliveTimeOut"); if (!$alive_timeout) { $alive_timeout=30*60; } clearTimeOut($ot."_alive"); setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout); if (!isset($params['h'])) { return; } $old_temp=$this->getProperty('humidity'); $t=round($params['h'],1); if ($t>100) return; $this->setProperty('humidity',$t); if ($params['uptime']) { $this->setProperty('uptime',$params['uptime']); } 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.'.Humidity',$t); }
Class objects:
Class properties:
Class methods:
$this->setProperty("updatedTimeSensor",date("d/m/y H:i")); $this->setProperty("temp", $params['temp']); $this->setProperty("hum", $params['hum']); $this->setProperty("hic", $params['hic']);
$this->setProperty("updatedTime",date("d/m/y H:i")); $DebugCode2 = $this->getProperty("DebugCode1"); $this->setProperty("DebugCode2", $DebugCode2); $DebugCode1 = $this->getProperty("ResiverCode"); $this->setProperty("DebugCode1", $DebugCode1);
Class objects:
//say("работает", 3); $testcode = $this->getProperty("testcode"); $ResiverCode = $this->getProperty("ResiverCode"); runScript("AverMedia_Samsung", array('code' => $ResiverCode)); //if($ResiverCode == $testcode ) say("работает", 3); //callMethod('LAMP1.switch'); if($ResiverCode == gg("SAMSUNG.Play")) callMethod('SVET_DETSKAJA.switch'); //say("работает както", 3);
//say("работает", 3); $testcode = $this->getProperty("testcode"); $ResiverCode = $this->getProperty("ResiverCode"); runScript("AverMedia_Samsung", array('code' => $ResiverCode)); //if($ResiverCode == $testcode ) say("работает", 3); //callMethod('LAMP1.switch'); if($ResiverCode == gg("SAMSUNG.Play")) { callMethod('LUSTRA_ZAL_1.switch'); //say("работает както", 3); }
Class properties:
Class methods:
if ($params['status']) { $this->setProperty('status',$params['status']); } $this->setProperty('updatedTimestamp',time()); $this->setProperty("alive",1); $ot=$this->object_title; $alive_timeout=(int)$this->getProperty("aliveTimeOut"); if (!$alive_timeout) { $alive_timeout=12*60*60; } clearTimeOut($ot."_alive"); setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
Class properties:
Class methods:
$this->setProperty('status',$params['status']); // выставляем статус сенсора $this->setProperty('updatedTimestamp',time()); // выставляем время срабатывания сенсора $this->setProperty('alive',1); $ot=$this->object_title; $alive_timeout=(int)$this->getProperty("aliveTimeOut"); if (!$alive_timeout) { $alive_timeout=24*60*60; } clearTimeOut($ot."_alive"); setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout); if ($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'); // запускаем скрипт "доброе утро" } }
Class objects:
Class properties:
Class methods:
$IP_address=$this->getProperty("IP_address"); $token=$this->getProperty("token"); $MotionSens=$this->getProperty("MotionSens"); //say("$SendString", 3); getURL("http://".$IP_address.'/informer?token='.$token.'&power=1', 0); if($MotionSens == 1) { clearTimeout($this->object_title."_timeout"); }
$IP_address=$this->getProperty("IP_address"); $token=$this->getProperty("token"); $MotionSens=$this->getProperty("MotionSens"); $MotionTimer=$this->getProperty("MotionTimer")*60; //say("$SendString", 3); getURL("http://".$IP_address.'/informer?token='.$token.'&power=0', 0); if($MotionSens == 1) { setTimeout($this->object_title."_timeout", "sg('".$this->object_title.".power',0);",$MotionTimer); }
$SayString=$this->getProperty("SendInformer"); $DingDong=$this->getProperty("DingDong"); //Звуковой сигнал при отправке сообщения if($DingDong == 1)sg("XiaomiGatewayRadio.ringtone", "10"); say($SayString, 3);
$status=$this->getProperty("power"); if ($status) { $this->callMethod('InformerOn'); } else { $this->callMethod('InformerOff'); }
$IP_address=$this->getProperty("IP_address"); $token=$this->getProperty("token"); $SendString=gg("ThisComputer.lastSayMessage"); $this->setProperty("CurentString", $SendString); $SendStringCode=urlencode($SendString); //say("$SendString", 3); getURL("http://".$IP_address.'/informer?token='.$token.'&priority=high&string='.$SendStringCode.'', 0);
$IP_address=$this->getProperty("IP_address"); $token=$this->getProperty("token"); $TempStreet=round(gg("ThisComputer.StreetTemperature"),1); $HumStreet=round(gg("MYMETEO.Humidity"),1); $TempHome=round(gg("MYMETEO.DS18B20_1"),1); $weather_type=gg("ow_fact.weather_type"); $HumRoom=round(gg("IR_DETSKAJA.hum"),1); $veter=gg("ow_fact.wind_speed"); $wind_direction=gg("ow_fact.wind_direction_full"); $CurTime=gg("ThisComputer.timeNow"); //$SendString="Сейчас ".$CurTime." Т.ул ".$TempStreet."`С Вл.ул ".$HumStreet."% Т.комн ".$TempHome."`C Ветер ".$wind_direction." ".$veter." m/c ".$weather_type.""; $SendString="".$CurTime." Т.у ".$TempStreet."`С Вл.у ".$HumStreet."% Т.к ".$TempHome."`C Вл.к ".$HumRoom."% Ветер ".$wind_direction." ".$veter." m/c ".$weather_type.""; $this->setProperty("CurentString", $SendString); $SendStringCode=urlencode($SendString); //say("$SendString", 3); getURL("http://".$IP_address.'/informer?token='.$token.'&string='.$SendStringCode.'', 0);
Class objects:
Class objects:
Class properties:
Class methods:
$this->setProperty('active',1);
$this->setProperty('active',0);
$this->setProperty("updated",time()); $this->setProperty("updatedTime",date('H:i')); if ($this->getProperty('active')) { say("Режим ".$this->getProperty('title')." активирован."); } else { say("Режим ".$this->getProperty('title')." выключен."); }
Class objects:
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} */
/* 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_deactivate.php'); /* end injection of {SDevices} */
// не вызывать род. метод $night=gg('NightMode.active'); $security=gg('SecurityArmedMode.active'); if ($night && !$security) { $this->setProperty('active',2); } else { $this->setProperty('active',1); } //ClearTimeOut('nobodyHome'); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_activate.php'); /* end injection of {SDevices} */
//не вызывать род. метод $this->setProperty('updated',time()); $this->setProperty('updatedTime',date('H:i')); $sayModes = gg('Sets.sayModes'); //Название режима switch ($this->getProperty('active')) { case 0: $s='Кто-то дома'; break; case 1: $s='Никого нет дома'; break; case 2: $s='Все спят'; break; } $this->setProperty('title', $s); //if ($sayModes) { // 11072018 иначе не пишет включение режима say('Режим '.$s.' установлен.'); //, 1); //} /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_updateActivityStatus.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/econommode_deactivate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/econommode_activate.php'); /* end injection of {SDevices} */
Class objects:
include_once(DIR_MODULES.'app_radio/app_radio.class.php'); $app_radio=new app_radio(); if(is_array($params)) { if(isset($params['sta'])) $app_radio->change_station($params['sta'],$app_radio); if(isset($params['cmd'])) $app_radio->control($params['cmd']); if(isset($params['vol'])) $app_radio->set_volume($params['vol'],$app_radio); } else { if($params=='play' || $params=='stop') $app_radio->control($params); else if(strpos($params, "vol")===0) $app_radio->set_volume((int)substr($params,3),$app_radio); else if(strpos($params, "sta:")===0) $app_radio->change_station(substr($params,4),$app_radio); }
Class properties:
Class methods:
$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);
Class objects:
$status=$this->getProperty("status"); $TimerSecund=$this->getProperty("TimerSecund"); if ($status) { getURL('http://192.168.1.139/on?token=esp8266', 0); say("Чайник включен", 3); //setTimeOut('Chaynic',"$this->setProperty("status",0);", 10); setTimeout($this->object_title."_timeout", "sg('".$this->object_title.".status',0);",$TimerSecund); } else { say("Чайник согрелся", 3); getURL('http://192.168.1.139/off?token=esp8266', 0); clearTimeout($this->object_title."_timeout"); $this->setProperty("TimerSecund",370); }
getURL('http://192.168.1.109/on?token=esp8266', 0);
getURL('http://192.168.1.109/off?token=esp8266', 0);
Class properties:
Class methods:
$this->setProperty("status",0); //safe_exec('"c:\Program Files\nooLite\noolite.exe" -api -off_ch'.$this->getProperty("channel")); $this->callMethod("sendCommand",array('command'=>'-off_ch'.$this->getProperty("channel")));
$this->setProperty("status",1); $this->callMethod("sendCommand",array('command'=>'-on_ch'.$this->getProperty("channel")));
$cmdline='"c:\Program Files\nooLite\nooLite.exe" -api '.$params['command']; $last_called=gg('NoolightCommandSend'); $min_delay=3; $now=time(); if (($now-$last_called)>$min_delay) { //safe_exec($cmdline); $last_callled=$now; sg('NoolightCommandSend',$last_called); DebMes("Noolite instant exec: ".$cmdline); system($cmdline); //exec($cmdline); } else { if ($last_callled<$now) { $last_callled=$now; } $last_called+=$min_delay; sg('NoolightCommandSend',$last_called); DebMes("Noolite scheduled job for ".date('H:i:s',$last_called)); AddScheduledJob("noolight".md5($cmdline),"safe_exec('".$cmdline."');",$last_called); }
Class properties:
Class methods:
$code1=$this->getProperty('Code1'); $code2=$this->getProperty('Code2'); safe_exec("c:\_majordomo\apps\arduino_gw\arduino_gw.exe rcon$code1:$code2;"); $this->setProperty("status",1);
$code1=$this->getProperty('Code1'); $code2=$this->getProperty('Code2'); safe_exec("c:\_majordomo\apps\arduino_gw\arduino_gw.exe rcoff$code1:$code2;"); $this->setProperty("status",0);
Class properties:
Class methods:
$status=$this->getProperty("status"); $IP_address=$this->getProperty("IP_address"); $token=$this->getProperty("token"); $NomerRelay=$this->getProperty("NomerRelay"); $MotionSensor=$this->getProperty("MotionSensor"); $MotionCounter=$this->getProperty("MotionCounter"); if($MotionSensor == 1) { $MotionCounterCur=$MotionCounter+1; $this->setProperty("MotionCounter", $MotionCounterCur); $TimerSecund=($this->getProperty("TimerMinuteMotion")*60); if($TimerSecund == 0) { if($MotionCounter >=4 ) $MotionCounter = 5; $TimerSecund=(2+$MotionCounter)*60; } } else { $TimerSecund=($this->getProperty("TimerMinute")*60); } // Включаем выключатель. getURL('http://'.$IP_address.'/relay?token='.$token.'&relay='.$NomerRelay.'&state=on', 0); if($TimerSecund != 0) { setTimeout($this->object_title."_timeout", "sg('".$this->object_title.".DevButton',0);",$TimerSecund); }
$DevButton=$this->getProperty("DevButton"); if ($DevButton) { cm("$this->object_title.turnOn"); } else { cm("$this->object_title.turnOff"); }
$status=$this->getProperty("status"); $IP_address=$this->getProperty("IP_address"); $token=$this->getProperty("token"); $NomerRelay=$this->getProperty("NomerRelay"); $TimerSecund=($this->getProperty("TimerMinute")*60); getURL('http://'.$IP_address.'/relay?token='.$token.'&relay='.$NomerRelay.'&state=off', 0); if($TimerSecund != 0) { clearTimeout($this->object_title."_timeout"); } $this->setProperty("MotionSensor", 0); $this->setProperty("MotionCounter", 0);
Class objects:
//say("Включено", 3); setGlobal("LUSTRA_ZAL_2.DevButton",1);
//say("Выключено", 3); setGlobal("LUSTRA_ZAL_2.DevButton",0);
//актуализируем статус потолочной люстрыв веб интерфейсе cm("YeelinklightceilingSpalmja.SaveState"); setGlobal("YeelinklightceilingSpalmja.power",0);
//Востанавливаем настройки связаной люстры через таймер setTimeout($this->object_title."_restore", "sg('YeelinklightceilingSpalmja.RestoreTimerState',1);",6);
Class properties:
Class methods:
$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="Кто-то дома1: ".implode(", ",$res_rooms); } setGlobal('somebodyHomeText',$somebodyHomeText); //echo "Updated"; /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_updateActivityStatus.php'); /* end injection of {SDevices} */
$this->setProperty('SomebodyHere',0); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_onIdle.php'); /* end injection of {SDevices} */
$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} */
Class objects:
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_setUpdatedText.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SDevices_statusUpdated.php');
require(DIR_MODULES.'devices/SDevices_logicAction.php');
Class properties:
Class methods:
require(DIR_MODULES.'devices/SButtons_pressed.php');
Class objects:
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCameras_takeSeries.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_updatePreview.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCameras_motionDetected.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
require(DIR_MODULES.'devices/SControllers_turnOn.php');
require(DIR_MODULES.'devices/SControllers_turnOff.php');
require(DIR_MODULES.'devices/SControllers_switch.php');
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_levelWorkUpdated.php'); /* end injection of {SDevices} */
require(DIR_MODULES.'devices/SDimmers_turnOn.php');
require(DIR_MODULES.'devices/SDimmers_turnOff.php');
require(DIR_MODULES.'devices/SDimmers_levelUpdated.php');
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_levelWorkUpdated.php'); /* end injection of {SDevices} */
Class objects:
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SRGB_colorUpdated.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_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SRGB_turnOff.php'); /* end injection of {SDevices} */
Class objects:
Class properties:
Class methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_tempDown.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_tempUp.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_valueUpdated.php'); /* end injection of {SDevices} */
Class properties:
Class methods:
/* 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} */
Class methods:
//Проверка датчиков протечки runScript("Protechka"); $Status=$this->getProperty("Status"); $room=$this->getProperty("linkedRoom"); if($Status == 0) { say("Протечка ".$room." устранена.", 3); } /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_statusUpdated.php'); /* end injection of {SDevices} */
Class objects:
Class properties:
Class methods:
require(DIR_MODULES.'devices/SMotions_motionDetected.php');
Class objects:
//say("Включено", 3); if(gg("SVET_KORIDOR.MotionSensorEnable") == 1) { if(gg("SVET_KORIDOR.status")==1 || gg("light_koridor.value") < gg("SVET_KORIDOR.LightOn" )) { sg("SVET_KORIDOR.MotionSensor", 1); cm("SVET_KORIDOR.turnOn"); //say("Люстра Включено", 3); } }
//say("Включено", 3); if(gg("SVET_VANNA.MotionSensorEnable") == 1) { if(gg("SVET_VANNA.status")==1 || gg("light_vana.value") < gg("SVET_VANNA.LightOn" )) { sg("SVET_VANNA.MotionSensor", 1); cm("SVET_VANNA.turnOn"); //say("Люстра Включено", 3); } }
//say("Включено", 3); if(gg("SVET_TUALET.MotionSensorEnable") == 1) { if(gg("SVET_TUALET.status")==1 || gg("light_tualet.value") < gg("SVET_TUALET.LightOn" )) { sg("SVET_TUALET.MotionSensor", 1); cm("SVET_TUALET.turnOn"); //say("Люстра Включено", 3); } }
//say("Включено", 3); $status=$this->getProperty("status"); if(gg("LUSTRA_ZAL_1.MotionSensorEnable") == 1 ) { if(gg("LUSTRA_ZAL_1.status")==1 || gg("Sensor_light01.value") < gg("LUSTRA_ZAL_1.LightOn" )) { sg("LUSTRA_ZAL_1.MotionSensor", 1); cm("LUSTRA_ZAL_1.turnOn"); //say("Люстра Включено", 3); } } if(gg("Sonoff_S20_2.MotionSensorEnable") == 1 ) { if(gg("Sonoff_S20_2.status")==1 || gg("Sensor_light01.value") < gg("Sonoff_S20_2.LightOn" )) { sg("Sonoff_S20_2.MotionSensor", 1); cm("Sonoff_S20_2.turnOn"); } } if(gg("Informer_1.MotionSens") == 1 ) { sg("Informer_1.power", 1); }
Class properties:
Class methods:
require(DIR_MODULES.'devices/SOpenClose_statusUpdated.php');
Class properties:
Class methods:
require(DIR_MODULES.'devices/SSensors_valueUpdated.php');
Class properties:
Class properties:
Class objects:
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 methods:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_statusUpdated.php'); /* end injection of {SDevices} */
Class methods:
Class objects:
echo "status received: ".$params['status'];
global $voicemode; $voicemode='off'; processCommand($params['message']);
Class properties:
Class methods:
Class objects:
$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; $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."."; } } 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 ($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'); }
Class properties:
Class methods:
//$params['t'] $this->setProperty("updated",time()); $this->setProperty("updatedTime",date("H:i",time())); $this->setProperty("alive",1); $ot=$this->object_title; $alive_timeout=(int)$this->getProperty("aliveTimeOut"); if (!$alive_timeout) { $alive_timeout=30*60; } clearTimeOut($ot."_alive"); setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout); if (!isset($params['t'])) { return; } $old_temp=$this->getProperty('temp'); $t=round($params['t'],1); if ($t>110) return; $this->setProperty('temp',$t); if ($params['uptime']) { $this->setProperty('uptime',$params['uptime']); } 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); }
Class objects:
Class properties:
Class methods:
$this->setProperty("updatedTime",date("d/m/y H:i"));
Class objects:
Class properties:
Class methods:
//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
Class objects:
if (timeIs('21:00')) { getURL('http://localhost/modules/app_postoffice/check_post.php',0); runScript('voshod_zakat'); } // Проверяем посылки require_once(DIR_MODULES . '/app_PostTracker/app_PostTracker.class.php'); $PostTracker = new app_PostTracker(); $PostTracker->updateStatuses(); //Проверяем курс валют runScript('valuta');
$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')); //17062018 для проверки статуса есть ли кто дома //Режимы $night=gg('NightMode.active'); $nobody=gg('NobodyHomeMode.active'); //$entrance=gg('Openclose01.entrance'); //Режим "Никого нет дома" $inhome=0; //Проверка есть ли люди дома по WIFI и GPS $objects=getObjectsByClass('Users'); foreach($objects as $obj){ if (gg($obj['TITLE'].'.presence')==1){ $inhome=1; break; } } //Проверка есть ли активность дома в Rooms // 10072018 if (!$inhome){ $inRoooms=0; $objects=getObjectsByClass('Rooms'); foreach($objects as $obj){ if (gg($obj['TITLE'].'.SomebodyHere')==1){ $inRoooms=1; $inhome=1; break; } } //} //если никто не обнаружен и режим "кто-то есть" и не ночь и время от сработки двери меньше 15 мин. //если никто не обнаружен и режим "кто-то есть или никого нет" и ночь //if ((!$inhome && $nobody==0 && !$night && $entrance) || (!$inhome && $nobody<=1 && $night)){ if ((!$inhome && $nobody==0 && !$night) || ($inhome && !$inRoooms && $nobody<=1 && $night)) { say("Тест активации режима присудствия", 3); callMethodSafe('NobodyHomeMode.activate'); } //если кто то есть и режим "все спят или никого нет" //if ($inhome && $nobody>=1){ if (($inhome && $nobody>=1 && !$night) || ($inRoooms && $nobody>=1 && $night)) { //say("Тест деактивации режима присудствия", 3); callMethodSafe('NobodyHomeMode.deactivate'); } //HomeStatus правленый под три состояния $homeStatus=date('H:i'); if ($nobody==1) { $homeStatus.=' Дома никого.'; } elseif ($nobody==2) { $homeStatus.=' Все спят.'; } else { $homeStatus.=' Дома кто-то есть.'; } //Конец 17062018 для проверки статуса есть ли кто дома $homeStatus.=' '.getGlobal('Security.stateDetails'); $homeStatus.=' '.getGlobal('System.stateDetails'); $homeStatus.=' '.getGlobal('Communication.stateDetails'); setGlobal('HomeStatus',$homeStatus); if (timeBetween(getGlobal('ThisComputer.SunRiseTime'),getGlobal('ThisComputer.SunSetTime')) && getGlobal('isDark')=="1") { setGlobal("isDark",0); callMethod('DarknessMode.deactivate'); } elseif (!timeBetween(getGlobal('ThisComputer.SunRiseTime'),getGlobal('ThisComputer.SunSetTime')) && getGlobal('isDark')!="1") { setGlobal("isDark",1); callMethod('DarknessMode.activate'); } if (timeIs(getGlobal('ThisComputer.SunRiseTime'))) { say('Всходит солнце'); } if (timeIs(getGlobal('ThisComputer.SunSetTime'))) { say('Солнце заходит',2); } if (timeIs("23:30") && (gg("EconomMode.active")!="1") && (gg("NobodyHomeMode.active")=="1")) { say("Похоже никого нет сегодня, можно сэкономить немного."); callMethod('EconomMode.activate'); } if (timeIs('22:11')) { callMethod('NightMode.activate'); } elseif (timeIs('08:26')) { callMethod('NightMode.deactivate'); } if (timeIs("03:00")) { runScript("systemMaintenance"); } if (gg('ThisComputer.AlarmStatus') && timeIs(gg('ThisComputer.AlarmTime'))) { runScript('MorningAlarm'); } //будильник $objects=getObjectsByClass("AlarmClock"); foreach($objects as $obj) { // переберем все будильники в системе if (getGlobal($obj['TITLE'].".AlarmOn") && timeIs(getGlobal($obj['TITLE'].".AlarmTime"))){ //если будильник включен и время совпало callMethod($obj['TITLE'].".AlarmRun"); // выполним метод будильника } } //Проверяем заряд батарей if ($m%5 == 0) { runScript('BatLevel'); } //Информер 1 cm("Informer_1.TimerMessage"); // Проверяем дома ли телефоны 17062018 if ($m%2) { //не чётные runScriptSafe('CheckOnline'); } //Проверка датчиков протечки runScript("Protechka"); //Переключаем термомет чтобы солнышко не припекало if(timeBetween("16:00","01:00") == 1) sg("ThisComputer.StreetTemperature", gg("IR_ZAL.temp")); else sg("ThisComputer.StreetTemperature", gg("MYMETEO.HumidityTemp"));
Class methods:
Class objects:
if ($params['serial']=='' && $params['devname']!='') { $params['serial']=$params['devname']; } $device=SQLSelectOne("SELECT * FROM usbdevices WHERE SERIAL LIKE '".$params['serial']."'"); if (!$device['ID']) { // new device connected //say("Подключено новое устройство",1); $device=array(); $device['SERIAL']=$params['serial']; $device['TITLE']='устройство '.$params['devname']; $device['FIRST_FOUND']=date('Y-m-d H:i:s'); $device['LAST_FOUND']=date('Y-m-d H:i:s'); $device['LOG'].=$device['FIRST_FOUND'].' подключено (впервые)'."\n"; $device['ID']=SQLInsert('usbdevices',$device); } else { // device already in our database //say("Подключено ".$device['TITLE'],1); if ($device['USER_ID']) { $user=SQLSelectOne("SELECT * FROM users WHERE ID='".$device['USER_ID']."'"); if ($user['ID']) { //$user['NAME']; // теперь мы знаем имя пользователя, связанного с этим устройством } } $device['LAST_FOUND']=date('Y-m-d H:i:s'); $device['LOG']=$device['LAST_FOUND'].' подключено'."\n".$device['LOG']; SQLUpdate('usbdevices',$device); if ($device['SCRIPT_ID']!='') { runScript($device['SCRIPT_ID'],$params); } elseif ($device['SCRIPT']!='') { eval($device['SCRIPT']); } }
Class properties:
Class methods:
$gps=$this->getProperty('atHome'); $wifi=$this->getProperty('isHome'); //registerEvent('presence',$this->name,2); if (!$gps && !$wifi) { $this->setProperty('presence','0'); $this->setProperty('NameColor','orange'); } else { $this->setProperty('presence','1'); $this->setProperty('NameColor','green'); } if ($wifi) { $this->setProperty('NetworkPic','wifi'); } else { $this->setProperty('NetworkPic',''); }
//Сброс присутствия $ot=$this->object_title; $alive_timeout=5*60; setTimeOut($ot.'_isHome',"sg('".$ot.".isHome',0);",$alive_timeout); $last=$this->getProperty('isHomeTime'); $this->setProperty('isHomeTime',time()); $this->setProperty('isHomeUpdate',date('Y-m-d H:i',time())); //Установка флага и проверка на $status $status=$this->getProperty('isHome'); if (!$status) { $this->setProperty('isHome',1); } //Приветствовать //$GMailUnread=$this->getProperty('GMailUnread'); if ($this->getProperty('Greeting') == 1) { if (time()-$last>=(3*60*60)) { say('Здравствуйте '.$this->getProperty('fullName').'!'); //if ($GMailUnread>0) { //say('У Вас '.myMorph($GMailUnread,' непрочитанное письмо!',' непрочитанных письма!',' непрочитанных писем!')); //} } } //Сброс "nobodyHome", "простые устройства" ClearTimeOut('nobodyHome'); //13072018 чтобы не кого нет дома повторно через час не активировался
//$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("Location",Getgeocode($lon,$lat));
Class objects:
Class properties:
Class objects:
Class properties:
Class objects:
Class properties:
Class methods:
$state = $this->getProperty("RestoreTimerState"); if($state == 1) { $this->setProperty("ct",$this->getProperty("old_ct")); $this->setProperty("nl_br",$this->getProperty("old_nl_br")); $this->setProperty("bright",$this->getProperty("old_bright")); $this->setProperty("RestoreTimerState", 0); //say("включен", 3); }
$this->setProperty("old_bright",$this->getProperty("bright")); $this->setProperty("old_ct",$this->getProperty("ct")); $this->setProperty("old_nl_br",$this->getProperty("nl_br"));
Class objects:
//Перед включением надо включить выключатель куда потключена люстра $SonoffStatus=gg("SVET_SPALNJA.status"); $LampStatus = $this->getProperty("power"); if($SonoffStatus == 0 && $LampStatus == 1) { setGlobal("SVET_SPALNJA.DevButton",1); }
, Россия
© 2024 - Site Built By SergeJey | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Public agreement
SmartLiving