*Compilation error: 'class BlynkWifi' has no member named 'notify'*

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

int led = 13; // Connected to D7 pin of NodeMCU
int flame_sensor = 12; //Connected to D6 pin of NodeMCU
int buzzer = 4; //Connected to D2 pin of NodeMCU
int relay = 5; //Connected to D1 pin of NodeMCU
int smoke_sensor = A0; //Connected to A0 pin of NodeMCU
int temp_smoke_sensor;
int flame_sensor_read;

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "SSIDIOT"; //Enter the wifi name
char pass[] = "SSIDIOT";// Enter the wifi password

void setup()
{
 pinMode(led, OUTPUT);
 pinMode(flame_sensor, INPUT);
 pinMode(buzzer, OUTPUT);
 pinMode(relay, OUTPUT);
 pinMode(smoke_sensor, INPUT);
 
 digitalWrite(led, LOW);
 digitalWrite(buzzer, LOW);
 digitalWrite(relay, LOW);
 // Debug console
 Serial.begin(9600);
 Blynk.begin(auth, ssid, pass);
}

void loop() 
{
 flame_sensor_read = digitalRead(flame_sensor); //reading the sensor data on A0 pin
 Blynk.virtualWrite(V0, flame_sensor_read); //sending data to Blynk
 Serial.print("Flame Status:");
 Serial.println(flame_sensor_read);

 int led_status = digitalRead(led);
 if (led_status == HIGH)
 {
  Blynk.virtualWrite(V1, 255);
 }
 else
 {
  Blynk.virtualWrite(V1, 0);
 }
 
 temp_smoke_sensor = analogRead(smoke_sensor);
 Blynk.virtualWrite(V2, temp_smoke_sensor);
 Serial.print("Current Gas Level:");
 Serial.println(temp_smoke_sensor);
 if (temp_smoke_sensor > 500)
 {
   digitalWrite(led, HIGH);
   digitalWrite(buzzer, HIGH);
   digitalWrite(relay, HIGH);
   Blynk.notify("Alert Smoke Detected");  
   }
 else
   {
    digitalWrite(led, LOW);
    digitalWrite(buzzer, LOW);
    digitalWrite(relay, LOW);
   }

if (flame_sensor_read == 0)
   {
   //Blynk.virtualWrite(V1, 255);
   digitalWrite(led, HIGH);
   digitalWrite(buzzer, HIGH);
   digitalWrite(relay, HIGH);
   Blynk.notify("Alert Fire Detected");  
   }
 else
     {
     digitalWrite(led, LOW);
     digitalWrite(buzzer, LOW);
     digitalWrite(relay, LOW);
     }
     delay(500);
     Blynk.run();
}

getting this error msg at end after verifying
C:\Users\om\Downloads\nm\nm.ino: In function ‘void loop()’:
C:\Users\om\Downloads\nm\nm.ino:65:11: error: ‘class BlynkWifi’ has no member named ‘notify’

  • 65 | Blynk.notify(“Alert Smoke Detected”);*
  •  |           ^~~~~~*
    

C:\Users\om\Downloads\nm\nm.ino:80:11: error: ‘class BlynkWifi’ has no member named ‘notify’

  • 80 | Blynk.notify(“Alert Fire Detected”);*
  •  |           ^~~~~~*
    

*Using library ESP8266WiFi at version 1.0 in folder: C:\Users\om\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi *
*Using library Blynk at version 1.2.0 in folder: C:\Users\om\Documents\Arduino\libraries\Blynk *
exit status 1

Compilation error: ‘class BlynkWifi’ has no member named ‘notify’

can any one helppp

Are you using Blynk Legacy on your own local server, or Blynk IoT?

Pete.

I am using Blynk IoT

In that case you are missing the thee lines of firmware configuration copied from the device info screen of the web console, and you should delete this line…

and you should change this…

to this…
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

You also need to sort-out your void loop to remove the clutter, and the delays.read this for more info…

As far as your compilation errors are concerned, Blynk.notify is a Legacy command and is replaced in Blynk IoT with Events.
However, you are limited to logging a maximum of 100 events per 24 hours, and your code will keep logging events all the time that an alert situation exists. You need to use a flag variable to overcome this. Read this tutorial for more info on Events, Notificatiins and flag variables…

Pete.

1 Like

Blynk.notify has been replaced with Blynk.logEvent

2 Likes

Is Blynk.logEvent work with Blynk Legacy and local server any more?

Blynk.logEvent is a Blynk IoT command and was never part of the Legacy syntax.

Pete.

yep, thank a lot Pete

[Unformatted code removed by moderator]

error coming “class BlynkWifi’ has no member named ‘notify’”
pls helpp

@harindu Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Pete.

@harindu you haven’t been back to fix your unformatted code, so it has been removed.
I’m closing this solved topic, so if you need assistance with your problem then I’d suggest that you create a new “Need help…” topic, but before you do that you should read this…

Pete.