Offline timer automation, looking for suggestion

Hello there,

A little background on the situation, i have an aquarium in my retreat cabin and i’m planning to have the fishes fed automatically via scheduler and/or by push of a button. Before this, my fishes are fed using timed auto feeder but sometimes the fishes don’t eat so much. My cabin has wifi running on mobile data mainly for cctv however the internet transmission is not so good

I’ve achieved this easily using blynk auto program with my (nodemcu + relay and bypassed auto feeder) +blynk timer. But failing to plan is planning to fail. The internet connection is not so good there, so if the device dc for any reason, my fishes would not get their food as blynk timer relies on internet connection.

I’ve read TaskScheduler but it only runs on schedule, i would like to have a function for push button feeding. So i was thinking of using TaskScheduler and use blynk input fields to set the timer. Maybe assigning vpin for the field and that device would take the value and plug it into the TaskScheduler. That way, i can still use blynk to control my fish feeder.

Is this workable or is there any other option for using blynk?

Thanks

Hi,

Reviving this thread, i’m looking for the same thing and there aren’t many cases searchable online.

What OP and i are looking for is whether a Nodemcu device can contain scheduler functions which run independently of teh blynk server. This way, vital activities can still occur When a connection is established, timers and loggers all update, but the system is still primed to continue on in the event of the next brownout.

So, if blynk=available, start and stop timers are downloaded from the blynk server to turn relays on and off independently at desired intervals. One blynk timer could turn on relay every day at 1pm, one could log temperature every 5 minutes, and even complex ones every 2 hours, but only during daylight (to run a pump), etc.
If blynk is not available, hardcoded values in the sketch are used by default. One timer controls a blynk.reconnect function to constantly poll for network. A battery powered external RTC could keep the device on schedule during brown and blackout. Once the connection is made, the hardcoded values are updated with the active blynk values if the user wanted any changes and the systems goes on chugging with the updated timings. In this manner, the device benefits from the blynk connection but is not dependent on it to maintain operations for days or weeks of spotty internet.

Thank you

1 Like

It is the right way.
I use it to control my home fuel boiler and fuel tank level.
No matter if server or WiFi are down.

1 Like

Would you like to try using this:

It’s written with this No matter if server or WiFi are down in mind.

Check the function checkstatus() in the examples

  if ((millis() > checkstatus_timeout) || (checkstatus_timeout == 0))
  {
    // report status to Blynk
    if (Blynk.connected())
    {
      set_led(LOW);
      led_ticker.once_ms(111, set_led, (byte) HIGH);

      Serial.println("B");
    }
    else
    {
      // Any function here will be executed with or without WiFi/Blynk connected
      Serial.println("F");
    }

    checkstatus_timeout = millis() + STATUS_CHECK_INTERVAL;
  }

Ok, thank you everyone.
I’m going to leave the network reconnection as a separate timer so that background operations can occur during an outtage.

However, i have a data logger collecting temps every few minutes and sensd them to a virtual pin. The blynk app is graphing all my temps with the server timestamp in the x-axis. If the network goes down, i want to continue to collect data and then re-establish my data logger when network returns. Say i collect 100 temperature points along with some external RTC time stamp for each point. I will save the the data locally to the NodeMCU memory with in a 2x100 array. When network comes back up, i want to send the collected array back to the server to integrate back into the blynk graph to create a continuous temperature profile with the online points. Will the blynk graph simply understand this input, or will i need to update the entire plot using my 2 dimensional array?

You can’t currently upload historic data to the Blynk server.

Pete.