Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/ajax/frigate.ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@
ajax::success();
}

if (init('action') == 'frigateDebug') {
$data = frigate::showEvents(false, true);

ajax::success(array(
"object" => $data,
"json" => json_encode($data),
));
}

throw new Exception(__('Aucune méthode correspondante à', __FILE__) . ' : ' . init('action'));
/* * *********Catch exeption*************** */
Expand Down
68 changes: 40 additions & 28 deletions core/class/frigate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ public function postInsert() {}
public function preUpdate() {}

// Fonction exécutée automatiquement après la mise à jour de l'équipement
public function postUpdate() {}
public function postUpdate() {
}

// Fonction exécutée automatiquement avant la sauvegarde (création ou mise à jour) de l'équipement
public function preSave()
Expand Down Expand Up @@ -1677,44 +1678,55 @@ public static function deleteEvent($id, $all = false)
log::add(__CLASS__, 'debug', "╚════════════════════════════════════════════════════════");
return "OK";
}
public static function showEvents()
public static function showEvents(bool $_onlyEnable = FALSE, bool $_allType = FALSE)
{
$result = [];
$events = frigate_events::all();

$events = frigate_events::all($_onlyEnable, $_allType);

foreach ($events as $event) {
$date = date("d-m-Y H:i:s", $event->getStartTime());
$duree = round($event->getEndTime() - $event->getStartTime(), 0);
$box = $event->getBox();
$boxArray = is_array($box) ? $box : json_decode($box, true);

$result[] = array(
"id" => $event->getId(),
"img" => $event->getLasted(),
"camera" => $event->getCamera(),
"label" => $event->getLabel(),
"box" => $boxArray,
"date" => $date,
"duree" => $duree,
"startTime" => $event->getStartTime(),
"endTime" => $event->getEndTime(),
"snapshot" => $event->getSnapshot(),
"clip" => $event->getClip(),
"thumbnail" => $event->getThumbnail(),
"hasSnapshot" => $event->getHasSnapshot(),
"hasClip" => $event->getHasClip(),
"eventId" => $event->getEventId(),
"score" => $event->getScore(),
"top_score" => $event->getTopScore(),
"type" => $event->getType(),
"isFavorite" => $event->getIsFavorite() ?? 0,
"zones" => $event->getZones() ?? '',
"description" => $event->getRecognition_description()
"id" => $event->getId(),
"eventId" => $event->getEventId(),
"img" => $event->getLasted(),
"camera" => $event->getCamera(),
"label" => $event->getLabel(),
"subLabel" => $event->getSubLabel(),
"box" => json_decode($event->getBox(), true),
"date" => $date,
"duree" => $duree,
"startTime" => $event->getStartTime(),
"endTime" => $event->getEndTime(),
"falsePositive" => $event->getFalsePositive(),
"snapshot" => $event->getSnapshot(),
"clip" => $event->getClip(),
"thumbnail" => $event->getThumbnail(),
"hasSnapshot" => $event->getHasSnapshot(),
"hasClip" => $event->getHasClip(),
"score" => $event->getScore(),
"top_score" => $event->getTopScore(),
"plusId" => $event->getPlusId(),
"retain" => $event->getRetain(),
"type" => $event->getType(),
"isFavorite" => $event->getIsFavorite() ?? 0,
"zones" => $event->getZones() ?? '',
"data" => $event->getData(),
"recognition_type" => $event->getRecognition_type(),
"description" => $event->getRecognition_description(),
"recognition_name" => $event->getRecognition_name(),
"recognition_subname" => $event->getRecognition_subname(),
"recognition_attributes" => $event->getRecognition_attributes(),
"recognition_plate" => $event->getRecognition_plate(),
"recognition_score" => $event->getRecognition_score()
);
}

usort($result, [self::class, 'orderByDate']);

if (!empty($result)) {
usort($result, 'frigate::orderByDate');
}

return $result;
}
Expand Down
20 changes: 16 additions & 4 deletions core/class/frigate_events.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,26 @@ class frigate_events
/**
* @throws Exception
*/
public static function all(bool $_onlyEnable = FALSE)
public static function all(bool $_onlyEnable = FALSE, bool $_allType = FALSE)
{
$sql = 'SELECT ' . DB::buildField(__CLASS__) . '
FROM frigate_events
WHERE type IS NOT NULL';
$sql = 'SELECT ' . DB::buildField(__CLASS__) . ' FROM frigate_events';
$where = [];

if (!$_allType) {
$where[] = 'type IS NOT NULL';
}
if ($_onlyEnable) {
$where[] = 'enabled = 1';
}
if (!empty($where)) {
$sql .= ' WHERE ' . implode(' AND ', $where);
}

return DB::Prepare($sql, array(), DB::FETCH_TYPE_ALL, PDO::FETCH_CLASS, __CLASS__);
}



/**
* @throws Exception
*/
Expand Down
25 changes: 25 additions & 0 deletions desktop/js/frigate.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,31 @@ document.getElementById('addCmdHttp').addEventListener('click', function () {
})
});

document.getElementById('frigateDebug').addEventListener('click', function () {
domUtils.ajax({
type: "POST",
url: "plugins/frigate/core/ajax/frigate.ajax.php",
data: {
action: "frigateDebug",
data: { function: "getAllEvents" }
},
dataType: 'json',
error: function (error) {
jeedomUtils.showAlert({
message: error.message,
level: 'danger'
});
},
success: function (data) {
var json = data.result.json;
const blob = new Blob([json], {
type: "text/plain;charset=utf-8"
});
saveAs(blob, "getAllEvents.json.txt");
}
})
});

function editHTTP(cmd) {
var id = cmd.id; // Récupère l'id
var data = cmd.getAttribute('data-request'); // Récupère la valeur de data-request
Expand Down
5 changes: 5 additions & 0 deletions desktop/php/frigate.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
<br>
<span>{{Logs Frigate}}</span>
</div>
<div class="cursor eqLogicAction" id="frigateDebug" title="{{Télécharger le JSON de tous les événements}}.">
<i class="fas fa-file"></i>
<br>
<span>{{Json}}</span>
</div>
</div>

<?php
Expand Down
5 changes: 4 additions & 1 deletion docs/fr_FR/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
>
>S'il n'y a pas d'information sur la mise à jour, c'est que celle-ci concerne uniquement de la mise à jour de documentation, de traduction ou de texte.

# 19/04/2026 Beta 1.5.4
# 06/05/2026 Beta & Stable 1.5.4
- nouveau bouton pour télécharger la liste des évènements (utile pour le debug dev)

# 19/04/2026 Beta 1.5.3
- Correction du put curl pour l'activation et la désactivation des caméras via API

# 13/04/2026 Beta 1.5.2
Expand Down
2 changes: 1 addition & 1 deletion plugin_info/info.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "frigate",
"name": "Frigate",
"pluginVersion": "1.5.25",
"pluginVersion": "1.5.4",
"installation": "Il est nécessaire d'avoir le plugin mqtt-manager installé avec un broker MQTT sécurisé (user / mdp) pour profiter de toutes les fonctionnalités. Dans le cas contraire, le plugin Frigate sera limité. Voir la documentation pour plus d'informations.",
"description": {
"fr_FR": "Plugin Frigate pour Jeedom. Ne fonctionne qu'avec les versions de Frigate > 0.13.0. Le plugin n'installe pas le serveur Frigate mais permet de le controler.",
Expand Down