Schedule the relay (run timer if blynk app goes to offline)

:thinking: As in the Blynk App, we can transfer the data via Virtual pin. (Like 0 or 1) & we can also set (Advance/Scheduled) timer for the same.

I've done the same thing but currently, it works only when my Mobile phone & NodeMCU both are connected to the internet.
What exactly I want is once we set the timer & after that even if phone's internet goes off but NodeMCU still works on that scheduled timer.

P.S. - Can we shoot the data in advance from the blynk app & it got store in NodeMCU or In Blynk's Cloud?

:point_right: what exactly I need: I’m want to schedule my relay at a certain time when I provided an ON /OFF time to relay from my blynk app. after providing ON/OFF time to relay then if my mobile phone doesn’t have internet connectivity and blynk app goes to Offline mode then it would work as provided time to ON/OFF relay ::means trigger the time from server:

https://docs.blynk.cc/#blynk-firmware-blynktimer

I really do t understand tour post.
You appear to be quoting someone else, but I have no idea who.

If you’re using a NodeMCU with Wi-Fi connection then it makes no difference if the phone is offline or not. In this scenario the Blynk server handles the scheduling, not the app.

Bluetooth is a different story, but you’ve not provided any info about your setup.

Pete.

1 Like

this timer works fine if a blynk app is online on my mobile phone but when I turn off my mobile phone internet connection then this timer is not working. ::my NodeMCU is connected to another WiFi to provide internet.

here is the simple code;

#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "XXXXXXXXXXXXXXXXXXXXXXXXX";
char ssid[] = "Your";
char pass[] = "Password";


void setup(){

  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);

pinMode(4,OUTPUT);

}

void loop(){
  Blynk.run();
}

BLYNK_WRITE(V0)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable

  Serial.println(pinValue);

  digitalWrite(4,pinValue);

}

I don’t get it. What you are using is not a timer, so it shouldn’t work regardless the app is connected or not. This widget is particularly used for passing time to hardware, but it can’t count the time passing. Or something has changed in Blynk in its usage?

you are right Marvin.
this timer runs even if blynk app is not connected.
I don’t understand his question and
his sketch is not the same as every of blynk user use with this timer widget.
Alexis

@marvin7 so why this widget have START AT time input and STOP AT time input ??

It really would help if you gave a clear statement about what you are trying to achieve and what issues you’re experiencing.

The idea behind the Time Input widget is that it is used as a way to enter a start and stop time via the app. This information is passed to the server, and it’s the server that manages the rest of the timing process.
Once the server begins doing this, it doesn’t matter if the app is online or not - the app plays no further part in the process (unless it’s necessary to change the start/stop time or other parameters).

If you’re having problems then it’s more likely to do with the way that you are receiving and processing the data from the server.

Have you looked at the documentation and the example sketches:

Pete.

Because those values are sent to hardware as different parameters and as such might be used for timing the hardware. There are some examples of working timers based on ‘time INPUT’ widget. Mine is a bit messy (?) as I tried to cope with different scenarios and I would try to manage them different way now, but it works OK so if you wish…

I’m not sure, if the time INPUT widget is by any means processed on server (perhaps time zone?) I think you had the TIMER widget in mind, but the ‘EVENTOR’ might be easier to use (or not :stuck_out_tongue:)