Timer for swimming pond

Hello,
i would like to create an automated program for turning on and off appliances for my swimming pond. I wrote a simple code that turns on and off an appliance at the time but I would like to control this over my phone and change the time of turning on or off. If I’m not mistaken, with my phone I have to really just change these numbers:

//FILTER+PUMP 8:30-20:30
const int OnHourFilter =[b] 8[/b];
const int OnMinFilter = [b]30[/b];
const int OffHourFilter = [b]20;[/b]
const int OffMinFilter = [b]30;[/b]

All these I would like to do over Wi-Fi with ESP8266 right?
Can seomeone help me how do I include this in the code.

MY CODE:

#include <DS3231.h>
#include <LiquidCrystal_I2C.h>

int Filter = 1;
int Pump = 2;
int Heater = 3;
int Skimmer = 4;
int Fountain = 5;
int Lights = 6;
int XMAS = 7;

LiquidCrystal_I2C lcd(0x27, 16, 2);

DS3231  rtc(SDA, SCL);
Time t;
//FILTER+PUMP 8:30-20:30
const int OnHourFilter = 8;
const int OnMinFilter = 30;
const int OffHourFilter = 20;
const int OffMinFilter = 30;

//HEATER 10:30-17.30 10:20
const int OnHourHeater = 10;
const int OnMinHeater = 30;
const int OffHourHeater = 17;
const int OffMinHeater = 30;

//Skimmer   4:2
const int OnHourSkimmer = 8;
const int OnMinSkimmer = 30;
const int OffHourSkimmer = 20;
const int OffMinSkimmer = 30;

//Fountain 10:30-20:30
const int OnHourFountain = 10;
const int OnMinFountain = 30;
const int OffHourFountain = 20;
const int OffMinFountain = 30;


//Lights 21:o0-23:30
const int OnHourLights1 = 21;
const int OnMinLights1 = 00;
const int OffHourLights1 = 23;
const int OffMinLights1 = 30;

const int OnHourLights2 = 4;
const int OnMinLights2 = 00;
const int OffHourLights2 = 5;
const int OffMinLights2 = 30;

//XMAS 17:00-00:30
const int OnHourXMAS = 17;
const int OnMinXMAS = 00;
const int OffHourXMAS = 00;
const int OffMinXMAS = 30;

void setup() {
  Serial.begin(115200);
  rtc.begin();
  lcd.begin();
  lcd.backlight();
  pinMode(Filter, OUTPUT);
  digitalWrite(Filter, HIGH);
  pinMode(Pump, OUTPUT);
  digitalWrite(Pump, HIGH);
  pinMode(Heater, OUTPUT);
  digitalWrite(Heater, HIGH);
  pinMode(Skimmer, OUTPUT);
  digitalWrite(Skimmer, HIGH);
  pinMode(Fountain, OUTPUT);
  digitalWrite(Fountain, HIGH);
  pinMode(Lights, OUTPUT);
  digitalWrite(Lights, HIGH);
}

