Blynk.logEvent

I don’t know were I’m wrong
I need to receive a push notification on the phone when device started, but it’s unsuccessful
I just received offline notifiaction

-------> I don’t use Blynk.Edgent and I really don’t want to use it <------------

2022-02-02_180546

2022-02-02_175145

void setup() {
  Serial.begin(SrlBaud);
  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);
  pinMode(relay3, OUTPUT);
  pinMode(relay4, OUTPUT);
  Blynk.begin(auth, ssid, pass);

  Blynk.logEvent("Device started"); // <---------send to phone

***** and this code *****

BLYNK_CONNECTED() {
  if ( FirstStart == false) {
    rtc.begin();
    setSyncInterval(900 * 1000); // Sync interval in seconde
    FirstStart = true;
    Blynk.syncAll();
    Blynk.logEvent("BLYNK_CONNECTED ..."); // <---------send to phone
  }
}
1 Like

The Blynk.logEvent syntax is:

Blynk.logEvent("event_code","optional message")

so in your case, the event code would need to be “BLYNK_CONNECTED …” and I doubt that is the code that has been assigned to the event you’ve created.
Note that the event name and event code aren’t always the same, and it has to be the code that you use.

Also, the Limit Period of 1 hour means that you’ll only get one notification per hour, and any other ones sent in the meantime will be disregarded.

Pete.

1 Like

Thank you Pete, all is ok now :wink:

    Blynk.logEvent("blynk_connected", "BLYNK_CONNECTED ...");
1 Like

I documented some stuff here about where the various elements that make-up the notification come from.

If the Event Name was changed to “BLYNK_CONNECTED …” then the optional message would be needed, or you could all additional data like the time/date maybe.

Pete.

1 Like

Very interesting , thank you Pete