Свойства класса:
Методы класса:
Свойства класса:
Методы класса:
$this->setProperty('volumeLevel',$params['VALUE']);
if (IsWindowsOs()) {
$volume=round(65535*$params['VALUE']/100);
safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume);
} else {
safe_exec('amixer sset PCM,0 '.$params['VALUE'].'%');
}
say("Изменилась громкость до ".$params['VALUE']." процентов");Объекты класса:
$command=$params['command'];
$short_command='';
$dt=recognizeTime($command,$short_command);
if (preg_match('/скажи сколько врем/uis',$command)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята',2);
return;
}
global $voicemode;
$voicemode='on';
say('Сейчас '.timeNow(),2);
} elseif (preg_match('/сколько время/uis',$command)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята');
echo $short_command;
return;
}
say('Сейчас '.timeNow());
} elseif (preg_match('/повтори (.+)/uis',$command,$m) || preg_match('/скажи (.+)/uis',$command,$m)) {
if ($dt>0) {
addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt);
say('Задача принята',2);
return;
}
global $voicemode;
$voicemode='on';
say($m[1],2);
} else {
say('Неизвестная команда...',2);
}say("Отключено питание");Свойства класса:
Методы класса:
//$params["USER_OBJECT"]
//$params["USER_OBJECT"]
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/processHomebridgeMQTT.inc.php');
Объекты класса:
Свойства класса:
Методы класса:
$type = (int)$this->getProperty('Type');
$zone = (int)$this->getProperty('Zone');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_SWITCH_ON)]);
$this->setProperty('Status',1);$type = (int)$this->getProperty('Type');
$zone = (int)$this->getProperty('Zone');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_SWITCH_OFF)]);
$this->setProperty('Status',0);$type = (int)$this->getProperty('Type');
$zone = (int)$this->getProperty('Zone');
$brightness = (int)$this->getProperty('Brightness');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_SET_BRIGHTNESS,$brightness)]);$type = (int)$this->getProperty('Type');
$zone = (int)$this->getProperty('Zone');
$color = (int)$this->getProperty('Color');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_SET_COLOR,$color)]);
$this->setProperty('Mode','Color');$type = (int)$this->getProperty('Type');
$zone = (int)$this->getProperty('Zone');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_SWITCH_ON_WHITE,0)]);
$this->setProperty('Mode','White');$type = (int)$this->getProperty('Type');
$zone = (int)$this->getProperty('Zone');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_SWITCH_ON_NIGHT,0)]);
$this->setProperty('Mode','Night');function validate_hex($hex) {
if(preg_match("/^#([0-9a-fA-F]{6})$/", $hex) || preg_match("/^#([0-9a-fA-F]{3})$/", $hex)) {
$hex = substr($hex, 1);
}
if(preg_match("/^([0-9a-fA-F]{6})$/", $hex)) {
return $hex;
}
if(preg_match("/^([0-9a-f]{3})$/", $hex)) {
return substr($hex, 0, 1) . substr($hex, 0, 1) . substr($hex, 1, 1) . substr($hex, 1, 1) . substr($hex, 2, 1) . substr($hex, 2, 1);
}
return "000000";
}
function hex2hsl($hex) {
$hex = validate_hex($hex);
$hex = str_split($hex, 2);
$r = (hexdec($hex[0])) / 255;
$g = (hexdec($hex[1])) / 255;
$b = (hexdec($hex[2])) / 255;
return rgbToHsl($r,$g,$b);
}
function rgbToHsl( $r, $g, $b ) {
$oldR = $r;
$oldG = $g;
$oldB = $b;
$r /= 255;
$g /= 255;
$b /= 255;
$max = max( $r, $g, $b );
$min = min( $r, $g, $b );
$h;
$s;
$l = ( $max + $min ) / 2;
$d = $max - $min;
if( $d == 0 ){
$h = $s = 0; // achromatic
} else {
$s = $d / ( 1 - abs( 2 * $l - 1 ) );
switch( $max ){
case $r:
$h = 60 * fmod( ( ( $g - $b ) / $d ), 6 );
if ($b > $g) {
$h += 360;
}
break;
case $g:
$h = 60 * ( ( $b - $r ) / $d + 2 );
break;
case $b:
$h = 60 * ( ( $r - $g ) / $d + 4 );
break;
}
}
return round( $h, 2 );
}
$this->setProperty('Color',hex2hsl($this->getProperty('ColorHEX')));
$this->CallMethod('SetColor');$type = (int)$this->getProperty('Type');
$zone = (int)$this->getProperty('Zone');
$disco = (int)$this->getProperty('DiscoProgram');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_SET_DISCO_PROGRAM,$disco)]);
$this->setProperty('Mode','Disco');$type = (int)$this->getProperty('Type');
$zone = (int)$this->getProperty('Zone');
$saturation = (int)$this->getProperty('Saturation');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_SET_SATURATION,$saturation)]);$status = (int)$this->getProperty('Status');
if ($status==0) $this->CallMethod('PowerOn');
else $this->CallMethod('PowerOff');$type = (int)$this->getProperty('Type');
$zone = (int)$this->getProperty('Zone');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_DEC_DISCO_SPEED,0)]);$type = (int)$this->getProperty('Type');
$zone = (int)$this->getProperty('Zone');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_INC_DISCO_SPEED,0)]);$type = (int)$this->getProperty('Type');
$temp = (int)$this->getProperty('WhiteTemp');
$brightness = (int)$this->getProperty('Brightness');
include_once(ROOT.'lib/hardware/milight2.php');
$MiLight2 = new MiLight2();
$MiLight2->IP=$this->getProperty('Host');
$MiLight2->sendCmds([$MiLight2->getCmd($type,$zone,$MiLight2::CMD_SET_TEMPERATURE,$temp)]);
$this->setProperty('Mode','White');Объекты класса:
Объекты класса:
Свойства класса:
Методы класса:
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date('H:i'));
if ($this->getProperty('active')) {
say("Режим ".$this->getProperty('title')." активирован.", 0);
} else {
say("Режим ".$this->getProperty('title')." выключен.", 0);
}$this->setProperty('active',1);$this->setProperty('active',0);Объекты класса:
setGlobal('minMsgLevel','2');
//отключаем колонки
$cmdUrl = "http://192.168.1.36/gpio?st=0&pin=2";
getURL($cmdUrl,0);
//включаем подсветку
$cmdUrl = "http://192.168.1.52/gpio?st=1&pin=2";
getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.68/gpio?st=1&pin=2";
getURL($cmdUrl,0);
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/nightmode_activate.php');
/* end injection of {SDevices} */setGlobal('minMsgLevel','1');
//включаем колонки
$cmdUrl = "http://192.168.1.36/gpio?st=1&pin=2";
getURL($cmdUrl,0);
//выключаем подсветку
$cmdUrl = "http://192.168.1.52/gpio?st=0&pin=2";
getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.68/gpio?st=0&pin=2";
getURL($cmdUrl,0);
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/nightmode_deactivate.php');
/* end injection of {SDevices} */$objects=getObjectsByProperty('groupSunrise','=','1');
if (is_array($objects)) {
foreach($objects as $obj) {
callMethod($obj.'.turnOff');
}
}
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/darknessmode_deactivate.php');
/* end injection of {SDevices} */
//выключаем подсветку
$cmdUrl = "http://192.168.1.52/gpio?st=0&pin=2";
getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.68/gpio?st=0&pin=2";
getURL($cmdUrl,0);/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/darknessmode_activate.php');
/* end injection of {SDevices} */
//включаем подсветку
$cmdUrl = "http://192.168.1.52/gpio?st=1&pin=2";
getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.68/gpio?st=1&pin=2";
getURL($cmdUrl,0);
/* 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} */// сет над столом
geturl('http://192.168.1.57/i2cgo?adr=20&set=12FF&getlen=4',0);
$objects=getObjectsByProperty('groupEco','=','1');
if (is_array($objects)) {
foreach($objects as $obj) {
callMethod($obj.'.turnOff');
}
}
$objects=getObjectsByProperty('allOffGroup','=','1');
if (is_array($objects)) {
foreach($objects as $obj) {
callMethod($obj.'.turnOff');
}
}
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/econommode_activate.php');
/* end injection of {SDevices} */if (gg('DarknessMode.active')) {
$objects=getObjectsByProperty('greetingOnGroup','=','1');
if (is_array($objects)) {
foreach($objects as $obj) {
callMethod($obj.'.turnOn');
}
}
}
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/econommode_deactivate.php');
/* end injection of {SDevices} */Методы класса:
Объекты класса:
/* begin injection of {app_radio} */
include_once(DIR_MODULES.'app_radio/app_radio.class.php');
$app_radio = new app_radio();
if(is_array($params)) {
foreach($params as $key=>$value) {
switch((string)$key) {
case 'sta': $app_radio->change_station($params['sta'], $app_radio); break;
case 'cmd': $app_radio->control($params['cmd']); break;
case 'vol': $app_radio->set_volume($params['vol'], $app_radio); break;
default:
if($value == 'play' || $value == 'stop') $app_radio->control($value);
elseif(strpos($value, 'vol') === 0) $app_radio->set_volume((int)substr($value, 3), $app_radio);
elseif(strpos($value, 'sta:') === 0) $app_radio->change_station(substr($value, 4), $app_radio);
}
}
}
/* end injection of {app_radio} */Свойства класса:
Методы класса:
$latestActivity=$this->getProperty('LatestActivity');
$this->setProperty('LatestActivity',time());
$this->setProperty('LatestActivityTime',date('H:i'));
$this->setProperty('SomebodyHere',1);
$ot=$this->object_title;
if ($this->getProperty("IdleDelay")) {
$activity_timeout=(int)$this->getProperty("IdleDelay");
} else {
$activity_timeout=10*60;
}
clearTimeOut($ot."_activity_timeout");
setTimeOut($ot."_activity_timeout","callMethod('".$ot.".onIdle');",$activity_timeout);
$this->callMethod("updateActivityStatus");
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/Rooms_onActivity.php');
/* end injection of {SDevices} */$this->setProperty('SomebodyHere',0);
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/Rooms_onIdle.php');
/* end injection of {SDevices} */$rooms=getObjectsByClass("Rooms");
$total=count($rooms);
for($i=0;$i<$total;$i++) {
$rooms[$i]['room']=getGlobal($rooms[$i]['TITLE'].'.Title');
if (!$rooms[$i]['room']) {
$rooms[$i]['room']=$rooms[$i]['TITLE'];
}
$rooms[$i]['active']=getGlobal($rooms[$i]['TITLE'].'.SomebodyHere');
$rooms[$i]['time']=getGlobal($rooms[$i]['TITLE'].'.LatestActivity');
$rooms[$i]['diff']=time()-$rooms[$i]['time'];
}
function cmp($a, $b)
{
if ($a['diff'] == $b['diff']) {
return 0;
}
return ($a['diff'] < $b['diff']) ? -1 : 1;
}
usort($rooms,"cmp");
if (!$rooms[0]['active']) {
$somebodyHomeText="Никого нет дома. Были в ".date('H:i',$rooms[0]['time'])." (".$rooms[0]['room'].")";
} else {
$res_rooms=array();
for($i=0;$i<$total;$i++) {
if ($rooms[$i]['active']) {
$res_rooms[]=$rooms[$i]['room'];
}
}
$somebodyHomeText="Кто-то дома: ".implode(", ",$res_rooms);
}
setGlobal('somebodyHomeText',$somebodyHomeText);
//echo "Updated";
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/Rooms_updateActivityStatus.php');
/* end injection of {SDevices} */Объекты класса:
if (getGlobal('Motion05.AutoMode') == '1') {
callMethod("Relay10.turnOff");
}
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SDevices_statusUpdated.php');
require(DIR_MODULES.'devices/SDevices_logicAction.php');
$currentStatus=$this->getProperty('status');
if ($currentStatus) {
$this->callMethodSafe('turnOn');
} else {
$this->callMethodSafe('turnOff');
}
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SDevices_logicAction.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SDevices_setUpdatedText.php');
/* end injection of {SDevices} */$currentStatus=$this->getProperty('status');
$receivedStatus=$this->getProperty('receivedValue');
if ($currentStatus != $receivedStatus) $this->setProperty('status', $receivedStatus);Свойства класса:
Методы класса:
$currentStatus=$this->getProperty('status');
if ($currentStatus) {
require(DIR_MODULES.'devices/SButtons_pressed.php');
}
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SButtons_pressed.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SCameras_motionDetected.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SCameras_updatePreview.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SCameras_takeSnapshot.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SCameras_takeSeries.php');
/* end injection of {SDevices} */Объекты класса:
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SControllers_turnOn.php');
require(DIR_MODULES.'devices/SControllers_turnOff.php');
require(DIR_MODULES.'devices/SControllers_switch.php');
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SDimmers_levelUpdated.php');
require(DIR_MODULES.'devices/SDimmers_turnOn.php');
require(DIR_MODULES.'devices/SDimmers_turnOff.php');
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SDimmers_levelWorkUpdated.php');
/* end injection of {SDevices} */Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SGroups_turnOn.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SGroups_turnOff.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SGroups_switch.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SGroups_statusUpdated.php');
/* end injection of {SDevices} */Объекты класса:
$cmdUrl = "http://192.168.1.57/i2cgo?adr=20&set=1200&getlen=4"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.57/i2cgo?adr=20&set=12FF&getlen=4"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.36/gpio?st=0&pin=3"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.36/gpio?st=1&pin=3"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.36/gpio?st=0&pin=0"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.36/gpio?st=1&pin=0"; getURL($cmdUrl,0);
$cmdUrl = 'http://192.168.1.36/jsonoptions?write={"interrupt":{"1":{"mode":"timekey","timeforkey":8}}}';
getURL($cmdUrl,0);$cmdUrl = 'http://192.168.1.36/jsonoptions?write={"interrupt":{"1":{"mode":""}}}';
getURL($cmdUrl,0);$cmdUrl = "http://192.168.1.52/gpio?st=1&pin=3"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.52/gpio?st=0&pin=3"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.56/gpio?st=0&pin=3"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.56/gpio?st=1&pin=3"; getURL($cmdUrl,0);
if (getGlobal('Motion05.AutoMode') == '1') {
clearTimeOut("Relay11_OnTimer");
if (getGlobal('Relay10.status') == '1'){
SetTimeOut("Relay11_OnTimer","callMethod('Relay11.turnOn');",60);
}
} if (getGlobal('Motion05.AutoMode') == '1') {
clearTimeOut("Relay11_OffTimer");
if (getGlobal('Relay11.status') == '1')
SetTimeOut("Relay11_OffTimer","callMethod('Relay11.turnOff');",5*60);
}$cmdUrl = "http://192.168.1.56/gpio?st=1&pin=1"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.56/gpio?st=0&pin=1"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.52/gpio?st=0&pin=1"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.52/gpio?st=1&pin=1"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.68/gpio?st=1&pin=1"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.68/gpio?st=0&pin=1"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.68/gpio?st=0&pin=3"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.68/gpio?st=1&pin=3"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.62/gpio?st=1&pin=3"; getURL($cmdUrl,0);
$cmdUrl = "http://192.168.1.62/gpio?st=0&pin=3"; getURL($cmdUrl,0);
Свойства класса:
Методы класса:
/* 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} */Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SThermostats_valueUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SThermostats_statusUpdated.php');
/* end injection of {SDevices} *//* 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/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/SLeak_statusUpdated.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SMotions_motionDetected.php');
Объекты класса:
cm('Camera01.takeSnapshot');
bot_sendMessage(gg('vk_answer_id'), 'Кто-то пришел!!!', '/var/www/html/cms/images/'.gg('Camera01.snapshot')); $cmdUrl = "http://192.168.1.34:8765/?command=gdmss&timeoff=30"; getURL($cmdUrl,0);
bot_sendMessage(gg('vk_answer_id'), 'Звонит домофон!!!');if (getGlobal('Motion05.AutoMode') == '1') {
//callMethod("Relay10.turnOn");
}
if ($this->getProperty('receivedValue') == "0") $this->callMethod('motionDetected');Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SOpenClose_statusUpdated.php');
Свойства класса:
Методы класса:
require(DIR_MODULES.'devices/SSensors_valueUpdated.php');
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SBatterySensors_valueVoltageUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SBatterySensors_valueUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SBatterySensors_valueWorkVoltageUpdated.php');
/* end injection of {SDevices} */Свойства класса:
Свойства класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SPowerSensors_valueUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SPowerSensors_loadStatusChanged.php');
/* end injection of {SDevices} */Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SSmoke_statusUpdated.php');
/* end injection of {SDevices} */Свойства класса:
Свойства класса:
Методы класса:
Объекты класса:
$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.".";
}
}
/*
$objects=array('MotionSensor1'=>'Датчик движения 1','MotionSensor2'=>'Датчик движения 2','TempSensor01'=>'Датчик температуры','HumSensor01'=>'Датчик влажности');
foreach($objects as $k=>$v) {
if (!gg($k.'.alive')) {
$yellow_state=1;
$details[]="Не обновляется ".$v.'.';
}
}
*/
if ((int)gg('ThisComputer.SpaceProblems')>0) {
$red_state=1;
$details[]="Недостаточно места на диске (".gg('ThisComputer.SpaceProblems_Details').').';
}
if ($red_state) {
$state='red';
$state_title=LANG_GENERAL_RED;
} elseif ($yellow_state) {
$state='yellow';
$state_title=LANG_GENERAL_YELLOW;
} else {
$state='green';
$state_title=LANG_GENERAL_GREEN;
}
$new_details=implode(". ",$details);
if ($this->getProperty("stateDetails")!=$new_details) {
$this->setProperty('stateDetails',$new_details);
}
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say(LANG_GENERAL_SYSTEM_STATE." ".LANG_GENERAL_CHANGED_TO." ".$state_title.".");
say(implode(". ",$details));
} 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');
}Свойства класса:
Методы класса:
//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());
if($m>=0 && $m<15){
if(getGlobal('ThisComputer.lobzik')=='0'){
setGlobal('ThisComputer.lobzik','1');
$cmdUrl = "http://server.markovrv.ru:811/uartbrget?data=KOTELON";
//getURL($cmdUrl,0);
}
}
else{
if(getGlobal('ThisComputer.lobzik')=='1'){
setGlobal('ThisComputer.lobzik','0');
$cmdUrl = "http://server.markovrv.ru:811/uartbrget?data=KOTELOF";
//getURL($cmdUrl,0);
}
}
if (isWeekDay()) {
}
if (timeBetween(getGlobal('NightModeEnd'),getGlobal('NightModeStart')) && getGlobal('clockChimeEnabled')) {
if ($m=="00") {
say(timeNow(),1);
}
}
setGlobal('timeNow',date('H:i'));
$homeStatus=date('H:i');
if (getGlobal('NobodyHomeMode.active')) {
$homeStatus.=' Дома никого';
} else {
$homeStatus.=' Дома кто-то есть';
}
$homeStatus.=' '.getGlobal('Security.stateDetails');
$homeStatus.=' '.getGlobal('System.stateDetails');
$homeStatus.=' '.getGlobal('Communication.stateDetails');
setGlobal('HomeStatus',$homeStatus);
if (timeBetween(getGlobal('SunRiseTime'),getGlobal('SunSetTime')) && getGlobal('isDark')=="1") {
setGlobal("isDark",0);
callMethod('DarknessMode.deactivate');
} elseif (!timeBetween(getGlobal('SunRiseTime'),getGlobal('SunSetTime')) && getGlobal('isDark')!="1") {
setGlobal("isDark",1);
callMethod('DarknessMode.activate');
}
if (timeIs(getGlobal('SunRiseTime'))) {
say('Всходит солнце');
}
if (timeIs(getGlobal('SunSetTime'))) {
say('Солнце заходит');
}
if (timeIs("23:30") && (gg("EconomMode.active")!="1") && (gg("NobodyHomeMode.active")=="1")) {
say("Похоже никого нет сегодня, можно сэкономить немного.");
callMethod('EconomMode.activate');
}
if (timeIs(gg('NightModeStart'))) {
callMethod('NightMode.activate');
} elseif (timeIs(gg('NightModeEnd'))) {
callMethod('NightMode.deactivate');
}
if (timeIs("03:00")) {
runScript("systemMaintenance");
}
if (gg('ThisComputer.AlarmStatus') && timeIs(gg('ThisComputer.AlarmTime'))) {
runScript('MorningAlarm');
}function getDayRus(){
$days = array(
'Воскресенье', 'Понедельник', 'Вторник', 'Среда',
'Четверг', 'Пятница', 'Суббота'
);
return $days[(date('w'))];
}
function getDateRus(){
$monthes = array(
1 => 'Января', 2 => 'Февраля', 3 => 'Марта', 4 => 'Апреля',
5 => 'Мая', 6 => 'Июня', 7 => 'Июля', 8 => 'Августа',
9 => 'Сентября', 10 => 'Октября', 11 => 'Ноября', 12 => 'Декабря'
);
return ( (int)date('d') . ' ' . $monthes[(date('n'))] . date(' Y'));
}
$paths=array('/var/log/*.1','/var/log/*.2',
'/var/log/*.1.*',
'/var/log/*.2.*',
'/var/log/*.3.*',
'/var/log/*.4.*',
'/var/log/*.5.*',
'/var/log/*.6.*',
'/var/log/*.7.*'
);
foreach($paths as $p) safe_exec('rm '.$p);
runScript('Hourly');
runScript('filesClearOld');
sg('ThisComputer.weekDayName',getDayRus());
sg('ThisComputer.nowDate',getDateRus());Свойства класса:
Методы класса:
//$params["LOCATION_OBJECT"], $params["LOCATION"]
//$params["LOCATION_OBJECT"], $params["LOCATION"]
Объекты класса:
, Россия
На форуме: markovrv
© 2026 SJLab | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving