Heliotrope... Jolie animation toutes les 2 secondes

Salut @lunarok

Sur la dernière beta (2020-02-04 12:48:39), j’ai ce comportement de refresh systématiquement toutes les 2 secondes environ.
J’ai pas remarqué ça avant. C’est volontaire ?

helio

V4.1.4 et Chrome

c’est pas dans la conf du plugin ou t’a réglé la Fréquence de calcul de la position solaire : trop petit

sur du 4.0.38 chromium ca le fait aussi mais pas toutes les 2 secondes

Merci Olive pour la piste, mais à priori le lien est pas évident entre 5 minutes et les 2 secondes de rafraîchissement coté widget (vitesse réelle sur le gif)

J’ai réactivé les logs, pour voir également de ce coté là

PS: Corrigé pour le H

Oui étrange j’ai vue l’effet je suis a 1 minute ce qui correspond a peut prés mais pas 2 secondes.
hiers soir il y avait un problème en beta avec une erreur 500 a la sauvegarde de il a du corrigé cette nuit entre temps je suis repassé en stable alors entre les 2 … pas re-testé la beta

La piste est bonne quand même, log toutes les secondes malgré la config

[2020-02-04 15:23:26][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:28][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:29][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:30][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:31][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:32][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:33][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:34][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:35][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:36][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:37][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:39][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:40][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:41][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:42][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:43][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:44][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:45][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:46][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:47][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:48][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:49][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:50][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:51][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:52][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:53][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:54][DEBUG] : Statut 1 Jour 215 19
[2020-02-04 15:23:55][DEBUG] : Statut 1 Jour 215 19

EDIT
En basculant, sur la stable j’ai pas ce comportement.
Si je reviens sur la beta, j’ai de nouveau l’animation… Y compris en forçant la sauvegarde de la configuration

Héliotrope (heliotrope) - beta
Version 2020-02-04 12:48:39

JD 4.0.38

j’ai un refresh toute les Minutes (c’est peut’être ton JD 4.1.4)

mon débug est beaucoup plus calme que le tiens

Pas trouvé le problème en 4.1.4 non plus

Il faut je sois sur le dashboard dans mon cas, sinon j’ai pas de trace dans la log.
Et au début ça mets 5 secondes env avant de commencer le cycle

A priori les différences entre la stable et la beta concernent justement les refresh …

diff -ru heliotrope/core/class/heliotrope.class.php heliotropebeta/core/class/heliotrope.class.php
--- heliotrope/core/class/heliotrope.class.php	2020-02-04 18:08:52.745749228 +0100
+++ heliotropebeta/core/class/heliotrope.class.php	2020-02-04 18:08:52.993745187 +0100
@@ -227,6 +227,17 @@
             }
             $heliotropeCmd->setConfiguration('type', 'time');
             $heliotropeCmd->save();
+            
+            $heliotropeCmd = heliotropeCmd::byEqLogicIdAndLogicalId($this->getId(),'refresh');
+            if (!is_object($heliotropeCmd)) {
+                $heliotropeCmd = new heliotropeCmd();
+                $heliotropeCmd->setName(__('Rafraichir', __FILE__));
+                $heliotropeCmd->setEqLogic_id($this->getId());
+                $heliotropeCmd->setLogicalId('refresh');
+                $heliotropeCmd->setType('action');
+                $heliotropeCmd->setSubType('other');
+                $heliotropeCmd->save();
+            }
 
                 heliotrope::getInformations();
                 heliotrope::getDaily();
@@ -515,6 +526,10 @@
             $replace['#heliosun#'] = "opacity : 0.3";
             $replace['#heliomoon#'] = "opacity : 1";
         }
+        
+        $refresh = $this->getCmd(null, 'refresh');
+        $replace['#refresh#'] = is_object($refresh) ? $refresh->getId() : '';
+        
         if (file_exists( __DIR__ ."/../template/$_version/heliotrope_user.html"))
           return $this->postToHtml($_version, template_replace($replace, getTemplate('core', $version, 'heliotrope_user', 'heliotrope')));
         else
@@ -526,6 +541,10 @@
 class heliotropeCmd extends cmd {
 
     public function execute($_options = null) {
+        if ($this->getLogicalId() == 'refresh') {
+            $eqLogic = $this->getEqLogic();
+            $eqLogic->getInformations();
+        } 
     }
 
 }
