Hello,
I am trying to get push notifications to work with ios and a wemos D1Mini. I had it working for a short time but now it does not work and I get the following error when I try to log the event using the URL. I understand that this message means that I can’t trigger any more notifications because there are too many events in the log but how do I resolve this issue and prevent it from happening again and what is the limit for the allowable number of events in the log to begin with. I know that my event is triggered from within the void loop but it is within an if statement so I don’t believe that it is being triggered every time the loop is executed or some other simple problem like that. Any help would be appreciated, thank you.
{“error”:{“message”:“You have too many log events for a device.”}}
#define BLYNK_TEMPLATE_ID "!!!!!!"
#define BLYNK_DEVICE_NAME "!!!!!!"
#define BLYNK_AUTH_TOKEN "!!!!!!!!"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "!!!!!!";
char pass[] = "!!!!!!!!";
WidgetLED led1(V1);
// We make these values volatile, as they are used in interrupt context
volatile bool pinChanged = false;
volatile int pinValue = 0;
// Most boards won't send data to WiFi out of interrupt handler.
// We just store the value and process it in the main loop.
int prevState = -1;
int currState = -1;
long lastChangeTime = 0;
void setup()
{
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(4, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
Blynk.run();
Blynk.virtualWrite(V1, 1);
delay(2000);
Blynk.virtualWrite(V1, 0);
Blynk.logEvent("test", "System Start");
digitalWrite(LED_BUILTIN, 1);
}
BLYNK_WRITE(V2)
{
int pinValue = !param.asInt(); // assigning incoming value from pin V1 to a variable
digitalWrite(LED_BUILTIN, pinValue);
// process received value
}
void loop()
{
Blynk.run();
int state = !digitalRead(4);
long t = millis();
if (state != prevState) {
lastChangeTime = t;
}
if (t - lastChangeTime > 100) {
if (state != currState) {
currState = state;
Blynk.virtualWrite(V1, state);
if (state == 1) {
Blynk.logEvent("garage_alert", "Door Open!");
}
if (state == 0) {
Blynk.logEvent("garage_info", "Door Closed!");
}
}
}
prevState = state;
}