Need help resetting CO2 Sensor with RTC

Hello I need help for resetting a CO2 Sensor with a realtime clock every 24 hours.
(turn the power off and on again)

Here is the code:

#include <DS1307RTC.h>
#include <Time.h> 
#include <Wire.h>
#include <SPI.h>
#include <SC16IS750.h>
#include <string.h>
#include <NDIRZ16.h>

short DN;   //Returns the number of day in the year
short WN;   //Returns the number of the week in the year


SC16IS750 i2cuart = SC16IS750(SC16IS750_PROTOCOL_I2C,SC16IS750_ADDRESS_BB);
NDIRZ16 mySensor = NDIRZ16(&i2cuart);

void setup() 
{
    Serial.begin(115200);
    i2cuart.begin(9600);
    setSyncProvider(RTC.get); // holen Zeit von RTC(Uhr)
    Wire.begin();

    if (i2cuart.ping()) {
        Serial.println("SC16IS750 found.");
        Serial.println("Wait 10 seconds for sensor initialization...");
    } else {
        Serial.println("SC16IS750 not found.");
        while(1);
    }

    power(1);
    //Wait for the NDIR sensor to initialize.
    delay(10000);
    

};

void loop() {

digitalUhrAnzeige();  //Uhr Anzeige
  
    if (mySensor.measure()) {
        Serial.print("CO2 Concentration is ");
        Serial.print(mySensor.ppm);
        Serial.println("ppm");
    } else {
        Serial.println("Sensor communication error.");
    }
    delay(1000);
}

//Power control function for NDIR sensor. 1=ON, 0=OFF
void power (uint8_t state) {
    i2cuart.pinMode(0, INPUT);      //set up for the power control pin
 
    if (state) {
        i2cuart.pinMode(0, INPUT);  //turn on the power of MH-Z16
    } else {
        i2cuart.pinMode(0, OUTPUT);
        i2cuart.digitalWrite(0, 0); //turn off the power of MH-Z16
    }
}

//Zero Point (400ppm) Calibration function for NDIR sensor. Only used when necessary.
//Make sure that the sensor has been running in fresh air (~400ppm) for at least 20 minutes before calling this function.
void calibrate() {
    i2cuart.pinMode(1, OUTPUT);    //set up for the calibration pin.
     
    i2cuart.digitalWrite(1, LOW);  //start calibration of MH-Z16 under 400ppm
    delay(10000);                  //5+ seconds needed for the calibration process
    i2cuart.digitalWrite(1, HIGH); //toggle the pin HIGH back to normal operation
}
void digitalUhrAnzeige(){
DayWeekNumber(year(),month(),day(),weekday());
 Serial.print("Tag des jahres ist: ");
 Serial.println(DN);
 Serial.print("Woche des jahres ist: ");
 Serial.println(WN);
// Serial.print("das jahr ist: ");
//Serial.println(year());

}
void DayWeekNumber(unsigned int y, unsigned int m, unsigned int d, unsigned int w){
 int days[]={0,31,59,90,120,151,181,212,243,273,304,334};    // Number of days at the beginning of the month in a not leap year.
//Start to calculate the number of day
 if (m==1 || m==2){
   DN = days[(m-1)]+d;                     //for any type of year, it calculate the number of days for January or february
 }                        // Now, try to calculate for the other months
 else if ((y % 4 == 0 && y % 100 != 0) ||  y % 400 == 0){  //those are the conditions to have a leap year
   DN = days[(m-1)]+d+1;     // if leap year, calculate in the same way but increasing one day
 }
 else {                                //if not a leap year, calculate in the normal way, such as January or February
   DN = days[(m-1)]+d;
 }
// Now start to calculate Week number
 if (w==0){
   WN = (DN-7+10)/7;             //if it is sunday (time library returns 0)
 }
 else{
   WN = (DN-w+10)/7;        // for the other days of week
 } 


{
   Serial.print("Uhrzeit =  ");
   printZiffernGenulltOhnePunkt(hour()); // rufen Subroutine auf
   printZiffernGenulltmitPunkt(minute()); // rufen Subroutine auf
   printZiffernGenulltmitPunkt(second()); // rufen Subroutine auf
   Serial.println(); // fuegen Freizeichen und Uhr ein
   Serial.print("Datum = ");  // fuegen Datum und Freizeichen ein
   printZiffernGenulltOhnePunkt(day()); // rufen Subroutine auf
   Serial.print("."); // fuegen Freizeichen ein
   printZiffernGenulltOhnePunkt(month()); // rufen Subroutine auf
   Serial.print("."); // fuegen Freizeichen ein
   Serial.println(year()); // Zeilenvorschub
   Serial.print("Tag der Woche ist = ");
   Serial.println(weekday());
      
}
}

void printZiffernGenulltOhnePunkt(int zahl) // definieren Subroutine
{
  // verschoenern Anzeige, indem wir ...
  if(zahl < 10) // wenn kleiner als 10 ...
   {
     Serial.print(""); // fuehrende 0 einfuegen
   }
   Serial.print(zahl); // Ausgabe auf serieller Konsole
}

void printZiffernGenulltmitPunkt(int zahl) // definieren Subroutine
{
  // verschoenern Anzeige, indem wir ...
  Serial.print(":"); // trennende ":" einfuegen
  if(zahl < 10) // wenn kleiner als 10 ...
  {
     Serial.print('0'); // fuehrende 0 einfuegen
  }
  Serial.print(zahl); // Ausgabe auf serieller Konsole
}
    if (state) {

State is not a boolean. Why are you treating it as such? Is it THAT difficult to type

if(state == 1)
{

and make the code CLEAR?

        i2cuart.pinMode(0, INPUT);  //turn on the power of MH-Z16
    } else {
        i2cuart.pinMode(0, OUTPUT);
        i2cuart.digitalWrite(0, 0); //turn off the power of MH-Z16

One of those comments is wrong. If setting the pin mode powers the device on, then digitalWrite does not.

Why can't you just call the power() function at the appropriate time?