diff --git a/core/class/HomeWizard.class.php b/core/class/HomeWizard.class.php index e669b4f..bb0f783 100644 --- a/core/class/HomeWizard.class.php +++ b/core/class/HomeWizard.class.php @@ -254,6 +254,14 @@ public static function event($data) { ]; if($key == 'unique_id' || $key == 'wifi_ssid' || $key == 'meter_model' || $key == 'montly_power_peak_timestamp' || $key == 'monthly_power_peak_timestamp' || $key == 'gas_unique_id' || $key == 'batteries_mode') $cmd['subtype']='string'; if($key == 'wifi_strength') $cmd['unite']='%'; + // temps de fonctionnement : historisé pour voir les redémarrages (retour à zéro), pas affiché + if($key == 'uptime_s') { + $cmd['name']=__("Temps de fonctionnement", __FILE__); + $cmd['unite']='s'; + $cmd['isVisible']=0; + $cmd['isHistorized']=1; + unset($cmd['template']); + } if($key == 'power_on' || $key == 'switch_lock' || $key == 'batteries_charge_allowed' || $key == 'batteries_discharge_allowed' || $key == 'batteries_charge_to_full' || $key == 'cloud_enabled' || $key == 'api_v1_enabled') $cmd['subtype']='binary'; // réglages système : l'état se lit sur les commandes action liées if($key == 'cloud_enabled' || $key == 'status_led_brightness_pct' || $key == 'api_v1_enabled') { diff --git a/resources/HomeWizard.js b/resources/HomeWizard.js index 8e0f602..fbab4bc 100644 --- a/resources/HomeWizard.js +++ b/resources/HomeWizard.js @@ -535,12 +535,22 @@ function removeConnection(index) { } // réglages système remontés à Jeedom (uniquement ceux que l'équipement donne) +const lastUptime = {}; function systemEvent(index, system) { if(!system || typeof system != 'object') {return;} const ev = {}; if(typeof system.cloud_enabled == 'boolean') {ev.cloud_enabled = system.cloud_enabled?1:0;} if(typeof system.status_led_brightness_pct == 'number') {ev.status_led_brightness_pct = system.status_led_brightness_pct;} if(typeof system.api_v1_enabled == 'boolean') {ev.api_v1_enabled = system.api_v1_enabled?1:0;} + if(typeof system.uptime_s == 'number') { + // temps de fonctionnement (API v2) : s'il retombe, l'équipement a redémarré (et non une simple coupure réseau) + ev.uptime_s = system.uptime_s; + // gardé hors de conn[] : la connexion peut être recréée après une coupure, la valeur précédente doit rester + if(typeof lastUptime[index] == 'number' && system.uptime_s < lastUptime[index]) { + Logger.log(index+" : L'équipement a redémarré il y a "+system.uptime_s+"s (il fonctionnait depuis "+lastUptime[index]+"s au relevé précédent)",LogType.WARNING); + } + lastUptime[index] = system.uptime_s; + } if(conn[index] && conn[index].isV2) { // API v2 : le wifi n'est plus dans les mesures mais dans /api/system const rssi = system.wifi_rssi_db;