Failing to get Blynk notifications on the app. Asking for some help

Trying to make a door sensor with a reed switch (usintg the D1 and GND pin) for my project, but no notifications show up. Asking for assistance. Below's my code:

#define BLYNK_TEMPLATE_ID "xxxxxxxxxxxx"
#define BLYNK_DEVICE_NAME "xxxxxxxxxxxxxxx"
#define BLYNK_AUTH_TOKEN "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

#define BLYNK_PRINT Serial

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

char auth[] = BLYNK_AUTH_TOKEN;

char ssid[] = "xxxxxxxxxxx"; 
char pass[] = "xxxxxxxxxx"; 

BlynkTimer timer;

int flag=0;
int ReedSwitch = 1;

void notifyOnButton(){
  int isButtonPressed = digitalRead(ReedSwitch);
  if (isButtonPressed == HIGH) {
    Serial.println("Someone Opened the door");
    Blynk.notify("Alert : Someone Opened the door");
    flag=1;
  }
  else if (isButtonPressed == LOW)
  {
    flag=0;
  }
  }

void setup() {
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  pinMode(ReedSwitch, INPUT_PULLUP);
  timer.setInterval(16000L, notifyOnButton); 
  
}

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

All those lines with xxxxxxxx in them. Are his not supposed to replace the string of xs with the real data for the device you are using?

1 Like

Thanks for the help Mike :+1:t5:. yes they I've filled them with the required info ( template id, device name and template, auth token,, ssid and pass key respectively) but still does't work.
Help take me through how to get a Blynk alert notification when a reed switch sensor is opened connected to a generic ESP8266 chip. :pray:t5:

Sorry, I know very little about the ESP8266 processor.

Throw some more prints in there, particularly in notifyOnButton to verify that it gets called and what the state of the switch is.

1 Like

Easy. Appreciate the help. Thank you.

Lemme try that

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.