diff -ru heliotrope/core/template/dashboard/heliotrope.html heliotropebeta/core/template/dashboard/heliotrope.html
--- heliotrope/core/template/dashboard/heliotrope.html	2020-02-04 18:08:52.625751183 +0100
+++ heliotropebeta/core/template/dashboard/heliotrope.html	2020-02-04 18:08:52.877747077 +0100
@@ -1,6 +1,8 @@
 <div class="eqLogic-widget eqLogic allowResize" style="height: #height#;width: #width#;border:#border#;border-radius:#border-radius#;background-color: #background-color#;color: #color#;#style#" data-eqLogic_id="#id#" data-eqLogic_uid="#uid#" data-version="#version#" >
-	<center class="widget-name"><a href="#eqLink#" style="font-size : 1.5em;#hideEqLogicName#">#name_display#</a></center>
-	<div style="position : relative; left: 0px; margin-top: 10px;">
+	<center class="widget-name"><a href="#eqLink#" style="font-size : 1.5em;#hideEqLogicName#">#name_display#</a>
+<span class="cmd refresh pull-right cursor" data-cmd_id="#refresh#"><i class="fas fa-sync"></i></span>
+	</center>
+		<div style="position : relative; left: 0px; margin-top: 10px;">
 		<div class="pull-right" style="margin-right: 15px;margin-top: 5px;">
 			<div id="azimuth#id#" style="width: 80px; height: 80px;" class="cmd noRefresh" data-type="info" data-subtype="numeric" data-cmd_id="#azimuth360_id#"></div>
 		</div>
@@ -15,6 +17,15 @@
 	<script>
 		var chart1;
 		var chart2;
+		
+		if ('#refresh#' != ''){
+			$('.eqLogic[data-eqLogic_uid=#uid#] .refresh').on('click', function () {
+				jeedom.cmd.execute({id: '#refresh#'});
+			});
+		}else{
+			$('.eqLogic[data-eqLogic_uid=#uid#] .refresh').remove();
+		}
+		
 		if($('#azimuth#id#').html() != undefined){
 			chart1 = new Highcharts.Chart({
 				chart: {

Oui ca je le sais depuis hiers soir ou ca plantait a la sauvegarde équipement

mai ca explique pas pourquoi tu refresh toutes les 2s et pas nous

Aucune idée non plus… J’ai peut-être une connerie dans la config mais suffisamment petite pour ça ne gêne pas en stable…
S’il faut faire des tests, pas de souci mais j’avoue que je ne sais pas trop où chercher pour l’instant

peut’être note maitre @lunarok aura la réponse.

Bon pas de news de @lunarok mais j’ai un début de piste…

La fonction execute() lance getInformations() si on est dans le cas d’un refresh:

    public function execute($_options = null) {
        if ($this->getLogicalId() == 'refresh') {
            $eqLogic = $this->getEqLogic();
            $eqLogic->getInformations();
        } 
    }

A la fin du getInformations(), il y a un $this->refreshWidget()

Dans le core refreshWidget() fait un event

	public function refreshWidget() {
		$this->_needRefreshWidget = false;
		$this->emptyCacheWidget();
		event::add('eqLogic::update', array('eqLogic_id' => $this->getId()));
	}

Je suppose que l’event lance à un moment un execute() en mode refresh ou un getInformations()… et c’est la boucle infinie

En attendant, je suis revenu la version stable…

@jpty nous a donné un coup de main il a peut’être pas vu ton fil …

J’ai pas le problème en beta.
Donc faut chercher ce qui déclencher le JavaScript en boucle dans ton cas

Bon j’ai fait 3 tests :

  • Installé 1 jeedom alpha tout neuf avec juste Heliotrope et Geotrav… => pas de souci
  • J’ai importé le backup => ano.
  • J’ai supprimé tous les objets sauf ceux liés à Heliotrope et Geotrav => ano

Donc c’est effectivement dans ma config mais j’ai absolument aucune idée de ce qui peut-être en cause…

EDIT : J’ai remplacé dans la config Heliotrope les infos de geotrav, par celle de jeedom… Et désactivé geotrav…

@jpty @nebz
Voilà le sujet initial

Bonjour @naboleo,

Je vois sur votre capture d’écran que comme moi, vous avez la tuile heliotrope qui se met à jour en permanence.
Pour corriger, il faut éditer le fichier plugins/heliotrope/core/class/heliotrope.class.php et dans la fonction toHtml ajouter une ligne:

        $id=array();
        $value=array();
        foreach($this->getCmd() as $cmd){
            if($cmd->getType() != 'info') continue; // ligne à AJOUTER
            $type_cmd=$cmd->getLogicalId();
            $id[$type_cmd]=$cmd->getId();
            $value[$type_cmd]=$cmd->execCmd();
        }

Merci @jpty

J’avais pas terminé l’analyse de l’anomalie de mon coté !

J’ai mis plus d’une semaine (pas en continu heureusement) à le trouver celui-là.