Greenhouse automation

Just another quick update,
it seems my buddy wanted to do a bit more than I posted yesterday including a humidifier and some error reporting on the control panel.
The error stuff I'm still working on but due to the lack of left over pins I had to use a shift register to do the control panel leds.
Besides that I cleaned up the code a little bit. Actual build pictures are coming soon, ordered the electronics and starting the physical build this week.

#include <Sensirion.h>
#include <Time.h>

//Temperature and Humidity sensor
const uint8_t dataPin  =  2;
const uint8_t clockPin =  3;

float temperature;
float humidity;
float dewpoint;

Sensirion tempSensor = Sensirion(dataPin, clockPin);

//Temperature and Humidity interval time
long previousMillis = 0;
long interval = 300000;

//Soil moisture sensor
int moistureSensor = A0;
int moisture_val;

//Serial stuff
char buffer[5];

//Relay output pins
const int lightPin = 4;
const int waterPin = 5;
const int fanPin = 6;
const int humPin = 7;

//Control panel shift register pins and ON / OFF data string
int stats[15];
int previousstats[15];
const int data = 8;
const int clock = 9;
const int latch = 10;

//Light status
int lightstatus = 0;
int lastlightstatus = 0;

//Fan status
int fanstatus = 0;
int lastfanstatus = 0;

//Humidifier status
int humtime = 1000; //In milliseconds
int humstatus = 0;
int lasthumstatus = 0;

//Watering status
int watertime = 1000; //In milliseconds
int waterstatus = 0;
int lastwaterstatus = 0;

void setup()
{
  Serial.begin(9600);
  setTime(20,7,0,17,5,2011);
  pinMode(lightPin, OUTPUT);
  pinMode(waterPin, OUTPUT);
  pinMode(fanPin, OUTPUT);
  pinMode(humPin, OUTPUT);
  pinMode(data, OUTPUT);
  pinMode(clock, OUTPUT);
  pinMode(latch, OUTPUT);
}

void loop()
{
  unsigned long currentMillis = millis();
  time_t t = now();
  
  //Check Temperature.... and report every 5 minutes
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;
    
    tempSensor.measure(&temperature, &humidity, &dewpoint);

    moisture_val = analogRead(moistureSensor);
    
    Serial.print("Temperature: ");
    Serial.print(temperature);
    Serial.print(" C, Humidity: ");
    Serial.print(humidity);
    Serial.print(" %, Dewpoint: ");
    Serial.print(dewpoint);
    Serial.print(" C, Soil Moisture: ");
    Serial.println(moisture_val);
    Serial.print("#S|TEMPLOG|[");
    Serial.print(itoa((temperature), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((humidity), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((dewpoint), buffer, 10));
    Serial.print(";");
    Serial.print(itoa((moisture_val), buffer, 10));
    Serial.println("]#");
  }
  
  
  /////Light trigger
  if((0 <= hour(t)) && (18 > hour(t))) { ///Between which hours on
    lightstatus = 1;
  }
  if((18 <= hour(t)) && (24 >= hour(t))) { ///Between which hours off
    lightstatus = 0;
  }
  //Light compare, set status and report
  if(lightstatus != lastlightstatus) {
    if(lightstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Light On]#");
    }
    if(lightstatus == 0) {
      Serial.println("#S|ACTIONLOG|[Light Off]#");
    }
    digitalWrite(lightPin, lightstatus);
    lastlightstatus = lightstatus;
  }
  
  
  
  /////Fan trigger
  if(temperature <= 25 || humidity <= 60) { ///Turn off threshold
    fanstatus = 0;
  }
  if(temperature > 28 || humidity > 80) { ///Turn on threshold
    fanstatus = 1;
  }
  //Fan compare, set status and report
  if(fanstatus != lastfanstatus) {
    if(fanstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Fan On]#");
    }
    if(fanstatus == 0) {
      Serial.println("#S|ACTIONLOG|[Fan Off]#");
    }
    digitalWrite(fanPin, fanstatus);
    lastfanstatus = fanstatus;
  }
  
  
  
  /////Water trigger
  if(moisture_val > 1000) { ///Turn off threshold
    waterstatus = 0;
  }
  if(moisture_val < 850) { ///Turn on threshold
    waterstatus = 1;
  }
  //Pump compare, set status and report
  if(waterstatus != lastwaterstatus) {
    if(waterstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Pump On]#");
      digitalWrite(waterPin, waterstatus);
        delay(watertime);
        waterstatus = 0;
        Serial.println("#S|ACTIONLOG|[Pump Off]#");
        digitalWrite(waterPin, waterstatus);
        lastwaterstatus = waterstatus;
      }
   }
  
  
  
  ////Humidifier trigger
  if(humidity > 70) { ///Turn off threshold
    humstatus = 0;
  }
  if(humidity < 50) { ///Turn on threshold
    humstatus = 1;
  }
  //Humidifier compare, set status and report
  if(humstatus != lasthumstatus) {
    if(waterstatus == 1) {
      Serial.println("#S|ACTIONLOG|[Humidifier On]#");
      digitalWrite(humPin, humstatus);
        delay(humtime);
        humstatus = 0;
        Serial.println("#S|ACTIONLOG|[Humidifier Off]#");
        digitalWrite(humPin, humstatus);
        lasthumstatus = humstatus;
      }
   }
   
   
   
  /////Status LEDs
  ////These store the ON and OFF data in the 'stats' string to be used when shifting out
  //Temperature
  if((temperature < 22) || (temperature > 28)) {
    stats[2] = 0;
    stats[3] = 1;
  }
  else {
    stats[2] = 1;
    stats[3] = 0;
  }
  //Humidity
  if((humidity < 60) || (humidity > 80)) {
    stats[4] = 0;
    stats[5] = 1;
  }
  else {
    stats[4] = 1;
    stats[5] = 0;
  }
  //Soil
  if((moisture_val < 850) || (moisture_val > 1000)) {
    stats[6] = 0;
    stats[7] = 1;
  }
  else {
    stats[6] = 1;
    stats[7] = 0;
  }
  ////Checks if update to control panel is needed
  //And copies 'stats' string charachter by character to 'previousstats'
  if(stats != previousstats) {
    led();
    for(int z = 1; z<15; z++) {
      previousstats[z] = stats[z];
    }
  }
  
  
}


////Changes stats string to bits and shifts them out
void led() {
  byte bitBuffer1 = 0;
  bitWrite(bitBuffer1, 1, stats[1]);
  bitWrite(bitBuffer1, 2, stats[2]);
  bitWrite(bitBuffer1, 3, stats[3]);
  bitWrite(bitBuffer1, 4, stats[4]);
  bitWrite(bitBuffer1, 5, stats[5]);
  bitWrite(bitBuffer1, 6, stats[6]);
  bitWrite(bitBuffer1, 7, stats[7]);
  byte bitBuffer2 = 0;
  bitWrite(bitBuffer2, 1, stats[8]);
  bitWrite(bitBuffer2, 2, stats[9]);
  bitWrite(bitBuffer2, 3, stats[10]);
  bitWrite(bitBuffer2, 4, stats[11]);
  bitWrite(bitBuffer2, 5, stats[12]);
  bitWrite(bitBuffer2, 6, stats[13]);
  bitWrite(bitBuffer2, 7, stats[14]);
  digitalWrite(latch, LOW);
  shiftOut(data, clock, MSBFIRST, bitBuffer2);
  shiftOut(data, clock, MSBFIRST, bitBuffer1);
  digitalWrite(latch, HIGH);
}

And as always all suggestions are welcome