diff --git a/.gitignore b/.gitignore index f90b54e..d8b4f59 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ _nemazat/index.html _nemazat/css/main.css.map _nemazat/css/main.css _nemazat/css/font-awesome.min.css +logs/*.log \ No newline at end of file diff --git a/api.php b/api.php index e7158cc..024eaca 100644 --- a/api.php +++ b/api.php @@ -41,7 +41,7 @@ if (DEBUGMOD != 1) { 'errorMSG' => "Using API from your IP insnĀ“t alowed!", )); header("HTTP/1.1 401 Unauthorized"); - $logManager->write("acces denied from " . $_SERVER['REMOTE_ADDR'], LogRecordType::WARNING); + $logManager->write("[API] acces denied from " . $_SERVER['REMOTE_ADDR'], LogRecordType::WARNING); exit(); } } @@ -78,7 +78,7 @@ if (!DeviceManager::registeret($token)) { 'state' => 'unsuccess', 'errorMSG' => "Device not registeret", )); - $logManager->write("Registering Device", LogRecordType::INFO); + $logManager->write("[API] Registering Device", LogRecordType::INFO); exit(); } @@ -102,7 +102,7 @@ if ($values != null || $values != "") { SubDeviceManager::create($deviceId, $key, UNITS[$key]); } RecordManager::create($deviceId, $key, round($value['value'],2)); - $logManager->write("Device_ID " . $deviceId . " writed value " . $key . $value['value'], LogRecordType::INFO); + $logManager->write("[API] Device_ID " . $deviceId . " writed value " . $key . $value['value'], LogRecordType::INFO); } $hostname = strtolower($device['name']); @@ -131,7 +131,7 @@ if ($values != null || $values != "") { $subDeviceLastReordValue = $subDeviceLastReord['value']; if ($subDeviceLastReord['execuded'] == 0){ - $logManager->write("subDevice id ".$subDeviceId . " executed comand with value " .$subDeviceLastReordValue . " record id " . $subDeviceLastReord['record_id'] . " executed " . $subDeviceLastReord['execuded']); + $logManager->write("[API] subDevice id ".$subDeviceId . " executed comand with value " .$subDeviceLastReordValue . " record id " . $subDeviceLastReord['record_id'] . " executed " . $subDeviceLastReord['execuded']); RecordManager::setExecuted($subDeviceLastReord['record_id']); } diff --git a/class/AutomationManager.php b/class/AutomationManager.php index 7d029fb..65706bc 100644 --- a/class/AutomationManager.php +++ b/class/AutomationManager.php @@ -116,8 +116,10 @@ class AutomationManager{ foreach ($sceneDoArray as $deviceId => $deviceState) { RecordManager::create($deviceId, 'on/off', $deviceState); } + $logManager->write("[AUTOMATIONS] automation id ". $automation['automation_id'] . " was executed"); Db::edit('automation', array('executed' => 1), 'WHERE automation_id = ?', array($automation['automation_id'])); } else if ($restart) { + $logManager->write("[AUTOMATIONS] automation id ". $automation['automation_id'] . " was restarted"); Db::edit('automation', array('executed' => 0), 'WHERE automation_id = ?', array($automation['automation_id'])); } }