Blynk Event limitation

hello. i need help in notifications in blynk by using eventlog. it works 2 times but after that it doesnt give notifications anymore


its like this.
please help

it says the event limit has been reached but through searching, it is said that we can receive 100 notifications a day.

im using the free version is that the reason? free version is limited to 2 notifications per day only? and the 100 notifications a day is for plus and pro?

The free plan, plus plan, and pro plan have the same limitation (100 events per device per day).

Posting your whole sketch might help.

Hi!
this is my whole sketch
[Unformatted code removed by moderator]

im using HC SR501 as motion sensor and if my understanding is correct, my code reads the sensor every 10 seconds and everytime it reads, it sends notification to blynk if motion has been detected and if not, it will just show motion absent in serial (its the reason why the event log code is under the if command - if my understanding is correct)

thankyou for your response :slight_smile:

Please edit your post, and add triple backticks ``` before and after your whole sketch.

Hi!


this is my whole sketch
int Status = 12; // Digital pin D6

int sensor = 13; // Digital pin D7

// This function creates the timer object. It’s part of Blynk library

BlynkTimer timer;

void setup() {

Serial.begin(9600);

//Connecting to Blynk Cloud

Blynk.begin(auth, ssid, pass);

// Setting interval to send data to Blynk Cloud to 1000ms.

// It means that data will be sent every second

timer.setInterval(10000L, myTimer);

pinMode(sensor, INPUT); // declare sensor as input

pinMode(Status, OUTPUT); // declare LED as output

}

void loop() {

Blynk.run();

timer.run();

}

void myTimer()

{

sensor = digitalRead(13);

if(sensor == HIGH) {

  digitalWrite (Status, HIGH);

  Serial.println("Motion detected!");

  Blynk.logEvent("motion_detected");

}

else {

  digitalWrite (Status, LOW);

  Serial.println("Motion absent!");

  return;

  }
// This function describes what will happen with each timer tick

// e.g. writing sensor value to datastream V0

Blynk.virtualWrite(V0, sensor);

}

im using HC SR501 as motion sensor and if my understanding is correct, my code reads the sensor every 10 seconds and everytime it reads, it sends notification to blynk if motion has been detected and if not, it will just show motion absent in serial (its the reason why the event log code is under the if command - if my understanding is correct)

thankyou for your response :slight_smile:

Hi here’s the edited with triple `

I don’t think that it is!
If you want to avoid posting sensitive information such as auth tokens and WiFi passwords then rather than leaving those lines of code out of your sketch entirely you should replace the sensitive information with something else, preferably the word “REDACTED”.

My guess is that you didn’t originally have the “send event to Timeline” option enabled, so the previous events that you’ve logged aren’t visible in the timeline, but still exist and count towards your 24 hour rolling limit.
The other possibility is that the events were logged yesterday (in which case they don’t appear in the “today” filter) but are still within the last 24 hours.

If you want to know more about how Events and Notifications work, and how you can ensure that you don’t accidentally exceed the limits by sending multiple notifications for one intruder detection the you should read this…

Pete.

Hi what do you suggest that i should do to fix it? Is there a problem in my code?
Thank you for the response

Hello, @Newbie22

I see, that you events with resolved status. How did you make events to this status?

I just tried to click resolve in the events tab

Have you tried what limit without the status of resolved?

The limit reached is showing even before i marked it as resolved

The limit is 100 events per device fo all accounts for now. However, there is an issue - if you send many events too quickly (like 10 events per second). You’ll get only 1 event on the timeline, but the event will be counted like - 10 used. This due to the another limit 1 event per second. We’ll fix it eventually.

The question is did you run logEvent() in a loop? Maybe when you was experimenting with the code/

What do you suggest to fix it? In my case it is in the void mytimer which is executed every 10 seconds (that might be why it is logged as 100 times already) where can i put it or what shall i put to limit it?

Thankyou for the response i now know what the problem is but i still dont know where to put it :))

i now know what the problem is but i still dont know where to put it :))

@PeteKnight Maybe you can help with the code.

1 Like

@PeteKnight i am unable to send the whole sketch at this time as i am not at home but what was left is only the things that is needed to connect the hardware to blynk cloud like the libraries and the auth codes. I will send the left code later after i got home. Thank you for the help. In the mean time can you suggest where or what shall i put the logevent to fix the times that the event is triggered for 100 times even if i only got 2 notifs?

Thankyou for your time :))

Have you read the link I provided to the tutorial about using “flag” variables?
This is how you should modify you code, so that you only get one event/notification for each time when an intruder is detected.

Pete.

Hi @PeteKnight I’ve read your tutorial and have come up to this new code

#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "REDACTED"
#define BLYNK_DEVICE_NAME "REDACTED"
#define BLYNK_AUTH_TOKEN "REDACTED"

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


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


// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "REDACTED";  //Enter your WIFI Name
char pass[] = "REDACTED";  //Enter your WIFI Password

int sensor = 13;  // Digital pin D7

float MotionSensor = LOW; // We will send an alert if the sensor outputs HIGH
bool alert_sent = false; // Flag to track if an alert has been sent for a motion detected event
 
BlynkTimer timer; // This function creates the timer object. It's part of Blynk library

void MotionSensorTimer() 
{
  float sensor = digitalRead(13);

  Blynk.virtualWrite(V0, sensor); 
  if(sensor != MotionSensor && alert_sent = false)
  {
    Blynk.logEvent("motion_detected");  // trigger the notification
    alert_sent = true;  // set the flag to indicate that an alert has been sent for this motion detected situation
    Serial.println("Blynk Alert Notification sent!");
    Serial.println();
  }
  else if(sensor = MotionSensor && alert_sent = true)
  {
    alert_sent = false; // reset the flag so that a future motion detection situation will trigger an alert
    Serial.println("Motion is now absent");
    Serial.println("New motion detection events will trigger a new alert notification");
    Serial.println();
  }
}



void setup() 
{
  Serial.begin(9600);
  //Connecting to Blynk Cloud
  Blynk.begin(auth, ssid, pass); 
  
  // Setting interval to send data to Blynk Cloud to 1000ms. 
  // It means that data will be sent every second
  timer.setInterval(10000L, MotionSensorTimer); // take a reading from the PIR sensor every 10 seconds

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

i tried to compile it and it says “Compilation error: lvalue required as left operand of assignment”
and it is pointing to this line of the code

  if(sensor != MotionSensor && alert_sent = false)

and

  else if(sensor = MotionSensor && alert_sent = true)

i think that the problem is that i used the “float MotionSensor = LOW;” and in the tutorial you are using numerical value but since im using HC SR501, im not sure what value it will give so i just used LOW and HIGH. can you help me fix this problem?
also, the whole sketch is uploaded above and i tried to follow the tutorial please do tell me if i missed something in my code or if there are anything wrong with my code.

thankyou for your response :))

You have to understand the difference between = and ==

When you use = you are saying make the variable on the left of the = symbol equal to the variable or object on the right of the = symbol.

When you use == you are saying compare the variable to the left of the == symbol with the variable or object on the right of the == symbol.

You want to do a comparison, so you need to use == or !=

So, your if statements need to be:

if(sensor != MotionSensor && alert_sent == false)

and

else if(sensor == MotionSensor && alert_sent == true)

Pete.

@PeteKnight i tried it and it compiled successfully. i have yet to try it tomorrow since my notification for this day is maxed out (exceed 100 events) i hope it works perfectly tomorrow. and will try to combine it with my dht22 code for humidity and temperature since i will use it in our smart egg incubator design :))
i will update if it works successfully

thankyou for helping me and have a nice day/night :))