Свойства класса:
Методы класса:
$volume=round(65535*$params['VALUE']/100); $this->setProperty('volumeLevel',$params['VALUE']); safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume); say("Изменилась громкость до ".$params['VALUE']." процентов");
Объекты класса:
say("Отключено питание");
Свойства класса:
Методы класса:
$this->setProperty("uptime", $params["UPTIME"]); $this->setProperty("rxbytes", $params["RXBYTES"]); $this->setProperty("txbytes", $params["TXBYTES"]); $this->setProperty("router", $params["ROUTER"]); $this->setProperty("net", $params["NET"]); $this->setProperty("frequency", $params["FREQ"]); $this->setProperty("mode", $params["WIFI_MODE"]); $this->setProperty("rssi", $params["RSSI"]);
Объекты класса:
Свойства класса:
Методы класса:
$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')." выключен."); }
$this->setProperty('active',1);
Объекты класса:
setGlobal('minMsgLevel','1'); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nightmode_activate.php'); /* end injection of {SDevices} */
setGlobal('minMsgLevel','3');
/* 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} */
say('У вас есть две минуты, чтобы покинуть дом. Дом будет взят под охрану.', 2); setTimeOut("Ohrana60", "say('Осталась одна минута. Дом будет взят под охрану.', 2);", 1*60); setTimeOut("Ohrana60","callMethod('SecurityArmedMode.activate');", 2*60);
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_activate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/nobodyhomemode_deactivate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/econommode_activate.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/econommode_deactivate.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
$this->setProperty('SomebodyHere',0); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_onIdle.php'); /* end injection of {SDevices} */
$rooms=getObjectsByClass("Rooms"); $total=count($rooms); for($i=0;$i<$total;$i++) { $rooms[$i]['room']=getGlobal($rooms[$i]['TITLE'].'.Title'); if (!$rooms[$i]['room']) { $rooms[$i]['room']=$rooms[$i]['TITLE']; } $rooms[$i]['active']=getGlobal($rooms[$i]['TITLE'].'.SomebodyHere'); $rooms[$i]['time']=getGlobal($rooms[$i]['TITLE'].'.LatestActivity'); $rooms[$i]['diff']=time()-$rooms[$i]['time']; } function rooms_cmp($a, $b) { if ($a['diff'] == $b['diff']) { return 0; } return ($a['diff'] < $b['diff']) ? -1 : 1; } usort($rooms,"rooms_cmp"); if (!$rooms[0]['active']) { $somebodyHomeText="Никого нет дома. Были в ".date('H:i',$rooms[0]['time'])." (".$rooms[0]['room'].")"; } else { $res_rooms=array(); for($i=0;$i<$total;$i++) { if ($rooms[$i]['active']) { $res_rooms[]=$rooms[$i]['room']; } } $somebodyHomeText="Кто-то дома: ".implode(", ",$res_rooms); } setGlobal('somebodyHomeText',$somebodyHomeText); //echo "Updated"; /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/Rooms_updateActivityStatus.php'); /* end injection of {SDevices} */
$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} */
Объекты класса:
Свойства класса:
Методы класса:
//https://emojigraph.org/low-battery/ //http://samopal.pro/majordomo1/ // Изменяем время $this->setProperty('updated', time()); $this->callMethodSafe('setUpdatedText'); if (!empty($this->description)) $description = $this->description; elseif (empty($this->description)) $description = $this->object_title; // Считываем значения $battery = $this->getProperty('batteryLevel'); $batteryOperated = $this->getProperty('batteryOperated'); //устройство питается от батареи $batteryWarning = $this->getProperty('batteryWarning'); //предупреждение о разряде //$em_bat = json_decode('"'.'\ud83e\udeab'.'"'); //батарейка if ($batteryOperated && !empty($battery)) { //если устройство питается от батареи и значение не пустое if ($battery >= 60 ) { // $text = 'Батарея в норме: '; // say($text.'<b><i><u>'.$description.'</u> '.$battery.'%.</i></b>', 2); } elseif ($battery > 50 ) { // $text = 'Низкий заряд батареи: '; // say($text.'<b><i><u>'.$description.'</u> '.$battery.'%.</i></b>', 2); } elseif ($battery <= 40) { $text = 'Критический заряд батареи: '; say($text.'<b><i><u>'.$description.'</u> '.$battery.'%.</i></b>', 2); } // Пишем значение свойств $this->setProperty('batteryText', $text); } /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_batteryLevelUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_keepAlive.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_logicAction.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_setUpdatedText.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDevices_statusUpdated.php'); /* end injection of {SDevices} */
$tempCore = (float)$this->getProperty('tempCore'); $maxTemp = 60; if (!empty($this->description)) $description = $this->description; //если задано описание elseif (empty($this->description)) $description = $this->object_title; //если не задано $normalTempCore = (int)$this->getProperty('normalTempCore'); //$directionTimeout= 1*60*60; //таймаут час //***если температура превысила 60***// if ($tempCore>$maxTemp && $normalTempCore) { $this->setProperty('normalTempCore', 0); say('Температура CPU <i><u>'.$description.'</u></i> вышла за пределы: <b><i>'.$tempCore.'°С!</i></b>', 5); } elseif ($tempCore<$maxTemp && !$normalTempCore) { //иначе $this->setProperty('normalTempCore', 1); say('Температура CPU <i><u>'.$description.'</u></i> вернулась в норму: <i>'.$tempCore.'°С.</i>', 5); }
Свойства класса:
Методы класса:
/* 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} */
/* 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/SControllers_switch.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SControllers_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SControllers_turnOn.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_setTargetTemperature.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_setThermostatMode.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_setFanSpeedMode.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_configUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_fanSpeedUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_thermostatUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_tempUp.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SAirConditioners_tempDown.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_setLevel.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_levelUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_levelWorkUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SDimmers_turnOff.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_switch.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SGroups_turnOn.php'); /* end injection of {SDevices} */
Методы класса:
$this->setProperty("updatedText", date("d.m.y H:i:s"));
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMedias_setSource.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMedias_pause.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMedias_setChannel.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMedias_setVolume.php'); /* end injection of {SDevices} */
Методы класса:
$this->setProperty("updatedText", date("d.m.y H:i:s"));
Объекты класса:
Свойства класса:
Методы класса:
/* 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} */
$color = $this->getProperty('HEXColor'); //$this->setProperty('updated', time()); //$this->setProperty("updatedText", date("d.m.y H:i:s")); $hsv = hexToHsv($color); if ($hsv && is_array($hsv)) { $this->setProperty('hue', intval($hsv[0])); $this->setProperty('saturation', intval($hsv[1] * 100)); $this->setProperty('lightness', intval($hsv[2] * 100)); } if ($color != '000000') { $this->setProperty('colorSaved', $color); } // HEX to RGB $color=preg_replace('/^#/','',$color); $color=hexdec($color); $red=round(($color >> 16 & 0xFF)); $green=round(($color >> 8 & 0xFF)); $blue=round(($color & 0xFF)); $cmd = $red.",".$green.",".$blue; $this->setProperty('RGBColor', $cmd); /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SRGB_colorUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_turnOff.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_turnOn.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_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_switchEnable.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_tempDown.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_tempUp.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SThermostats_statusUpdated.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_setTargetTemperature.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/STVs_pause.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/STVs_setSource.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/STVs_setChannel.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/STVs_setVolume.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* 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} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SCounters_pulseDetected.php'); /* end injection of {SDevices} */
Свойства класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_switch.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_open.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_close.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_setLevel.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenable_levelUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_valueUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_alert.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSensors_unblockSensor.php'); /* end injection of {SDevices} */
$valueHPA = $this->getProperty("pressHPA"); $valueMM = round($valueHPA * 0.75006375541921); // записываем значение давления в свойства $this->setProperty("pressMM", $valueMM);
$value_mV = $this->getProperty("value_mV"); $valueBAR = round(($value_mV - 300)/205, 1); // записываем значение давления в свойства $this->setProperty("valueBAR", $valueBAR);
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SButtons_pressed.php'); /* end injection of {SDevices} */
Свойства класса:
Объекты класса:
Свойства класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_alert.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLeak_unblockSensor.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLightSensors_valueUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SLightSensors_periodMinValueUpdated.php'); /* end injection of {SDevices} */
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions_unblockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions_motionDetected.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions_blockSensor.php'); /* end injection of {SDevices} */
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions2_motionDetected.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions2_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SMotions2_unblockSensor.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenClose_unblockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenClose_blockSensor.php'); /* end injection of {SDevices} */
if (!empty($this->description)) $description = $this->description; elseif (empty($this->description)) $description = $this->object_title; $ncno = $this->getProperty('ncno'); $NobodyHomeMode = getGlobal('NobodyHomeMode.active'); //DebMes("Updated $description - ".$ncno . " new value: ".$params['NEW_VALUE'],'openclose'); $this->setProperty('updated', time()); $this->callMethod('keepAlive'); $is_blocked=(int)$this->getProperty('blocked'); if ($is_blocked) { //если датчик заблокирован //DebMes("Blocked $description",'openclose'); return; } //***если активировано Изменение означает активность в помещении***// if ($this->getProperty('isActivity')) { $linked_room = $this->getProperty('linkedRoom'); //привязанная комната if (getGlobal('NobodyHomeMode.active')) { //если активирован режим никого нет дома callMethodSafe('NobodyHomeMode.deactivate', array('sensor' => $description, 'room' => $linked_room)); } $nobodyhome_timeout = 1 * 60 * 60; if (defined('SETTINGS_BEHAVIOR_NOBODYHOME_TIMEOUT')) { $nobodyhome_timeout = SETTINGS_BEHAVIOR_NOBODYHOME_TIMEOUT * 60; } if ($nobodyhome_timeout) { //если прошло время $nobodyhome_timeout setTimeOut('nobodyHome', "callMethodSafe('NobodyHomeMode.activate');", $nobodyhome_timeout); } if ($linked_room) { callMethodSafe($linked_room . '.onActivity', array('sensor' => $description)); } } //***если активировано Уведомлять при смене статуса***// if (($this->getProperty('notify_status')) && $NobodyHomeMode) { if (isset($params['NEW_VALUE'])) { if (($params['NEW_VALUE'] && $ncno == 'no') || (!$params['NEW_VALUE'] && $ncno == 'nc')) { $notify_msg_opening = $this->getProperty('notify_msg_opening'); //Сообщение при открытии if (!empty($notify_msg_opening)) $msg = $notify_msg_opening; //если задано сообщение при открытии else $msg = '<i><u>'.$description.'</u></i> открыта!'; //если не задано saySafe($msg, 2); } else { $notify_msg_closing = $this->getProperty('notify_msg_closing'); //Сообщение при закрытии if (empty($notify_msg_closing)) $msg = $description.' закрыта.'; //если не задано if (!empty($notify_msg_closing)) $msg = $notify_msg_closing; //если задано сообщение при открытии else $msg = '<i><u>'.$description.'</u></i> закрыта.'; //если не задано saySafe($msg, 2); } } } //***если активировано Напоминать об открытом состоянии***// if ($this->getProperty('notify_nc')) { if (isset($params['NEW_VALUE'])) { if (($params['NEW_VALUE'] && $ncno == 'no') || (!$params['NEW_VALUE'] && $ncno == 'nc')) { $notify_msg_reminder = $this->getProperty('notify_msg_reminder'); //Сообщение при напоминании if (!empty($notify_msg_reminder)) $msg = $notify_msg_reminder; //если задано сообщение при открытии else $msg = 'Напоминаю, что <i><u>'.$description.'</u></i> открыта'; //если не задано setTimeout($description.'_notify_timer_1', "saySafe('".$msg.' одну минуту!'."', 5);", 1 * 60); setTimeout($description.'_notify_timer_2', "saySafe('".$msg.' десять минут!'."', 5);", 10 * 60); setTimeout($description.'_notify_timer_3', "saySafe('".$msg.' тридцать минут!'."', 5);", 30 * 60); setTimeout($description.'_notify_timer_4', "saySafe('".$msg.' час!'."', 5);", 60 * 60); setTimeout($description.'_notify_timer_5', "saySafe('".$msg.' два часа!'."', 5);", 2 * 60 * 60); } else { clearTimeOut($description . '_notify_timer_1'); clearTimeOut($description . '_notify_timer_2'); clearTimeOut($description . '_notify_timer_3'); clearTimeOut($description . '_notify_timer_4'); clearTimeOut($description . '_notify_timer_5'); } } } //DebMes("LogicAction $description",'openclose'); $this->callMethodSafe('logicAction'); //DebMes("LinkedDevices $description",'openclose'); return; //выходим //файл SOpenClose_statusUpdated.php не запускаем, он исправлен выше /* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SOpenClose_statusUpdated.php'); /* end injection of {SDevices} */
if (!empty($this->description)) $description = $this->description; elseif (empty($this->description)) $description = $this->object_title; $NobodyHomeMode = getGlobal('NobodyHomeMode.active'); $status = $this->getProperty('status'); //***если никого нет дома***// if ($NobodyHomeMode) { if (!$status) { $objects = getObjectsByClass("SCameras"); //отправка в телеграмм фото с камер $photos = array(); foreach($objects as $obj) { // $deskr = getObject($obj['TITLE'])->description; $url = gg($obj['TITLE'] . ".snapshotURL"); $img = "./cms/cached".$obj['TITLE'].".jpg"; try { $data = file_get_contents($url); $i = strlen($data); $handle = fopen($img, "w"); fwrite($handle, $data); fclose($handle); if ($i > 0) $photos[] = $img; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } } $text = 'Камеры'; rs('sendTelegram', array('album'=>$photos, 'description'=>$text)); } }
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SPowerSensors_valueUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SPowerSensors_loadStatusChanged.php'); /* end injection of {SDevices} */
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_statusUpdated.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_alert.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_blockSensor.php'); /* end injection of {SDevices} */
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/SSmoke_unblockSensor.php'); /* end injection of {SDevices} */
Объекты класса:
Свойства класса:
Методы класса:
/* begin injection of {SDevices} */ require(DIR_MODULES.'devices/STempHumSensors_valueUpdated.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'); 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'); }
Свойства класса:
Методы класса:
Объекты класса:
####################################################################### # Проверка времени выполнения кода # # для проверки раскоментируйте строки в начале и в конце # ####################################################################### //debmes('Запускаю onNewMinute'); //Timer::start(); ####################################################################### # Заполняем свойство ThisComputer.timeNow текущим временем # ####################################################################### sg('timeNow',date('H:i')); ####################################################################### # В переменную $h ставим текущий час, в $m - минуту # # разнесем отдельно часы от минут и заполним ThisComputer.timeH и M # ####################################################################### $h=(int)date('G',time()); //Получаем переменную час $m=date('i',time()); //Получаем переменную минута sg("ThisComputer.timeH", $h); //Заполним свойство часы отдельно sg("ThisComputer.timeM", $m); //Заполним свойство минуты отдельно //Выделим и заполним десятки и единицы часов и минут sg("ThisComputer.timeH1",$H[0]); sg("ThisComputer.timeH2",$H[1]); sg("ThisComputer.timeM1",$M[0]); sg("ThisComputer.timeM2",$M[1]); ####################################################################### # Заготовка под какое-либо действие с выходным днем # ####################################################################### # if (isWeekDay()) {// Если рабочий день # } # # Или например если в рабочие дни, время 17:00, и включен эко режим # if (isWeekDay() && timeIs("17:00") && (gg("EconomMode.active")=="1")) { # say("Скоро пользователи с работы прийдут, отключаю эко режим"); # callMethod('EconomMode.deactivate'); #} ####################################################################### ####################################################################### # Если время ровно 00 и после 7 утра, и дома кто-то есть, глобальная # # настройка clockChimeEnabled разрешена, тогда проговариваем время # ####################################################################### //if ($m=="00") { // Если время =00минут // if (($h>=8) && gg('clockChimeEnabled')) { // Если больше или равно 8 часам и говорить время можно // if (gg('NobodyHomeMode.active') == '0'){ // Если режим никого нет дома выключен // say(timeNow(),1); //Сказать время с параметром важности сообщения =1(днем говорит, ночью - только в лог) // rs('NoScript'); //Заготовка запуска скрипта NoScript // } // } //} ####################################################################### # Заполняем свойство ThisComputer.HomeStatus # # текущим временем и текстом Дома никого или Дома кто-то есть # # также показания системных статусов безопасность, система, интернет # # (эта надпись показывается на главной страничке в меню) # ####################################################################### $homeStatus=date('H:i');// Присваиваем переменной $homeStatus текущее время if (gg('NobodyHomeMode.active')) {//Если активен режим NobodyHomeMode $homeStatus.=' Дома никого';//Добавляем к переменной Дома никого // rs('NoScript');//Заготовка запуска скрипта NoScript } else { $homeStatus.=' Дома кто-то есть';//Иначе добавляем Дома кто-то есть // rs('NoScript');//Заготовка запуска скрипта NoScript } $homeStatus.=' '.gg('Security.stateDetails');//свойство статуса безопасности $homeStatus.=' '.gg('System.stateDetails');//свойство статуса системы $homeStatus.=' '.gg('Communication.stateDetails');//свойство статуса сети sg('HomeStatus',$homeStatus);//Сцепляем свойство с переменной и заполняем в ThisComputer.HomeStatus ####################################################################### # Включаем и выключаем режим темного времени суток DarknessMode # # в зависимости от времени суток и данных восхода/заката # ####################################################################### $darkness = getGlobal('DarknessMode.active'); $sunrise = getGlobal('SunRiseTime'); $sunset = getGlobal('SunSetTime'); if ($darkness == 1 && timeBetween($sunrise, $sunset)) { //Проверим Если время между рассветом и закатом и свойство темно равно 1 sg("isDark",0); //Изменим свойство на светло cm('DarknessMode.deactivate'); //Запустим метод деактивации режима Темное время суток // rs('NoScript'); //Заготовка запуска скрипта NoScript } elseif ($darkness == 0 && timeBetween($sunset, $sunrise)) { //Иначе Проверим время между рассветом и закатом и свойство темно не равно 1 sg("isDark",1); //Изменим свойство на темно cm('DarknessMode.activate'); //Запустим метод активации режима Темное время суток // rs('NoScript');//Заготовка запуска скрипта NoScript } if (timeIs($sunrise)) { //Если время совпало со свойством рассвет // say('Всходит солнце'); //Произнести фразу Всходит солнце } if (timeIs($sunset)) { //Если время совпало со свойством закат // say('Солнце заходит',2); //Произнести фразу Солнце заходит с параметром важности сообщения =2(днем и ночью произносит) } if (timeIs(gg('NightModeStart'))) { //а если сервер отключался на продолжительное время, то этому режиму не доверяем? callMethod('NightMode.activate'); } elseif (timeIs(gg('NightModeEnd'))) { callMethod('NightMode.deactivate'); } ####################################################################### # NEW учтем сезон # ####################################################################### /*$month_num = (int)date('m'); if($month_num > 4 && $month_num < 9) { $season = -1; $sunrise = $civil_twilight_begin; // для лета утренние сумерки } else { $season = 1; } $lightTimeStart = $sunrise + $season*10*60; $lightTimeEnd = $sunset - $season*10*60; debmes('начало света: '.date("H:i", $lightTimeStart)); debmes('конец света: '.date("H:i", $lightTimeEnd)); AddScheduledJob("job_civil_twilight_end", "say('Сумерки!', 2);", $civil_twilight_end); AddScheduledJob("job_sunset", "say('Закат!', 2);", $sunset);*/ ####################################################################### ####################################################################### # Активация режима экономии EconomMode # ####################################################################### if (timeIs("23:30") && (gg("EconomMode.active")!="1") && (gg("NobodyHomeMode.active")=="1")) { //Если никого нет дома, экономный режим выключен и время 23:30 say("Похоже никого нет сегодня, можно сэкономить немного."); //Произнести Похоже никого нет сегодня, можно сэкономить немного. cm('EconomMode.activate'); //Запустить метод активации эконом режима // rs('NoScript');//Заготовка запуска скрипта NoScript } ####################################################################### # Активация деактивация ночного режима NightMode # ####################################################################### $NightModeStart = getGlobal('ThisComputer.NightModeStart'); $NightModeEnd = getGlobal('ThisComputer.NightModeEnd'); if ($NightModeStart == 1) { //Если время 22:22 cm('NightMode.activate'); //Запустить метод активации ночного режима // rs('NoScript');//Заготовка запуска скрипта NoScript } elseif ($NightModeEnd == 1) { //Иначе если время 07:00 cm('NightMode.deactivate'); //Запустить метод деактивации режима // rs('NoScript');//Заготовка запуска скрипта NoScript } if ($m%2 == 0) { //Каждые 2 минуты rs('CPU_temp');// } //if ($m=="01") { // cm('Boiler.enable'); // разблокировать работу котла // разблокировать работу котла //} //if ($h=="07" && gg('Boiler.disabled', 0)) { // Если время 07:00 и работа котла разблокирована //if ($m=="54") { // cm('Boiler.disable'); // заблокировать работу котла //} //if ($m%2 == 0) { //Каждые 2 минуты // rs('CheckOnline');//Заготовка запуска скрипта NoScript //} //if ($m%5 == 0) { //Каждые 5 минут // rs('NoScript');//Заготовка запуска скрипта NoScript //} ####################################################################### # Проверка времени выполнения кода # ####################################################################### //debmes ("Время выполнения onNewMinute: ".Timer::finish()." сек.\n\r"); /* if (gg('ThisComputer.AlarmStatus') && timeIs(gg('ThisComputer.AlarmTime'))) { runScript('MorningAlarm'); } */
$days=array('воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'); $months=array(1=>'январь','февраль','март','апрель','май','июнь','июль','август','сентябрь','октябрь','ноябрь','декабрь'); $months2=array(1=>'января','февраля','марта','апреля','мая','июня','июля','августа','сентября','октября','ноября','декабря'); $daymonth=array(1=>'первое','второе','третье','четвертое','пятое','шестое','седьмое','восьмое','девятое','десятое','одинадцатое','двенадцатое','тринадцатое','четырнадцатое','пятнадцатое','шестнадцатое','семнадцатое','восемнадцатое','девятнадцатое','двадцатое','двадцать первое','двадцать второе','двадцать третье','двадцать четвертое','двадцать пятое','двадцать шестое','двадцать седьмое','двадцать восьмое','двадцать девятое','тридцатое','тридцать первое'); $day_num=(int)date('w'); $month_num=(int)date('m'); $day_month=(int)date('j'); $day_of_month=$daymonth[$day_month]; $day_of_week=$days[$day_num]; $month_txt1=$months[$month_num]; $month_txt2=$months2[$month_num]; setGlobal('MonthNum',$month_num); setGlobal('MonthTXT',$month_txt1); setGlobal('MonthTXTalt',$month_txt2); setGlobal('DayOfMonthNum',$day_month); setGlobal('DayOfMonthTXT',$day_of_month); setGlobal('DayOfWeekTXT',$day_of_week); setGlobal('DayOfWeekNum',$day_num); // ================= раскидываем дату и время если изменилось в Windows ========================================= $h=(int)date('G',time()); if (gg('Time.DateD') != date("d", time())) { $day = array( 'воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота' ); $month = array( 1 => 'января', 2 => 'февраля', 3 => 'марта', 4 => 'апреля', 5 => 'мая', 6 => 'июня', 7 => 'июля', 8 => 'августа', 9 => 'сентября', 10 => 'октября', 11 => 'ноября', 12 => 'декабря' ); $monthAlt = array( 1 => 'ЯНВАРЬ', 2 => 'ФЕВРАЛЬ', 3 => 'МАРТ', 4 => 'АПРЕЛЬ', 5 => 'МАЙ', 6 => 'ИЮНЬ', 7 => 'ИЮЛЬ', 8 => 'АВГУСТ', 9 => 'СЕНТЯБРЬ', 10 => 'ОКТЯБРЬ', 11 => 'НОЯБРЬ', 12 => 'ДЕКАБРЬ' ); // раскидываем дату по свойствам sg("DateD",date( "d", time())); sg("DateM",date( "m", time())); sg("DateY",date( "Y", time())); sg("Date",date( "d.m.Y", time())); sg("Day",$day[date("w")]); sg("Month",$month[date("n")]); sg("MonthAlt",$monthAlt[date("n")]); } ####################################################################### # Запуск обслуживания системы # ####################################################################### if ($h=="02") { // резервное копирование мажордомо в 3 ночи rs("backup"); //Запустить backup } if ($h=="03") { //Если время 03:33 rs("systemMaintenance"); //Запустить скрипт оптимизации } // БОЙЛЕР, включение по ночному тарифу //if ($h=="23" && gg('Boiler.disabled', 1)) { // Если время 23:00 и работа котла заблокирована if ($h=="23") { cm('Boiler.enable'); // разблокировать работу котла // разблокировать работу котла // cm('Boiler.enable'); // разблокировать работу котла // разблокировать работу котла } //if ($h=="07" && gg('Boiler.disabled', 0)) { // Если время 07:00 и работа котла разблокирована if ($h=="07") { cm('Boiler.disable'); // заблокировать работу котла // cm('Boiler.disable'); // заблокировать работу котла }
Свойства класса:
Методы класса:
//$params["LOCATION_OBJECT"], $params["LOCATION"]
//$params["LOCATION_OBJECT"], $params["LOCATION"]
Объекты класса:
Санкт-Петербург, Россия
© 2023 - Site Built By SergeJey | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving