Timer not working

hello
i am very new to all of this but, i am getting frustrated so i figured i try to ask for assistance. i am trying to get my timer to work and i am having no luck. if i try using a button, everything works exactly as i wish but, timer is doing nothing. thanks in advance!

#define BLYNK_PRINT Serial // Enables Serial Monitor
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <Time.h>
#include <TimeLib.h>

char auth[] = “**************”;

void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth, “*************”, “*****”);
}

BLYNK_WRITE(V5)
{
// You’ll get HIGH/1 at startTime and LOW/0 at stopTime.
// this method will be triggered every day
// until you remove widget or stop project or
// clean stop/start fields of widget
//Serial.print("Got a value: ");
//Serial.println(param.asStr());
if (param.asInt() == 0) {
digitalWrite(5, HIGH);
} else {
digitalWrite(5, LOW);
}
}

void loop()
{
Blynk.run(); // All the Blynk Magic happens here…

// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}

Hello. You have 2 things to check.

  • Make sure device is online in order to be triggered with timer;
  • Make sure your time is correct;

Also for debug you may add logging to serial so you could be sure.

Maybe I’m overlooking something completely obvious but, if I’m able to control the device from a button within the app through wifi, wouldn’t that mean it’s online?

@Rhardin80 yes you are overlooking the fact that for the Timer to work your device must be online precisely at the on or off times. Devices disconnect and reconnect for various reasons.

Please edit your first post with </> so we can read it.

What hardware are you using including Smartphone type?

As pointed out by @Dmitriy it could simply be that the time on your phone is not accurate. Few minutes out and you will miss the trigger or expect it before it is actually due. That is you need to set your phone to ‘internet’ time or very close to real time. Some of my devices were out by 2 or 3 minutes when I first started using the Timer widget which led me to think the widget simply didn’t work, which is not the case.