SuiviConso: valeurs folles de consommation de certains équipements

Bon jour a tous
Bien @pierremcde pour ton script… tu as du pas mal y travailler …J’ai aussi eu des erreurs avec des equipements zwave Fibaro Wall plug mais beaucoup plus rare .
Dans la configuration du plugin Suivi conso il y a 2 parametres qui regleraient peut etre les problemes (du moins en partie) :
-Variation : inserer si conso > conso precedente (ne fonctionne pas, bloque tout )
-Ne pas inserer si la puissance > 50000 (semble fonctionner)
Ca ne corrigera pas les historiques des equipements ,mais au moins ca limitera bien les erreurs de suiviconso
Je me tourne vers @Thibaut_T et @superbricolo pour regarder le probleme quand ils auront un peu de temps , merci a eux pour le travail deja accompli.
Chez moi je pense que les données erronées viennent du Linky, je suis a la campagne et les coupures, baisses de tension sont assez frequentes.

1 « J'aime »

Intéressant parce que j’ai beaucoup de plugs NeoCoolCam et je pensais que c’était dû à la qualité chinoise :smirk:

Ca peut pas faire de mal merci :+1:

Dans la prochaine version il y aura un contrôle adaptable pour les équipements type FGD 212. Cela devrait résoudre vos problèmes:

Variation max aurorisée

2 « J'aime »

Top!!! Ca résoudra le problème, merci. :ok_hand:
Il faudrai juste je pense préciser sur quelle période cette variation est autorisée (pas trop clair pour l’utilisateur lambda)

Bon, suite à mon message, j’ai bien évidemment pile dans la nuit eu un problème de variation anormale à la baisse. Ce qui est intéressant c’est que le plugin suiviconso enregistre en fait le pic de retour à la normale comme une surconsommation:

J’ai donc finalement modifié mon script, qui fixe désormais un minimum de conso à la valeur actuelle arrondi à la baisse. Si un jour mes modules atteignent le max de conso (des millions de KwH) et veut redescendre à 0, on verra quand ça arrivera :wink:

Voici le script complet:

// To be run ONCE a week, to set min/maxboundaries of the consumption commands, to automatically exclude eratic values
// What this does : 
// - lists all Z-wave devices
// - sets a maximum value that should be enough for the week, 
//   and a minimum (except commands from the exclusion list, like the main power meter)

// ********** PARAMETERS **********
// possible names for the power consumption (Kwh) command
$consumption_cmd_names = array("Consommation","Consommation 1", "Consommation 2");
// Plugin name for eqLogic type searched
$eqlogic_type = "openzwave";
// List all consumption commands from devices that should be ignored
$ignored_cmds = array("[Technical - Power][Aeon Total Energy Meter][Consommation]");
// Weekly consumption variance in Kwh by device
// This is important, it will be the max Kwh variance in consumption, i.e. to be recorded during the week (until the next scenario run)
// In other terms, the max consumption will be set at $current_consumption + $std_max_variance until next week for each consumption cmd
$std_max_variance = 25; // Kwh



// ************* START *************
// Creates a list of the devices we want (Z-wave)
// $mydevices = eqLogic::all(); // We don't need all devices, just Z-wave
$mydevices = eqLogic::byType($eqlogic_type);

$scenario->setLog( '-- INFO - Each device will receive a max weekly allowance of ' . $std_max_variance . 'Kwh');

// Makes sure the commands we want to ignore exist, if not, logs an error
foreach($ignored_cmds as $ignored_cmd)
{
	try
    {
      	// Command exists: it will be considered later. If not, this triggers an error handled below
      	$cons_cmd = cmd::byString('#'. $ignored_cmd.'#');
    }
  	catch (Exception $e)
    {
        // Oops, this commande doesn't exist anymore
        $scenario->setLog( '-- ERROR cmd ' . $ignored_cmd . ' was to be ignored, but it does not exist'); 
    }
}

