Frigate Beta plugin version 1.4.7. Serveur Firgate en 0.16.3. Systeme JEedom Core 4.5.2 et DEbian 13.
Bonjour, j’ai cette erreur en bandeau rouge je pense depuis mon passage en debian 13 : « array_slice(): Argument #1 ($array) must be of type array, null given » sur la page events et panel en Debian 13, dans plugins/frigate/desktop/php/events.php et plugins/frigate/desktop/php/panel.php
Ligne 101
if (!$full) { $strings = array_slice($strings, 0, 1); } return $strings ? 'il y a ' . implode(', ', $strings) : 'à l\'instant'; }
Remplacé par
if (!$full) {
$strings = array_slice($strings ?? [], 0, 1);
}
return ($strings && is_array($strings)) ? 'il y a ' . implode(', ', $strings) : 'à l\'instant';
}
CA enleve le bandeau rouge mais c’est surement lié à un problème autre que je dois avoir, vu que je ne recois plus les vignettes, elles sont vides et crées l’erreur.
du coup dans frigate.class.php sur la fonction processImage
private static function processImage($dir, $event, $isThumbnail = false, $force = false)
{
log::add(__CLASS__, 'debug', "║════════════════════════ :fg-success:Process Image:/fg: ═══════════════════");
$id = (string)$event['id']; // Force le type string pour l'ID
$camera = (string)$event['camera'];
$type = $isThumbnail ? 'thumbnail' : 'snapshot';
$basePath = $dir . '/' . $id . "_{$type}";
$jpgPath = $basePath . '.jpg';
$webpPath = $basePath . '.webp';
// --- PRIORITÉ AU WEBP ---
if (file_exists($webpPath) && !$force) {
if (file_exists($jpgPath)) {
@unlink($jpgPath);
log::add(__CLASS__, 'debug', "║ Suppression du fichier JPG (doublon) pour $type ID: $id");
}
log::add(__CLASS__, 'debug', "║ Fichier WEBP déjà existant pour $type ID: $id");
return ['url' => "/plugins/frigate/data/$camera/{$id}_{$type}.webp", 'has' => 1];
}
// --- Vérifie si un fichier (jpg ou webp) existe sinon téléchargement ---
if (!file_exists($jpgPath) && !file_exists($webpPath) || $force) {
log::add(__CLASS__, 'debug', "║ Aucun fichier local trouvé pour $type ID: $id");
// Pour les snapshots seulement, on vérifie has_snapshot avant de télécharger
if (!$isThumbnail) {
// Comparaison souple pour Frigate 0.16 (peut être booléen ou string "true")
$hasSnapshot = $event['has_snapshot'] ?? false;
if ($hasSnapshot !== true && $hasSnapshot !== "true") {
log::add(__CLASS__, 'debug', "║ Has Snapshot: false → téléchargement annulé pour ID: $id");
return ['url' => 'null', 'has' => 0];
}
}
log::add(__CLASS__, 'debug', "║ Téléchargement du fichier $type pour ID: $id");
// Appel de saveURL pour récupérer le fichier sur le serveur Frigate
$img = self::saveURL($id, $isThumbnail ? null : "snapshot", $camera, $isThumbnail);
$resUrl = ($img == "error" || empty($img)) ? "null" : (string)$img;
return ['url' => $resUrl, 'has' => ($resUrl !== "null" ? 1 : 0)];
}
// --- Fichier déjà présent : Sécurisation de l'extension ---
$ext = file_exists($webpPath) ? 'webp' : 'jpg';
log::add(__CLASS__, 'debug', "║ Fichier $ext trouvé localement pour $type ID: $id");
// Construction explicite de l'URL pour éviter les coupures PHP 8.3
$finalUrl = "/plugins/frigate/data/" . $camera . "/" . $id . "_" . $type . "." . $ext;
return ['url' => $finalUrl, 'has' => 1];
}
j’ai de nouveau mes vignettes avec ces modifications. Je ne sais pas si c’est la bonne manière de faire je ne suis pas développeur.
