noob -- aquarium controller w TinyRTC

trying to create aquarium controller for switching on lights. Tiny RTC works good, display time and temp, temperature controlled relay works. when I run this code the relay on the timer (pin 9) is always on.

#include <OneWireTempSensor.h>
#include <Wire.h>
#include "RTClib.h"
#include <OneWire.h>
#include <LiquidCrystal.h>
#include <Time.h>
#include <TimeAlarms.h>
int DS18S20_Pin = 7; //temp
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

RTC_DS1307 RTC; //timer

OneWire ds(DS18S20_Pin); //temp

void setup() {

Wire.begin();
RTC.begin();
lcd.begin(20, 4);
lcd.print("Time :");
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
Alarm.alarmRepeat(8,30,0, MorningAlarm); //create morning alarm
Alarm.alarmRepeat(15,0,0, EveAlarm); // create evening alarm
}

void loop() {
float temperature = getTemp();
float tempF = (temperature * 9.0)/ 5.0 + 32.0;

DateTime now = RTC.now();

lcd.setCursor(7, 0);
if ( now.hour() < 10) {
lcd.print("0");
}
lcd.print(now.hour(), DEC);
lcd.print(':');
if ( now.minute() < 10) {
lcd.print("0");
}
lcd.print(now.minute(), DEC);
lcd.print(':');
if ( now.second() < 10) {
lcd.print("0");
}
lcd.print(now.second(), DEC);

lcd.setCursor(0, 1);
lcd.print("Temp : ");
lcd.print(tempF);
lcd.print(" *F ");
lcd.setCursor(0, 2);
lcd.print("Temp : ");
lcd.print(temperature);
lcd.print(" *C ");

if ( tempF < 78) { //This line turns on pin 8 @78F
digitalWrite(8, HIGH);
}
if ( tempF > 77) { //This line turns off pin 8 @77F
digitalWrite(8, LOW);
}
}

void MorningAlarm(){
digitalWrite(9, HIGH); // should turn on pin 9
}

void EveAlarm(){
digitalWrite(9, LOW); // should turn off pin 9
}
float getTemp(){
//returns the temperature from one DS18S20 in DEG Celsius

byte data[12];
byte addr[8];

if ( !ds.search(addr)) {
//no more sensors on chain, reset search
ds.reset_search();
return -1000;
}

ds.reset();
ds.select(addr);
ds.write(0x44,1); // start conversion, with parasite power on at the end

byte present = ds.reset();
ds.select(addr);
ds.write(0xBE); // Read Scratchpad

for (int i = 0; i < 9; i++) { // we need 9 bytes
data = ds.read();
}
ds.reset_search();
byte MSB = data[1];
byte LSB = data[0];
float tempRead = ((MSB << 8) | LSB); //using two's compliment
float TemperatureSum = tempRead / 16;
return TemperatureSum;
}

First, CODE TAGS!

Second:

Alarm.alarmRepeat(8,30,0, MorningAlarm); //create morning alarm
Alarm.alarmRepeat(5,0,0, EveAlarm); // create evening alarm

I'm not familiar with RTClib, but do you want the EveningAlarm to be 5 am or 5 pm? 5 pm is probably supposed to be 17 hours.

I've reduced the code to the part that doesn't work the relay never turns off...

#include <Wire.h>
#include "RTClib.h"
#include <LiquidCrystal.h>
#include <Time.h>
#include <TimeAlarms.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // for LCD
RTC_DS1307 RTC; // for clock
 
void setup () {
    Wire.begin(); // for clock
    RTC.begin(); // for clock
    lcd.begin(20, 4); // for LCD
    pinMode(9, OUTPUT); // Set Pin 9 to Output

Alarm.alarmRepeat(2,25,0, MorningAlarm);  // 8:30am every day
Alarm.alarmRepeat(2,24,0, EveAlarm);  // 5:45pm every day 
}
 
void loop () {

  DateTime now = RTC.now(); // for time diplay to LCD
    
    lcd.setCursor(0, 0);         // following lines display time on LCD
    lcd.print(now.year(), DEC);
    lcd.print('/');
    lcd.print(now.month(), DEC);
    lcd.print('/');
    lcd.print(now.day(), DEC);
    lcd.setCursor(0, 1);
    lcd.print(now.hour(), DEC);
    lcd.print(':');
    if ( now.minute() < 10) {
    lcd.print("0");
}
    lcd.print(now.minute(), DEC);
    lcd.print(':');
    if ( now.second() < 10) {
    lcd.print("0");
}
    lcd.print(now.second(), DEC);
    
}
void MorningAlarm(){
  digitalWrite(9, HIGH); // should turn on pin 9 
}

void EveAlarm(){
  digitalWrite(9, LOW); // should turn off pin 9
}

It looks very like you haven't got the alarms set correctly.

Can you explain the different parts of Alarm.alarmRepeat(2,25,0, MorningAlarm);  // 8:30am every day

Does the alarm use the RTC? If so, how does it know it is there? If not, how does it keep time?

Can you delete all the LCD code and just concentrate on getting the alarm to work with debug data in the Serial Monitor?

...R