From e402093f4bc598caf092900ec513204d9024774c Mon Sep 17 00:00:00 2001 From: sagitaz Date: Sat, 18 Apr 2026 08:21:07 +0200 Subject: [PATCH 1/7] =?UTF-8?q?Ajout=20de=20type=20g=C3=A9n=C3=A9rique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/class/frigate.class.php | 18 +++++++++--------- plugin_info/info.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/class/frigate.class.php b/core/class/frigate.class.php index 58b76c30..054b57b0 100644 --- a/core/class/frigate.class.php +++ b/core/class/frigate.class.php @@ -2021,33 +2021,33 @@ private static function updateCommands($eqlogicId, $type, $frigateEvent) { log::add(__CLASS__, 'debug', "║ MAJ Commandes pour le type : $type"); - $update = function ($label, $subtype, $unit, $logicalId, $value) use ($eqlogicId) { - $cmd = self::createCmd($eqlogicId, $label, $subtype, $unit, $logicalId, "", 0, null, 0); + $update = function ($label, $subtype, $unit, $logicalId, $genericType, $value) use ($eqlogicId) { + $cmd = self::createCmd($eqlogicId, $label, $subtype, $unit, $logicalId, $genericType, 0, null, 0); $cmd->save(); $cmd->event($value ?? ''); $cmd->save(); }; - $update("Reconnaissance - Type", "string", "", "info_detection_type", $type); + $update("Reconnaissance - Type", "string", "", "info_detection_type", "", $type); $withNameScore = ['face', 'lpr', 'classification']; if (in_array($type, $withNameScore)) { - $update("Reconnaissance - Nom", "string", "", "info_detection_name", $frigateEvent->getRecognition_name()); - $update("Reconnaissance - Score", "numeric", "%", "info_detection_score", $frigateEvent->getRecognition_score()); + $update("Reconnaissance - Nom", "string", "", "info_detection_name", "", $frigateEvent->getRecognition_name()); + $update("Reconnaissance - Score", "numeric", "%", "info_detection_score", "", $frigateEvent->getRecognition_score()); } if ($type === 'description') { log::add(__CLASS__, 'debug', "║ Mise à jour de la description : " . $frigateEvent->getRecognition_description()); - $update("Reconnaissance - Description", "string", "", "info_description", $frigateEvent->getRecognition_description()); + $update("Reconnaissance - Description", "string", "", "info_description", "", $frigateEvent->getRecognition_description()); } if ($type === 'lpr') { - $update("Reconnaissance - Plaque d'immatriculation", "string", "", "info_plate", $frigateEvent->getRecognition_plate()); + $update("Reconnaissance - Plaque d'immatriculation", "string", "", "info_plate", "", $frigateEvent->getRecognition_plate()); } if ($type === 'classification') { - $update("Reconnaissance - Label", "string", "", "info_detection_subname", $frigateEvent->getRecognition_subname()); - $update("Reconnaissance - Attributs", "string", "", "info_detection_attributes", $frigateEvent->getRecognition_attributes()); + $update("Reconnaissance - Label", "string", "", "info_detection_subname", "", $frigateEvent->getRecognition_subname()); + $update("Reconnaissance - Attributs", "string", "", "info_detection_attributes", "", $frigateEvent->getRecognition_attributes()); } } diff --git a/plugin_info/info.json b/plugin_info/info.json index 44d8a936..9a2d38c4 100644 --- a/plugin_info/info.json +++ b/plugin_info/info.json @@ -1,7 +1,7 @@ { "id": "frigate", "name": "Frigate", - "pluginVersion": "1.5.2", + "pluginVersion": "1.5.21", "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.", From 5d2ad52a91b516a19c583a5378494de4dd041ba0 Mon Sep 17 00:00:00 2001 From: sagitaz Date: Sat, 18 Apr 2026 15:32:52 +0200 Subject: [PATCH 2/7] ajout refresh sur chaque eqLogic --- core/class/frigate.class.php | 7 ++++++- desktop/js/frigate.js | 5 +++++ desktop/php/frigate.php | 9 ++++++++- plugin_info/info.json | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/core/class/frigate.class.php b/core/class/frigate.class.php index 054b57b0..13e69929 100644 --- a/core/class/frigate.class.php +++ b/core/class/frigate.class.php @@ -408,7 +408,12 @@ public function toHtml($_version = 'dashboard') $replace['#cameraName#'] = $this->getConfiguration("name"); $replace['#imgUrl#'] = $this->getConfiguration("img"); $replace['#enabled#'] = $this->getCmd('info', 'info_enabled') ? $this->getCmd('info', 'info_enabled')->execCmd() : 1; - $replace['#refresh#'] = (float)(config::byKey('refresh_snapshot', 'frigate')) * 1000; + + if ($this->getConfiguration('normal::refresh') != '') { + $replace['#refresh#'] = (float)$this->getConfiguration('normal::refresh') * 1000; + } else { + $replace['#refresh#'] = (float)(config::byKey('refresh_snapshot', 'frigate', 5)) * 1000; + } $replace['#actions#'] = $this->buildActions(); $replace['#iaActions#'] = $this->buildIaActions(); diff --git a/desktop/js/frigate.js b/desktop/js/frigate.js index 4d73ab36..5bae1e1c 100644 --- a/desktop/js/frigate.js +++ b/desktop/js/frigate.js @@ -528,6 +528,11 @@ function printEqLogic(_eqLogic) { observer.observe(imgElement); function startImageFetchInterval() { + const eqRefresh = $('.eqLogicAttr[data-l1key=configuration][data-l2key=normal::refresh]').val(); + if (eqRefresh && !isNaN(eqRefresh) && eqRefresh > 0) { + refresh = eqRefresh * 1000; + } + console.log('Refresh interval in milliseconds: ' + refresh); if (!intervalId) { intervalId = setInterval(refreshImage, refresh); } diff --git a/desktop/php/frigate.php b/desktop/php/frigate.php index 5f5aacd9..476735bb 100644 --- a/desktop/php/frigate.php +++ b/desktop/php/frigate.php @@ -13,7 +13,6 @@ sendVarToJS('frigateURL', $urlFrigate); $urlExterne = config::byKey('URLexterne', 'frigate'); sendVarToJS('frigateURLexterne', $urlExterne); - $refresh = (float)(config::byKey('refresh_snapshot', 'frigate')) * 1000; sendVarToJS('refresh', $refresh); ?> @@ -209,6 +208,14 @@ +
+ +
+ +
+
diff --git a/plugin_info/info.json b/plugin_info/info.json index 9a2d38c4..f7bc970e 100644 --- a/plugin_info/info.json +++ b/plugin_info/info.json @@ -1,7 +1,7 @@ { "id": "frigate", "name": "Frigate", - "pluginVersion": "1.5.21", + "pluginVersion": "1.5.22", "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.", From 4c11e0d522791d2ec3436df77f83a73688a14597 Mon Sep 17 00:00:00 2001 From: sagitaz Date: Sat, 18 Apr 2026 15:48:55 +0200 Subject: [PATCH 3/7] Add console log for debug refresh --- core/template/dashboard/widgetCamera.html | 1 + core/template/dashboard/widgetPanel.html | 3 ++- desktop/js/frigate.js | 9 +++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/template/dashboard/widgetCamera.html b/core/template/dashboard/widgetCamera.html index 8489a2b0..779c2a22 100644 --- a/core/template/dashboard/widgetCamera.html +++ b/core/template/dashboard/widgetCamera.html @@ -112,6 +112,7 @@ function startImageFetchInterval() { if (!intervalId) { intervalId = setInterval(refreshImage, #refresh#); + console.log('Interval started for camera #id# with refresh rate: ' + #refresh# + ' ms'); } } diff --git a/core/template/dashboard/widgetPanel.html b/core/template/dashboard/widgetPanel.html index 35e82fed..b026c790 100644 --- a/core/template/dashboard/widgetPanel.html +++ b/core/template/dashboard/widgetPanel.html @@ -108,7 +108,8 @@ function startImageFetchInterval() { if (!intervalId) { - intervalId = setInterval(refreshImage, #refresh#); + intervalId = setInterval(refreshImage, #refresh#); + console.log('Interval started for camera #id# with refresh rate: ' + #refresh# + ' ms'); } } diff --git a/desktop/js/frigate.js b/desktop/js/frigate.js index 5bae1e1c..5629f847 100644 --- a/desktop/js/frigate.js +++ b/desktop/js/frigate.js @@ -528,10 +528,15 @@ function printEqLogic(_eqLogic) { observer.observe(imgElement); function startImageFetchInterval() { - const eqRefresh = $('.eqLogicAttr[data-l1key=configuration][data-l2key=normal::refresh]').val(); + const eqRefresh = $('.eqLogicAttr[data-l1key="configuration"]') + .filter(function () { + return $(this).attr('data-l2key') === 'normal::refresh'; + }) + .val(); + if (eqRefresh && !isNaN(eqRefresh) && eqRefresh > 0) { refresh = eqRefresh * 1000; - } + } console.log('Refresh interval in milliseconds: ' + refresh); if (!intervalId) { intervalId = setInterval(refreshImage, refresh); From 7ec26c3facc4c6dd747055fc2378012c03f24daf Mon Sep 17 00:00:00 2001 From: sagitaz Date: Sat, 18 Apr 2026 16:06:56 +0200 Subject: [PATCH 4/7] refresh interval for eqLogic --- desktop/js/frigate.js | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/desktop/js/frigate.js b/desktop/js/frigate.js index 5629f847..d643b026 100644 --- a/desktop/js/frigate.js +++ b/desktop/js/frigate.js @@ -533,14 +533,19 @@ function printEqLogic(_eqLogic) { return $(this).attr('data-l2key') === 'normal::refresh'; }) .val(); - + refreshSnap = refresh; if (eqRefresh && !isNaN(eqRefresh) && eqRefresh > 0) { - refresh = eqRefresh * 1000; + refreshSnap = eqRefresh * 1000; } - console.log('Refresh interval in milliseconds: ' + refresh); - if (!intervalId) { - intervalId = setInterval(refreshImage, refresh); + + // On arrête toujours l'intervalle existant avant d'en créer un nouveau + if (intervalId) { + clearInterval(intervalId); + intervalId = null; } + + console.log('Refresh interval in milliseconds: ' + refreshSnap); + intervalId = setInterval(refreshImage, refreshSnap); } function stopImageFetchInterval() { @@ -667,12 +672,12 @@ document.getElementById('addCmdHttp').addEventListener('click', function () { }, dataType: 'json', - error: function (error) { - jeedomUtils.showAlert({ - message: error.message, - level: 'danger' - }); - }, + error: function (error) { + jeedomUtils.showAlert({ + message: error.message, + level: 'danger' + }); + }, success: function (data) { jeedomUtils.showAlert({ message: '{{Création de la commande réussie.}}', @@ -708,12 +713,12 @@ function editHTTP(cmd) { }, dataType: 'json', - error: function (error) { - jeedomUtils.showAlert({ - message: error.message, - level: 'danger' - }); - }, + error: function (error) { + jeedomUtils.showAlert({ + message: error.message, + level: 'danger' + }); + }, success: function (data) { jeedomUtils.showAlert({ message: '{{Modification de la commande réussie.}}', From e6a56d0f5321e89bd1d96592966d7b2fb66c99a2 Mon Sep 17 00:00:00 2001 From: sagitaz Date: Sun, 19 Apr 2026 11:16:08 +0200 Subject: [PATCH 5/7] add normal::mobilerefresh --- core/class/frigate.class.php | 16 ++++++++++++++++ desktop/php/frigate.php | 7 +++++-- plugin_info/info.json | 2 +- plugin_info/install.php | 2 ++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/core/class/frigate.class.php b/core/class/frigate.class.php index 13e69929..a6a49820 100644 --- a/core/class/frigate.class.php +++ b/core/class/frigate.class.php @@ -84,6 +84,22 @@ private static function configSave(array $array = []): void } } } + + public static function setConfigEqlogic() { + $eqLogics = self::byType('frigate'); + foreach ($eqLogics as $eqLogic) { + $refresh = config::byKey('refresh_snapshot', 'frigate', 5); + if ($eqLogic->getConfiguration('normal::refresh') === null) { + $eqLogic->setConfiguration('normal::refresh', $refresh); + $eqLogic->save(); + } + if ($eqLogic->getConfiguration('normal::mobilerefresh') === null) { + $eqLogic->setConfiguration('normal::mobilerefresh', $refresh); + $eqLogic->save(); + } + } + } + private static function execCron($frequence) { log::add(__CLASS__, 'debug', "╔════════════════════════ :fg-success:START CRON:/fg: ════════════════════════"); diff --git a/desktop/php/frigate.php b/desktop/php/frigate.php index 476735bb..229f7da6 100644 --- a/desktop/php/frigate.php +++ b/desktop/php/frigate.php @@ -212,8 +212,11 @@ -
- +
+ +
+
+
diff --git a/plugin_info/info.json b/plugin_info/info.json index f7bc970e..126fec07 100644 --- a/plugin_info/info.json +++ b/plugin_info/info.json @@ -1,7 +1,7 @@ { "id": "frigate", "name": "Frigate", - "pluginVersion": "1.5.22", + "pluginVersion": "1.5.23", "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.", diff --git a/plugin_info/install.php b/plugin_info/install.php index 4cda66e3..de69b966 100644 --- a/plugin_info/install.php +++ b/plugin_info/install.php @@ -31,6 +31,7 @@ function frigate_install() frigate::setConfig(); frigate::setConfigCron(); + frigate::setConfigEqlogic(); frigate::addMessages(); Log::add("frigate", 'info', 'Finish Install'); } @@ -93,6 +94,7 @@ function frigate_update() } frigate::setConfig(); + frigate::setConfigEqlogic(); frigate::addMessages(); frigate::deleteLatestFile(); Log::add("frigate", 'info', 'Finish Update'); From 508397d59ce1e9d1ff6438f4be9540288544419e Mon Sep 17 00:00:00 2001 From: sagitaz Date: Sun, 19 Apr 2026 14:35:48 +0200 Subject: [PATCH 6/7] =?UTF-8?q?G=C3=A9r=C3=A9=20si=20Enabled=20est=20vide?= =?UTF-8?q?=20ou=20=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/class/frigate.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/class/frigate.class.php b/core/class/frigate.class.php index a6a49820..63b8a5be 100644 --- a/core/class/frigate.class.php +++ b/core/class/frigate.class.php @@ -423,8 +423,13 @@ public function toHtml($_version = 'dashboard') $replace['#cameraEqlogicId#'] = $this->getLogicalId(); $replace['#cameraName#'] = $this->getConfiguration("name"); $replace['#imgUrl#'] = $this->getConfiguration("img"); - $replace['#enabled#'] = $this->getCmd('info', 'info_enabled') ? $this->getCmd('info', 'info_enabled')->execCmd() : 1; - + $enabledCmd = $this->getCmd('info', 'info_enabled'); + if ($enabledCmd) { + $value = $enabledCmd->execCmd(); + $replace['#enabled#'] = ($value !== null && $value !== '') ? $value : 1; + } else { + $replace['#enabled#'] = 1; + } if ($this->getConfiguration('normal::refresh') != '') { $replace['#refresh#'] = (float)$this->getConfiguration('normal::refresh') * 1000; } else { From c884bc946928d8fa2e209fd788ccc98618d38103 Mon Sep 17 00:00:00 2001 From: sagitaz Date: Sun, 19 Apr 2026 22:32:49 +0200 Subject: [PATCH 7/7] Fix putCurl error --- core/class/frigate.class.php | 25 ++++++++++++++++++++----- docs/fr_FR/changelog.md | 7 +++++-- plugin_info/info.json | 2 +- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/core/class/frigate.class.php b/core/class/frigate.class.php index 63b8a5be..fcdade39 100644 --- a/core/class/frigate.class.php +++ b/core/class/frigate.class.php @@ -85,7 +85,8 @@ private static function configSave(array $array = []): void } } - public static function setConfigEqlogic() { + public static function setConfigEqlogic() + { $eqLogics = self::byType('frigate'); foreach ($eqLogics as $eqLogic) { $refresh = config::byKey('refresh_snapshot', 'frigate', 5); @@ -433,7 +434,7 @@ public function toHtml($_version = 'dashboard') if ($this->getConfiguration('normal::refresh') != '') { $replace['#refresh#'] = (float)$this->getConfiguration('normal::refresh') * 1000; } else { - $replace['#refresh#'] = (float)(config::byKey('refresh_snapshot', 'frigate', 5)) * 1000; + $replace['#refresh#'] = (float)(config::byKey('refresh_snapshot', 'frigate', 5)) * 1000; } $replace['#actions#'] = $this->buildActions(); @@ -740,8 +741,19 @@ private static function getcURL($function, $url, $params = null, $decodeJson = t curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); } + // log de la commande curl + $curl_cmd = "curl -k -X " . $method; + if ($method !== 'DELETE') { + $curl_cmd .= " -H 'Content-Type: application/json'"; + $curl_cmd .= " -d '" . json_encode($params) . "'"; + } + $curl_cmd .= " '" . $url . "'"; + log::add(__CLASS__, 'debug', "║ Commande exécutée : " . $curl_cmd); + // Fin du log + $data = curl_exec($ch); + log::add(__CLASS__, 'debug', "║ Réponse reçue : " . $data); if (curl_errno($ch)) { log::add(__CLASS__, "error", "║ Erreur getcURL (" . $method . "): " . curl_error($ch)); return null; @@ -759,6 +771,9 @@ private static function postcURL($function, $url, $params = null, $decodeJson = private static function putcURL($function, $url, $params = null, $decodeJson = true) { + if (empty($params)) { + $params = new stdClass(); + } return self::getcURL($function, $url, $params, $decodeJson, 'PUT'); } @@ -1545,8 +1560,8 @@ public static function getFolderSize() } catch (Exception $e) { return 0; } - $t1 = microtime(true); - log::add(__CLASS__, 'debug', "║ Taille du dossier calculée via PHP : " . round($size / (1024 * 1024), 2) . " Mo en " . round($t1 - $t0, 2) . "s"); + $t1 = microtime(true); + log::add(__CLASS__, 'debug', "║ Taille du dossier calculée via PHP : " . round($size / (1024 * 1024), 2) . " Mo en " . round($t1 - $t0, 2) . "s"); return round($size / (1024 * 1024), 2); } @@ -3190,7 +3205,7 @@ public static function handleMqttMessage($_message) if (version_compare($version, "0.14", "<")) { log::add("frigate_MQTT", 'info', ' => Traitement mqtt events <0.14'); log::add("frigate_MQTT", 'warning', ' => Version < 0.14, mettre à jour votre serveur frigate !'); - message::add("frigate",__("Version de Frigate détectée : " . $version . ", certaines fonctionnalités du plugin peuvent ne pas fonctionner correctement. Veuillez mettre à jour votre serveur Frigate pour une expérience optimale.", __FILE__)); + message::add("frigate", __("Version de Frigate détectée : " . $version . ", certaines fonctionnalités du plugin peuvent ne pas fonctionner correctement. Veuillez mettre à jour votre serveur Frigate pour une expérience optimale.", __FILE__)); self::getEvents(true, [$value['after']], $value['type']); event::add('frigate::events', array('message' => 'mqtt_update', 'type' => 'event')); } diff --git a/docs/fr_FR/changelog.md b/docs/fr_FR/changelog.md index 278a1a94..7e04f555 100644 --- a/docs/fr_FR/changelog.md +++ b/docs/fr_FR/changelog.md @@ -4,10 +4,13 @@ > >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. -# 13/05/2026 Beta 1.5.2 +# 19/04/2026 Beta 1.5.4 +- Correction du put curl pour l'activation et la désactivation des caméras via API + +# 13/04/2026 Beta 1.5.2 - Correction widget dashboard -# 09/05/2026 Beta 1.5.1 +# 09/04/2026 Beta 1.5.1 - Amélioration du processus de nettoyage des évènements - Correction maj sur cron via http diff --git a/plugin_info/info.json b/plugin_info/info.json index 126fec07..9baeb4c2 100644 --- a/plugin_info/info.json +++ b/plugin_info/info.json @@ -1,7 +1,7 @@ { "id": "frigate", "name": "Frigate", - "pluginVersion": "1.5.23", + "pluginVersion": "1.5.24", "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.",