"compilation error: 'class BlynkWifi' has no member named 'notify'"

• Hardware model: Node Mcu ESP8266 with WiFi

#define BLYNK_TEMPLATE_ID “TMPL6qM2TAJLq”
#define BLYNK_TEMPLATE_NAME “IOT Plant Monitoring”
#define BLYNK_AUTH_TOKEN “------”
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>
#define BLYNK_PRINT Serial
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 18 //D3
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

char ssid = “MiFi-32BC”; //WiFi SSID
char pass = “1234567890”; //WiFi Password

#define sensorPin 17 //D4
int sensorState = 0;
int lastState = 0;
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature();

if (isnan(h) || isnan(t)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}

Blynk.virtualWrite(V5, h); //V5 is for Humidity
Blynk.virtualWrite(V6, t); //V6 is for Temperature
}
void setup()
{
Serial.begin(9600);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
pinMode(sensorPin, INPUT);
dht.begin();

timer.setInterval(1000L, sendSensor);
Serial.begin(115200);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
sensors.begin();
}
int sensor=0;
void sendTemps()
{
sensor=analogRead(A0);
sensors.requestTemperatures();
float temp = sensors.getTempCByIndex(0);
Serial.println(temp);
Serial.println(sensor);
Blynk.virtualWrite(V1, temp);
Blynk.virtualWrite(V2,sensor);
delay(1000);
}
void loop()
{
Blynk.run();
timer.run();
sendTemps();
sensorState = digitalRead(sensorPin);
Serial.println(sensorState);

if (sensorState == 1 && lastState == 0) {
Serial.println(“needs water, send notification”);
Blynk.notify(“Water your plants”);
lastState = 1;
delay(1000);
//send notification

} 
else if (sensorState == 1 && lastState == 1) {
  //do nothing, has not been watered yet
Serial.println("has not been watered yet");
delay(1000);
}
else {
  //st
  Serial.println("does not need water");
  lastState = 0;
  delay(1000);
}

delay(100);

}

Please help me. Cannot solve this problem for long.

@Jerry 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.

Post removed by moderator as it gives incorrect advice

You’re getting this compilation error because Blynk.notify() is a Legacy command which is no longer supported in Blynk IoT.

Blynk IoT handles notifications as part of the Blynk.logEvent command. More information in the documentation and here…

In addition, your code has quite a few other problems…

  1. you should be using BlynkTimer instead of SimpleTimer.

  2. you have two Serial.begin() commands in your void setup.

  3. your void loop is very cluttered, and you’re using blocking delay() commands to regulate the frequency of your sensor readings. Instead, your void loop should just have the Blynk.run() and timer.run() commands in it, and the other code should be in a separate function which is called using a BlynkTimer. Read this for more information…

Pete.