And to think I questioned whether posting here would be of any help or if I would just receive smart ass comments...
Code that I meant to turn relays on and off:
if (LightOn == false) {
//Calculate current time + delay minuts (Sleep variable time) to give a wide window making sure we can hit the start time.
//If the program starts after this window then the relay will not start until StartHr & StartMin the following day.
DelayFuture = CalcFuture(Start,0L,0L,Sleep,0L);
if ((int)now.hour() >= StartHrRelay_3 && (int)now.hour() <= DelayFuture.hour() && (int)now.minute() >= StartMinRelay_3 && (int)now.minute() <= DelayFuture.minute()) {
//Set future DateTime used to determine the duration of light on time
future = CalcFuture(now,DurDay3,DurHour3,DurMinute3,DurSecond3);
//Turn on light
LightOn = true;
digitalWrite(Relay_3, RELAY_ON);
Serial.println("\r\nLight On\r\n");
}
}
else {
//Check current time - turn off light when conditions are met
if ((int)now.day() >= (int)future.day() && (int)now.hour() >= (int)future.hour() && (int)now.minute() >= (int)future.minute()) {
//Turn off light
LightOn = false;
digitalWrite(Relay_3, RELAY_OFF);
Serial.print("\r\nLight Off\r\n");
}
}
delay((Sleep*MultiMinute));
//Check status of light
if (LightOn == false) {
//Calculate current time + delay minuts (Sleep variable time) to give a wide window making sure we can hit the start time.
//If the program starts after this window then the relay will not start until StartHr & StartMin the following day.
DelayFuture = CalcFuture(Start,0L,0L,Sleep,0L);
if ((int)now.hour() >= StartHrRelay_4 && (int)now.hour() <= DelayFuture.hour() && (int)now.minute() >= StartMinRelay_4 && (int)now.minute() <= DelayFuture.minute()) {
//Set future DateTime used to determine the duration of light on time
future = CalcFuture(now,DurDay4,DurHour4,DurMinute4,DurSecond4);
//Turn on light
LightOn = true;
digitalWrite(Relay_4, RELAY_ON);
Serial.println("\r\nLight On\r\n");
}
}
else {
//Check current time - turn off light when conditions are met
if ((int)now.day() >= (int)future.day() && (int)now.hour() >= (int)future.hour() && (int)now.minute() >= (int)future.minute()) {
//Turn off light
LightOn = false;
digitalWrite(Relay_4, RELAY_OFF);
Serial.print("\r\nLight Off\r\n");
}
}
delay((Sleep*MultiMinute));
//Chimney fan (Relay_1) on-off temperature
if (dht.readTemperature() >= 20) {
digitalWrite(Relay_1, RELAY_OFF);
}
else if (dht.readTemperature() < 18) {
digitalWrite(Relay_1, RELAY_ON);
}
//Window fan (Relay_2) on-off temperature
if (dht.readTemperature() >= 25) {
digitalWrite(Relay_2, RELAY_OFF);
}
else if (dht.readTemperature() < 23) {
digitalWrite(Relay_2, RELAY_ON);
}