I have a problem with receiving arduino sms

I have the following code made by a friend, who sends text messages in the morning and in the evening with the data from the humidity, temperature and weight sensor. And I receive empty text messages without any information. Can you help me get over it, please.

#include <DS3231.h>
DS3231  rtc(SDA, SCL);
Time  t;
#include <dht.h>
#include "HX711.h"
#include <SoftwareSerial.h>
int messagecount = 0;
const int LOADCELL_DOUT_PIN = 3;
const int LOADCELL_SCK_PIN = 2;
#define dataPin 7
HX711 scale; // working
dht DHT;
SoftwareSerial sim808(4,5); // RX, TX
String dataforgsm;
char phone_no[] = "+40760000000"; // replace with your phone no.
String data[5];
#define DEBUG true
String state,timegps,latitude,longitude;

int k=0;
char msg;
char call;

void setup() {
sim808.begin(38400);
Serial.begin(9600);
 Serial.println ( "check");
delay(50);
  rtc.begin();
  // Here to set the time , day and date. 
  
  rtc.setDOW(WEDNESDAY);     // Set Day-of-Week to SUNDAY // 
/* *****************************************************
  
    

/* *****************************************************/
rtc.setTime(21, 05, 0);    // Set the time to 12:00:00 (24hr format)
  
  rtc.setDate(15, 4, 2020);   // Set the date to DD/MM/YYYY
 Serial.println ( "check1");
// Setup code for GSM Start
sim808.print("AT+CSMP=17,167,0,0\r");  // set this parameter if empty SMS received
delay(100);
sim808.print("AT+CMGF=1\r"); 
delay(400);
Serial.println ( "check2");
sendData("AT+CGNSPWR=1",1000,DEBUG);
delay(50);
sendData("AT+CGNSSEQ=RMC",1000,DEBUG);
delay(150);
// Setup code for GSM end
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
scale.read();      // print a raw reading from the ADC
scale.read_average(20);   // print the average of 20 readings from the ADC
scale.get_value(5);   // print the average of 5 readings from the ADC minus the tare weight (not set yet)
scale.get_units(5), 1;  // print the average of 5 readings from the ADC minus tare weight (not set) divided
scale.set_scale(44.5f);                      // this value is obtained by calibrating the scale with known weights; see the README for details

scale.tare();               // reset the scale to 0
scale.read();                 // print a raw reading from the ADC
scale.read_average(20);       // print the average of 20 readings from the ADC
 Serial.println ( "check3");
}
int kg = 0;
int smscounter = 0;
void loop(){
  t = rtc.getTime(); 
  Serial.print( t.hour);
  Serial.print( ":");
  Serial.print( t.min);
  Serial.print( ":");
  Serial.println( t.sec);
 
  //int modiifytime = timing;

 sendTabData("AT+CGNSINF",1000,DEBUG);
 delay(300);
 
 if ( t.hour == 7 && t.min == 00){ // dow = day, Mon = 1, Tues= 2, ... Sunday = 7, t.hour = hour 24 hours, t.min = minute, t.sec = seconds At this time it will send message. 
 if (k<=10){
 SendMessage();
 k++;}
 Serial.println ( " sms sent");
 }


  if (t.hour == 20 && t.min == 00 ){ // 20: 00 condtion to send sms,
 if (k<=10){

 SendMessage();
 k++;
  Serial.println ( " sms sent");
 }
 
 }
 
 delay(200);
 sim808.println((char)26); // End AT command with a ^Z, ASCII code 26
 delay(200);
 sim808.println();
 delay(20000);
 sim808.flush();
  Serial.println ( "loop finished");
  if ( messagecount == 1)
  { delay ( 30000); 
  messagecount = 0; }
  
  }


String sendData (String command , const int timeout ,boolean debug){
  String response = "";
  sim808.println(command);
  long int time = millis();
  int i = 0;

  while ( (time+timeout ) > millis()){
    while (sim808.available()){
      char c = sim808.read();
      response +=c;
    }
  }
  if (debug) {
     Serial.print(response);
     }
     return response;
}
void SendMessage()
{ messagecount = 1;
  
  int readData = DHT.read22(dataPin);
   float temp = DHT.temperature; 
  float humidity = DHT.humidity; 
  Serial.print("Temperature = ");
  Serial.println(temp);
  Serial.print("Humidity=");
  Serial.println(humidity);
 // Serial.println(scale.get_units(10), 1);
  
float khali=scale.get_units(10);
//Serial.println(khali);
kg = 0;
  if ((khali>=1000.0) || (khali<=-1000.0)) // Done
  { khali=khali/1000;
  kg = 1;
  }
 if ( khali<0)
 { khali = -1 * ( khali); }
   Serial.println ("Check point 1" );
  //Serial.println (khali);
 String weight=  String (khali);
  if (kg == 1)
  {  weight= weight  + String("kg");}
  else
  {  weight= weight  + String("g");}
  
  String humid = String (humidity); // convernting from float to String
  String tempera = String ( temp) ; // convernting from float to String
  
 String data = String("T") + String("_") + tempera + String("C_") + String("H") + String("_") + humid + String("%_") + String("W") + weight  ;
  Serial.println(data);
 dataforgsm = data;
 
  scale.power_down();              // put the ADC in sleep mode
  delay(5000);
  scale.power_up();
  delay(1000);
  Serial.print("sending message");
  sim808.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);  // Delay of 1000 milli seconds or 1 second
  sim808.println("AT+CMGS=\"+40760000000\"\r"); // Replace x with mobile number
  delay(1000);
  sim808.println(dataforgsm);// The SMS text you want to send
  delay(100);
   //sim808.println("Lattitude is ");
  //sim808.println(latitude );
  // delay(100);
  // sim808.println("Longitude is ");
 // sim808.println(longitude );
  // delay(100);
   sim808.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
}
void sendTabData(String command , const int timeout , boolean debug){

  sim808.println(command);
  long int time = millis();
  int i = 0;

  while((time+timeout) > millis()){
    while(sim808.available()){
      char c = sim808.read();
      if (c != ',') {
         data[i] +=c;
         delay(100);
      } else {
        i++;  
      }
      if (i == 5) {
        delay(100);
        goto exitL;
      }
    }
  }exitL:
  if (debug) {
    state = data[1];
    timegps = data[2];
    latitude = data[3];
    longitude =data[4];  
  }  }

i would develop a piece of code that reliably sends and receives messages before attempting to do so in an application. (how do you test your code; see if anything is received in the morning and evening?)

both sendData() and sendTabData() send a string and then wait up to 1 second to receive data. Why don’t you have a sub-function that checks for an prints any received data that is called from loop() instead of only checking for received data for a short time in these functions.

sendMessage() prepares a message and then sends it with long (second) delays. why construct a message to send and send it in a single call to sim808.println(). Don’t understand why it is sent in pieces with delays.

why are there any delays?

why does loop() call sendTabData() each time it runs?

in loop(), SendMessage() is called up to 10 time (k <= 10) for an entire minute. k is incremented each time.

when is “k” reset to zero?