// going through all devices
foreach($mydevices as $mydevice)
{
  	// Resets the values for this device
  	$consumption_cmds_found = array(); // Initializes an empty array (a device can have several consumption commands)
  	$consumption_cmds_ignored = array(); // Initializes an empty array (a device can have several consumption commands ignored)
  	// Gets the device name (e.g. "[Living room][Sofa Light]")
  	$mydevice_name = $mydevice->getHumanName();
  
  	// (unnecessary) gets all commands for this device
  	// $allCmds = $mydevice->getCmd();
  
  	// Tries the find the consumption commands (with each name variation)
  	foreach($consumption_cmd_names as $consumption_cmd_name)
	{
        try
        {
            $consumption_cmd_fullname = $mydevice_name . '[' . $consumption_cmd_name .']';
          	$cons_cmd = cmd::byString('#'. $consumption_cmd_fullname .'#');
            // Now see if we need to ignore this command
          	if(in_array($consumption_cmd_fullname,$ignored_cmds))
            { 
              	//Is in the ignore list
              	$scenario->setLog( '-- IGNORED cmd    '. $mydevice_name . '[' . $consumption_cmd_name .']');
              	array_push($consumption_cmds_ignored,$consumption_cmd_name);
            }
            else
            { 
              	// Is not in the ignore list
              	$scenario->setLog( '-- FOUND   cmd    '. $mydevice_name . '[' . $consumption_cmd_name .']');
              	array_push($consumption_cmds_found,$consumption_cmd_name);
              	// Now processes the command
              	// gets the current consumption, which will be our baseline
				$current_consumption = $cons_cmd->execCmd();
              	// For MAXIMUM
              	$scenario->setLog( '               -> Kwh current: '. $current_consumption);
              	$getMax = $cons_cmd->getConfiguration('maxValue');
              	$scenario->setLog( '               -> Kwh old max: '. $getMax);
              	$new_max_consumption = round($current_consumption + $std_max_variance,0);
              	$scenario->setLog( '               -> Kwh new max: '. $new_max_consumption);
              	// Actually sets the max
              	if( $getMax != $new_max_consumption) 
                {
                  	$cons_cmd->setConfiguration('maxValue',$new_max_consumption);
                	$cons_cmd->save();
                  	// Double checking the changes were made
                    $cons_cmd->refresh();
                    $getNewMax = $cons_cmd->getConfiguration('maxValue');
                    if( $getNewMax == $new_max_consumption) 
                    {
                        $scenario->setLog( '            >>> OK');
                    }
                    else
                    {
                        $scenario->setLog( '            >>> UNDETERMINED ERROR');
                    }
              	}
              	else
                {
                  	$scenario->setLog( '            >>> Unchanged');
              	}  
              	// For MINIMUM
              	$getMin = $cons_cmd->getConfiguration('minValue');
              	$scenario->setLog( '               -> Kwh old min: '. $getMin);
              	$new_min_consumption = floor($current_consumption);
              	$scenario->setLog( '               -> Kwh new min: '. $new_min_consumption);
              	// Actually sets the min
              	if( $getMin != $new_min_consumption) 
                {
                  	$cons_cmd->setConfiguration('minValue',$new_min_consumption);
                	$cons_cmd->save();
                  	// Double checking the changes were made
                    $cons_cmd->refresh();
                    $getNewMin = $cons_cmd->getConfiguration('minValue');
                    if( $getNewMin == $new_min_consumption) 
                    {
                        $scenario->setLog( '            >>> OK');
                    }
                    else
                    {
                        $scenario->setLog( '            >>> UNDETERMINED ERROR');
                    }
              	}
              	else
                {
                  	$scenario->setLog( '            >>> Unchanged');
              	}
            } 
        }
        catch (Exception $e)
        {
            // no command found, do nothing     
        }
     }
  	// If no commands were found and no commands were ignored, the array will be empty
  	if(count($consumption_cmds_found) == 0 && count($consumption_cmds_ignored) == 0)
    {  
    	$scenario->setLog( '-- SKIPPED device ' . $mydevice_name);
    }
}

Et un exemple de log:

