 // Check for turing on the light using the smart function
 void smartCheck() {
   unsigned long curTime = millis();
-  if (curTime > (lastCheck + interval) || lastCheck < curTime) {
+  if ((day() != lastDay)&&(curTime > (lastCheck + interval) || lastCheck < curTime)) {
     lastCheck = curTime;
     //Serial.println("Check");
     short currentLightValue = analogRead(ldrPin);

void onData(SocketIOClient client, char *data) {
  if (strstr(data, "Time:")) {
    timeUpdate(data + 5);
  } else {
    int lightNumber;

    // Light 1

    // Turn on the light
    if (strstr(data, "on")) {
      transmitter.sendUnit(lightNumber, true);
      // Enable this to update SmartValue updating, untested
      // updateSmartValues();
    } 
    else { // Turn off
      transmitter.sendUnit(lightNumber, false);
    }

