I want to send a reminder every 6 months to soil fertilize

this is my code ,but it dose not work when i add this condition

 if ( String currentDate = String(day(8)) + "/" + month(5) + "/" + year(2022))

and this is my code :

#define BLYNK_TEMPLATE_ID "*****"
#define BLYNK_DEVICE_NAME "*****"
#define BLYNK_AUTH_TOKEN "*****"
#define BLYNK_PRINT Serial

#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <SoftwareSerial.h>

SoftwareSerial EspSerial(2, 3); // RX, TX

#define ESP8266_BAUD 9600
ESP8266 wifi(&EspSerial);

char auth[] = "*****" ;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "*****";
char pass[] = "*****";

BlynkTimer timer;

WidgetRTC rtc;

void clockDisplay()
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details
String currentTime = String(hour()) + ":" + minute() + ":" + second();
  String currentDate = String(day()) + "/" + month() + "/" + year();
  Serial.print ("Current time: ");
  Serial.print(" ");
  Blynk.virtualWrite(V1, currentTime);
  Blynk.virtualWrite(V2, currentDate);
void setup()

  Blynk.begin(auth, wifi, ssid, pass);

  setSyncInterval(10 * 60); // Sync interval in seconds (10 minutes)

  // Display digital clock every 10 seconds
  timer.setInterval(10000L, clockDisplay);

void loop()
 if ( String currentDate = String(day(8)) + "/" + month(5) + "/" + year(2022))

Please edit your post and add triple backticks ( ``` ) before and after your whole sketch.

oh okay and thank you

You should always keep your void loop clean, read this

Should be in your void clockDisplay function.

@John93 the code is nonsense. it shouldn’t be anywhere

I meant in general, you should Put the if statement in the same function instead of the void loop.

When you’re doing an if comparison between two variables, values etc you need to use == rather than =
By using = you have set the value of currentDate to the result of String(day(8)) + "/" + month(5) + "/" + year(2022)

However, this string constructor makes no sense anyway. You’d be far better using “8/5/22” as a string literal.
But of course, you’ll need to upload a new sketch every 6 months with a new reminder date!

Also, every time your void loop executes, or the timer that you use to call the code that you move out of your void loop executes, and that string comparison will evaluate as true, an event will be created and a notification will be sent.
Events are limited to one per minute, and are limited to 100 per day.
So, depending on how your alert is configured, you’ll get 100 alerts at 1 minute intervals, then you’ll be banned from logging anymore alerts for 24 hours…

You should read this…

And also look for a way to input a reminder date via the app or web dashboard rather than hard coding this data.


1 Like

I didn’t find any way to enter a reminder date I think I can only enter a time via the app but I don’t think I can enter a date, if you have a way for that pls tell me

It depends on your subscription type as to which widgets are available to you.


So far this condition is not working for me, I don’t know what the problem is, can you help me?

What condition?