[2020-05-14 11:22:48][SCENARIO] Start : Scenario lance manuellement.
[2020-05-14 11:22:48][SCENARIO] Exécution du sous-élément de type [action] : code
[2020-05-14 11:22:48][SCENARIO] Exécution d'un bloc code
[2020-05-14 11:22:48][SCENARIO] -- INFO - Each device will receive a max weekly allowance of 25Kwh
[2020-05-14 11:22:48][SCENARIO] -- FOUND   cmd    [Balcony][Awning][Consommation]
[2020-05-14 11:22:48][SCENARIO]                -> Kwh current: 5.5
[2020-05-14 11:22:48][SCENARIO]                -> Kwh old max: 31
[2020-05-14 11:22:48][SCENARIO]                -> Kwh new max: 31
[2020-05-14 11:22:48][SCENARIO]             >>> Unchanged
[2020-05-14 11:22:48][SCENARIO]                -> Kwh old min: 5
[2020-05-14 11:22:48][SCENARIO]                -> Kwh new min: 5
[2020-05-14 11:22:48][SCENARIO]             >>> Unchanged
...
[2020-05-14 11:22:48][SCENARIO] -- FOUND   cmd    [Living room][Tubes][Consommation]
[2020-05-14 11:22:48][SCENARIO]                -> Kwh current: 6.01
[2020-05-14 11:22:48][SCENARIO]                -> Kwh old max: 31
[2020-05-14 11:22:48][SCENARIO]                -> Kwh new max: 31
[2020-05-14 11:22:48][SCENARIO]             >>> Unchanged
[2020-05-14 11:22:48][SCENARIO]                -> Kwh old min: 6
[2020-05-14 11:22:48][SCENARIO]                -> Kwh new min: 6
[2020-05-14 11:22:48][SCENARIO]             >>> Unchanged
[2020-05-14 11:22:48][SCENARIO] -- IGNORED cmd    [Technical - Power][Aeon Total Energy Meter][Consommation]
...
[2020-05-14 11:22:48][SCENARIO] -- FOUND   cmd    [Technical - Power][Power Washing Mashine][Consommation]
[2020-05-14 11:22:48][SCENARIO]                -> Kwh current: 184.852
[2020-05-14 11:22:48][SCENARIO]                -> Kwh old max: 210
[2020-05-14 11:22:48][SCENARIO]                -> Kwh new max: 210
[2020-05-14 11:22:48][SCENARIO]             >>> Unchanged
[2020-05-14 11:22:48][SCENARIO]                -> Kwh old min: 184
[2020-05-14 11:22:48][SCENARIO]                -> Kwh new min: 184
[2020-05-14 11:22:48][SCENARIO]             >>> Unchanged
[2020-05-14 11:22:48][SCENARIO] -- SKIPPED device [Technical Room][1Z-Stick Gen5 (ZW090)]
[2020-05-14 11:22:48][SCENARIO] -- SKIPPED device [Toilets][Motion Sensor]
[2020-05-14 11:22:48][SCENARIO] Fin correcte du scénario

Il ne sera pas nécessaire de préciser une période car le contrôle se fera entre 2 relevé et justement sur la surconsommation

1 « J'aime »

Ca sera parfait…
J’attend donc la prochaine version
Merci pour tout vos efforts

J’aurais une dernière question sur le role exacte des parametres optionnels suivant:
-intensité instantannée INST1
-intensité max IMAX1
Sont ils indispensable et peuvent ils influencer les données?

Tu penses en tant que le très bon dév que tu es, pas en tant qu’utilisateur :grinning: Ce que je voulais dire c’était juste de clarifier le label. Car en se mettant à la place de ton utilisateur quand je vois ce champs dans l’UI, je me demande sur quelle période c’est (donc ici entre deux mesures et pas sur un jour, une semaine…). exemple:

Variation max autorisée entre 2 mesures

En tous cas super initiative!!

Ok je vais modifié le libellé

1 « J'aime »

Ce sujet a été automatiquement fermé après 24 heures suivant le dernier commentaire. Aucune réponse n’est permise dorénavant.