void loop() {
  t = rtc.getTime();
  Serial.print(t.hour);
  lcd.setCursor(0, 0);
  lcd.print(t.hour);
  Serial.print(" hour(s), ");
  Serial.print(t.min);
  lcd.setCursor(4, 0);
  lcd.print(t.min);
  Serial.print(" minute(s)");
  Serial.println(" ");
  lcd.setCursor(3, 0);
  lcd.print(":");
  delay (1000);

  //Filter+pump
  if (t.hour == OnHourFilter && t.min == OnMinFilter) {
    digitalWrite(Filter, LOW);
    digitalWrite(Pump, LOW);

  }

  else if (t.hour == OffHourFilter && t.min == OffMinFilter) {
    digitalWrite(Filter, HIGH);
    digitalWrite(Pump, HIGH);
  }


  //Heater
  if (t.hour == OnHourHeater && t.min == OnMinHeater) {
    digitalWrite(Heater, LOW);

  }

  else if (t.hour == OffHourHeater && t.min == OffMinHeater) {
    digitalWrite(Filter, HIGH);
  }

  //Skimmer
  if (t.hour == OnHourSkimmer && t.min == OnMinSkimmer) {
    digitalWrite(Skimmer, LOW);

  }

  else if (t.hour == OffHourSkimmer && t.min == OffMinSkimmer) {
    digitalWrite(Skimmer, HIGH);
  }

  //Fountain
  if (t.hour == OnHourFountain && t.min == OnMinFountain) {
    digitalWrite(Skimmer, LOW);
  }

  else if (t.hour == OffHourFountain && t.min == OffMinFountain) {
    digitalWrite(Skimmer, HIGH);
  }

  //Lights
  if (t.hour == OnHourLights1 && t.min == OnMinLights1) {
    digitalWrite(Skimmer, LOW);
  }

  else if (t.hour == OffHourLights1 && t.min == OffMinLights1) {
    digitalWrite(Skimmer, HIGH);
  }
  if (t.hour == OnHourLights2 && t.min == OnMinLights2) {
    digitalWrite(Skimmer, LOW);
  }

  else if (t.hour == OffHourLights2 && t.min == OffMinLights2) {
    digitalWrite(Skimmer, HIGH);
  }


  //XMAS
  if (t.hour == OnHourXMAS && t.min == OnMinXMAS) {
    digitalWrite(Skimmer, LOW);
  }

  else if (t.hour == OffHourXMAS && t.min == OffMinXMAS) {
    digitalWrite(Skimmer, HIGH);
  }

}

TIMER.ino (2.75 KB)

To make it easy for people to help you please modify your post and use the code button

so your code 
looks like this

and is easy to copy to a text editor. See How to use the Forum

Also please use the AutoFormat tool to indent your code consistently for easier reading.

...R

If you use an esp based board, you don't need an RTC.

Have a look at "Blynk". You can easily build a phone app with that, and it takes care of all the communications between the app and the Arduino, from anywhere in the world.

eera: All these I would like to do over Wi-Fi with ESP8266 right? Can seomeone help me how do I include this in the code.

I suggest you leave your existing code on one side for the moment and write a short separate program to learn how to send data using WiFi.

I presume you will need to create a simple web-server with the Arduino / ESP8266 which can be accessed with the browser in your phone. There are probably many online examples to get you started with that.

...R PS ... I'm not familiar with Blynk - it may be a simpler option - but it does require access to the internet whereas a simple Arduino based webserver can be accessed even if there is no internet connection.

Robin2: I suggest you leave your existing code on one side for the moment and write a short separate program to learn how to send data using WiFi.

I presume you will need to create a simple web-server with the Arduino / ESP8266 which can be accessed with the browser in your phone. There are probably many online examples to get you started with that.

...R PS ... I'm not familiar with Blynk - it may be a simpler option - but it does require access to the internet whereas a simple Arduino based webserver can be accessed even if there is no internet connection.

I will first create simple web-server and then probably move one to "Blynk", because I would like to control that from anywhere in the world. But how do I tell which values to change?

Thanks

Robin2: PS ... I'm not familiar with Blynk - it may be a simpler option - but it does require access to the internet whereas a simple Arduino based webserver can be accessed even if there is no internet connection.

True, but if you have to be in WiFi range of the pool, especially if the esp is acting as an AP, you might as well walk over and press a button.

Yes, Blynk should be simpler than setting up the esp as web server. So unless you want to learn about using esp as web server, HTTP protocol, GET/POST etc, which is interesting/educational, try Blynk first.

eera: But how do I tell which values to change?

You can put a Timer widget on your Blynk app which allows you to set start and stop times. At those times, a "virtual pin" in your Arduino code will change from LOW to HIGH, so it couldn't be simpler. It will even work automatically when your phone is not connected to Blynk.