Page modem Miotiq: script check PDP user-friendly avec logs raw en collapse

- Nouveau script SARA/sara_check_pdp.py: vérifie si PDP est déjà actif avant d'agir
- Si PDP actif: affiche OK + IP sans toucher à la config
- Si PDP inactif: active automatiquement + affiche résultat
- Logs AT bruts accessibles via bouton collapse
- Endpoint launcher.php sara_check_pdp

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
PaulVua
2026-04-27 15:59:43 +02:00
parent b8b70a5a54
commit f6e305e7e3
3 changed files with 188 additions and 7 deletions

View File

@@ -395,6 +395,12 @@ if ($type == "sara_test_udp") {
echo $output;
}
if ($type == "sara_check_pdp") {
$command = 'sudo /usr/bin/python3 -u /var/www/nebuleair_pro_4g/SARA/sara_check_pdp.py';
$output = shell_exec($command);
echo $output;
}
if ($type == "git_pull") {
$command = 'sudo git pull';

View File

@@ -309,9 +309,9 @@
<div class="col-sm-4">
<div class="card">
<div class="card-body">
<p class="card-text"><strong>1. Setup PSD connection</strong></p>
<p class="text-muted small mb-2">Active la connexion PDP nécessaire pour les sockets UDP.</p>
<button class="btn btn-primary" onclick="PSD_setup_miotiq()">Start</button>
<p class="card-text"><strong>1. Vérifier connexion PDP</strong></p>
<p class="text-muted small mb-2">Vérifie si la connexion PDP est active. Si non, tente de l'activer automatiquement.</p>
<button class="btn btn-primary" onclick="PSD_setup_miotiq()">Vérifier</button>
<div id="loading_PSD_miotiq" class="spinner-border spinner-border-sm" style="display: none;" role="status"></div>
<div id="response_psd_setup_miotiq"></div>
</div>
@@ -1676,22 +1676,27 @@ function update_modem_configMode(param, checked){
function PSD_setup_miotiq() {
console.log("Setup PSD connection (Miotiq):");
console.log("Check PDP connection (Miotiq):");
$("#loading_PSD_miotiq").show();
$("#response_psd_setup_miotiq").empty();
$.ajax({
url: 'launcher.php?type=sara_psd_setup',
url: 'launcher.php?type=sara_check_pdp',
dataType: 'text',
method: 'GET',
timeout: 30000,
success: function(response) {
console.log(response);
$("#loading_PSD_miotiq").hide();
const formattedResponse = response.replace(/\n/g, "<br>");
$("#response_psd_setup_miotiq").html(formattedResponse);
$("#response_psd_setup_miotiq").html(response);
},
error: function(xhr, status, error) {
console.error('AJAX request failed:', status, error);
$("#loading_PSD_miotiq").hide();
$("#response_psd_setup_miotiq").html(`
<div class="alert alert-danger py-2 mt-2">
<strong>Erreur de communication</strong><br>
<small>${error}</small>
</div>`);
}
});
}