This commit is contained in:
PaulVua
2025-02-10 10:06:16 +01:00
parent 7cac769795
commit 1cb1b05b51
10 changed files with 200 additions and 77 deletions

View File

@@ -53,10 +53,21 @@
<main class="col-md-9 ms-sm-auto col-lg-10 offset-md-3 offset-lg-2 px-md-4">
<h1 class="mt-4">Votre capteur</h1>
<p>Bienvenue sur votre interface de configuration de votre capteur.</p>
<div class="row mb-3">
<!-- Card 1 Linux Stats -->
<div class="col-sm-4">
<!-- Card NPM values -->
<div class="col-sm-4 mt-2">
<div class="card">
<div class="card-body">
<h5 class="card-title">Mesures PM</h5>
<canvas id="sensorPMChart" style="width: 100%; max-width: 600px; height: 200px;"></canvas>
</div>
</div>
</div>
<!-- Card Linux Stats -->
<div class="col-sm-4 mt-2">
<div class="card">
<div class="card-body">
<h5 class="card-title">Linux stats</h5>
@@ -69,19 +80,24 @@
</div>
</div>
<!-- Card 2 NPM values -->
<div class="col-sm-4">
</div>
<div class="row mb-3">
<!-- Card BME values -->
<div class="col-sm-4 mt-2">
<div class="card">
<div class="card-body">
<h5 class="card-title">Mesures PM</h5>
<canvas id="sensorPMChart" style="width: 100%; max-width: 600px; height: 200px;"></canvas>
<h5 class="card-title">Mesures Temperature</h5>
<canvas id="sensorBME_temp" style="width: 100%; max-width: 600px; height: 200px;"></canvas>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
@@ -292,7 +308,7 @@ window.onload = function() {
}
});
let chart; // Store the Chart.js instance globally
let chart; // Store the Chart.js instance globally
function updatePMChart(data) {
const labels = data.map(d => d.timestamp);

View File

@@ -45,7 +45,7 @@ if ($type == "update_config") {
}
if ($type == "getModem_busy") {
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/check_running.py';
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/check_running.py';
$output = shell_exec($command);
echo $output;
}
@@ -56,7 +56,7 @@ if ($type == "RTC_time") {
}
if ($type == "sys_RTC_module_time") {
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/RTC/read.py';
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/RTC/read.py';
$output = shell_exec($command);
echo $output;
}
@@ -68,7 +68,7 @@ if ($type == "git_pull") {
}
if ($type == "set_RTC_withNTP") {
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/RTC/set_with_NTP.py';
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/RTC/set_with_NTP.py';
$output = shell_exec($command);
echo $output;
}
@@ -84,7 +84,7 @@ if ($type == "set_RTC_withBrowser") {
$rtc_time = date('Y-m-d H:i:s', strtotime($time));
// Execute Python script to update the RTC
$command = escapeshellcmd("/usr/bin/python3 /var/www/nebuleair_pro_4g/RTC/set_with_browserTime.py '$rtc_time'");
$command = escapeshellcmd("sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/RTC/set_with_browserTime.py '$rtc_time'");
$output = shell_exec($command);
if ($output === null) {
echo json_encode(['success' => false, 'message' => 'Failed to update RTC']);
@@ -177,7 +177,7 @@ if ($type == "reboot") {
if ($type == "npm") {
$port=$_GET['port'];
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/get_data.py ' . $port;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/get_data.py ' . $port;
$output = shell_exec($command);
echo $output;
}
@@ -185,7 +185,7 @@ if ($type == "npm") {
if ($type == "envea") {
$port=$_GET['port'];
$name=$_GET['name'];
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/envea/read_value.py ' . $port;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/envea/read_value.py ' . $port;
$output = shell_exec($command);
echo $output;
}
@@ -197,7 +197,7 @@ if ($type == "noise") {
}
if ($type == "BME280") {
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/BME280/read.py';
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/BME280/read.py';
$output = shell_exec($command);
echo $output;
}
@@ -208,7 +208,7 @@ if ($type == "sara") {
$sara_command=$_GET['command'];
$sara_command = escapeshellcmd($sara_command);
$timeout=$_GET['timeout'];
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara.py ' . $port . ' ' . $sara_command . ' ' . $timeout;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara.py ' . $port . ' ' . $sara_command . ' ' . $timeout;
$output = shell_exec($command);
echo $output;
}
@@ -227,7 +227,7 @@ if ($type == "sara_getMQTT_login_logout") {
$port=$_GET['port'];
$timeout=$_GET['timeout'];
$login_logout=$_GET['login_logout'];
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/MQTT/login_logout.py ' . $port . ' ' . $login_logout . ' ' . $timeout;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/MQTT/login_logout.py ' . $port . ' ' . $login_logout . ' ' . $timeout;
$output = shell_exec($command);
echo $output;
}
@@ -237,7 +237,7 @@ if ($type == "sara_MQTT_publish") {
$port=$_GET['port'];
$timeout=$_GET['timeout'];
$message=$_GET['message'];
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/MQTT/publish.py ' . $port . ' ' . $message . ' ' . $timeout;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/MQTT/publish.py ' . $port . ' ' . $message . ' ' . $timeout;
$output = shell_exec($command);
echo $output;
}
@@ -247,7 +247,7 @@ if ($type == "sara_connectNetwork") {
$port=$_GET['port'];
$timeout=$_GET['timeout'];
$networkID=$_GET['networkID'];
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_connectNetwork.py ' . $port . ' ' . $networkID . ' ' . $timeout;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_connectNetwork.py ' . $port . ' ' . $networkID . ' ' . $timeout;
$output = shell_exec($command);
echo $output;
#save to config.json
@@ -283,7 +283,7 @@ if ($type == "sara_setURL") {
$port=$_GET['port'];
$url=$_GET['url'];
$profile_id = 2;
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setURL.py ' . $port . ' ' . $url . ' ' . $profile_id;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setURL.py ' . $port . ' ' . $url . ' ' . $profile_id;
$output = shell_exec($command);
echo $output;
}
@@ -293,7 +293,7 @@ if ($type == "sara_APN") {
$port=$_GET['port'];
$timeout=$_GET['timeout'];
$APN_address=$_GET['APN_address'];
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setAPN.py ' . $port . ' ' . $APN_address . ' ' . $timeout;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setAPN.py ' . $port . ' ' . $APN_address . ' ' . $timeout;
$output = shell_exec($command);
echo $output;
}
@@ -306,15 +306,15 @@ if ($type == "sara_writeMessage") {
$type2=$_GET['type2'];
if ($type2 === "write") {
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_writeMessage.py ' . $port . ' ' . $message;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_writeMessage.py ' . $port . ' ' . $message;
$output = shell_exec($command);
}
if ($type2 === "read") {
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_readMessage.py ' . $port . ' ' . $message;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_readMessage.py ' . $port . ' ' . $message;
$output = shell_exec($command);
}
if ($type2 === "erase") {
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_eraseMessage.py ' . $port . ' ' . $message;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_eraseMessage.py ' . $port . ' ' . $message;
$output = shell_exec($command);
}
@@ -327,7 +327,7 @@ if ($type == "sara_sendMessage") {
$endpoint=$_GET['endpoint'];
$endpoint = escapeshellcmd($endpoint);
$profile_id = 2;
$command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_sendMessage.py ' . $port . ' ' . $endpoint. ' ' . $profile_id;
$command = 'sudo /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_sendMessage.py ' . $port . ' ' . $endpoint. ' ' . $profile_id;
$output = shell_exec($command);
echo $output;
}