 retained int lightValueMin = 4096, lightValueMax;
 retained int rainValueMin = 4096, rainValueMax;
 retained int waterValueMin = 100, waterValueMax;
+retained unsigned char lightStatus, rainStatus, waterStatus;
 
 // Statistical smoothing and exponential filtering
 const float FACTOR_RSSI  = 0.1;    // Smoothing factor for RSSI

// Measured values
int rssiValue;
int lightValue, rainValue, waterValue;
unsigned char lightStatus, rainStatus, waterStatus;
float lightTrend, rainTrend, waterTrend;

// Backup variables (long terms statistics)

  static unsigned long tsMeasure;
  if (millis() - tsMeasure >= PERIOD_MEASURE_RSSI || tsMeasure == 0) {
    tsMeasure = millis();
    rssiValue = efRssi.getValue(WiFi.RSSI());
    }
}

