Offline code in blynk project

Hello, I am trying to make my curtains open and close automatic with google assistant. Everything works but it only works over internet. Now I am afraid if the internet ever gets down I can’t open or close my curtains anymore. Is there a way to implement actual pushbuttons so i can open and close them without using the internet?
I am using a nodemcu and a 4 channel relay and the program Arduino.
I am only using virtual pin 8 and 9 to open close the curtains. The other virtual pins are for testing the relay.
I actually just want to be able to play the code in virtual pins 8 and 9 by pressing actual pushbuttons without the need to use the internet. So they will still work when internet isn’t available.
This is the code I use at the moment.


#define BLYNK_PRINT Serial

#define D0 16
#define D1 5
#define D2 4
#define D3 0
#define D4 2
#define D5 14
#define D6 12
#define D7 13

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

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XXXXXXXXXXXXXXXX";

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

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
  pinMode(D1,OUTPUT);
  pinMode(D2,OUTPUT);
  pinMode(D3,OUTPUT);
  pinMode(D5,OUTPUT);
  digitalWrite(D1, HIGH);
  digitalWrite(D2, HIGH);
  digitalWrite(D3, HIGH);
  digitalWrite(D5, HIGH);
}

BLYNK_WRITE(V0)// 1 on
{
int buttonState = param.asInt();
if (buttonState == 1){
  Serial.println("1 on");
  digitalWrite(D1, LOW);
  }
}

BLYNK_WRITE(V1)// 1 off
{
int buttonState = param.asInt();
if (buttonState == 1){
  Serial.println("1 off");
  digitalWrite(D1, HIGH);
  }
}

BLYNK_WRITE(V2)// 2 on
{
int buttonState = param.asInt();
if (buttonState == 1){
  Serial.println("2 on");
  digitalWrite(D2, LOW);
  }
}

BLYNK_WRITE(V3)// 2 off
{
int buttonState = param.asInt();
if (buttonState == 1){
  Serial.println("2 off");
  digitalWrite(D2, HIGH);
  }
}

BLYNK_WRITE(V4)// 3 on
{
int buttonState = param.asInt();
if (buttonState == 1){
  Serial.println("3 on");
  digitalWrite(D3, LOW);
  }
}

BLYNK_WRITE(V5)// 3 off
{
int buttonState = param.asInt();
if (buttonState == 1){
  Serial.println("3 off");
  digitalWrite(D3, HIGH);
  }
}

BLYNK_WRITE(V6)// 4 on
{
int buttonState = param.asInt();
if (buttonState == 1){
  Serial.println("4 on");
  digitalWrite(D5, LOW);
  }
}

BLYNK_WRITE(V7)// 4 off
{
int buttonState = param.asInt();
if (buttonState == 1){
  Serial.println("4 off");
  digitalWrite(D5, HIGH);
  }
}

BLYNK_WRITE(V8)//open
{
int buttonState = param.asInt();
if (buttonState == 1){
  Serial.println("open");
  digitalWrite(D5, LOW);
  digitalWrite(D3,LOW);
  delay(3000);
  digitalWrite(D5, HIGH);
  digitalWrite(D3,HIGH);
  }
}

BLYNK_WRITE(V9)//close
{
int buttonState = param.asInt();
if (buttonState == 1){
  Serial.println("closing");
  digitalWrite(D2, LOW);
  digitalWrite(D1,LOW);
  delay(3000);
  digitalWrite(D2, HIGH);
  digitalWrite(D1,HIGH);
  }
  
}

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

Thanks in advance,
Niels

There is an example in Sketch Builder…
https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=More%2FSync%2FSyncPhysicalButton

ETA - You will also need to stop using Bynk.begin, as it’s a blocking function and the code will never progress beyond there if it can’t connect to the Internet.
Use Blynk.config and Blynk.connect instead, and initialise your own WiFi connection. Search the forum for examples.

Pete.