Class BlynkWifi' has no member named 'logEvent'

can anyone help me to fix this error?
Few weeks back the same code was working.

Post your whole sketch please.

#define BLYNK_TEMPLATE_ID "TMPLMzw1T0sK"
#define BLYNK_DEVICE_NAME "Temperature Alert"
#define BLYNK_AUTH_TOKEN "ssEo45x67jFedX1b_6dF79GK"

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

 

#include <DHT.h>


char auth[] = BLYNK_AUTH_TOKEN;

char ssid[] = "wifi username";  // type your wifi name
char pass[] = "password";  // type your wifi password

#define DHTPIN 21          // Mention the digital pin where you connected 
#define DHTTYPE DHT11     // DHT 11  
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

void sendSensor(){
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Serial.println(t);
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
    Serial.print("Temperature : ");
    Serial.print(t);
    Serial.print("    Humidity : ");
    Serial.println(h);


  if(t > 30){
    Blynk.email("shameer50@gmail.com", "Alert", "Temperature over 28C!");
    Blynk.logEvent("temp_alert");
  }
}

void setup(){
   Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  dht.begin();
  timer.setInterval(2500L, sendSensor);
}

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

If you scroll-up through your compiler messages, are there any other error messages before this one?

Pete.

No. this is the only message I am getting

Arduino: 1.8.16 (Windows 10), Board: “NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200”

D:\Documents\docs\Arduino\1-trials\temperature-alert-notification-blynk-iot\temperature-alert-notification-blynk-iot.ino: In function ‘void sendSensor()’:

temperature-alert-notification-blynk-iot:46:11: error: ‘class BlynkWifi’ has no member named ‘logEvent’

46 | Blynk.logEvent(“temp_alert”);

  |           ^~~~~~~~

exit status 1

‘class BlynkWifi’ has no member named ‘logEvent’

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Are you using the latest version of blynk library ?

1 Like

Thank you Sir. I updated the library to latest version and changed the port. Now it is working

1 Like

One more thing

You should use blynk.logEvent only as mentioned in the documentation

1 Like

Thank you

1 Like