No me salen notificaciones en el móvil

Hola buenas! Estoy haciendo un proyecto para el cual quiero que me salgan diferentes notificaciones según vayan cumpliéndose una serie de cosas, y es que no me sale ninguna.

Un ejemplo de como lo tengo programado sería:

Blynk.notify(String("Entrenamiento finalizado."));

Algunas especificaciones de mi proyecto son:
• NodeMCU ESP-32S
• iOS 14.4.1
• Local server
• Blynk Library version 0.6.1

Vale, creo que no me funcionaba porque Arduino me había actualizado automáticamente a la versión beta de la librería. He vuelto a restaurar la anterior y funciona todo bien.

  1. is your local server connected to the internet? Can you successfully ping an external website from the server?

  2. do you have the notifiction widget in your app?

  3. what do your server logs say when you try to send a notification?

  4. you don’t need to turn a string into a string :smiley:
    Blynk.notify("Entrenamiento finalizado.");
    should work equally well.

Pete.

  1. Sí, sin problema.
  2. Sí, con las configuraciones por defecto.
  3. Nada, que haya encontrado.
  4. Sí, es cierto. Lo tenía puesto porque lo había visto en otro post y pensé que fallaba por eso.

What logging level do you have defined in your server properties file?
Note that changing these settings from within the web portray has no effect, you need to edit the file directly, then re-start the server.

Pete.

Tengo puesto
log.level=info

Log debug level. Possible values: trace|debug|info|error. Defines how precise logging will be. From left to right → maximum logging to minimum

log.level=trace

Try changing to debug

Pete.

Ahora me aparece esto:

11:30:14.287 DEBUG- Notification limit reached.

What value do you have for this server.properties entry…

#this setting defines how often we can send mail/tweet/push or any other notification. Specified in seconds
notifications.frequency.user.quota.limit=15

Pete.

notifications.frequency.user.quota.limit=10

¿Debería cambiarlo a 15?

10 ought to be better, because it means you can send one notification every 10 seconds rather than every 15 seconds.

But, this is an external service provided by google and they may have their own limits.

In your sketch, you aren’t doing anything silly, like trying to send notifications from your void loop are you?

Pete.

No, las notificaciones están en los botones, por ejemplo:

BLYNK_WRITE(V34) {
  startTraining = param.asInt();
  if (startTraining == 1) { // si se pulsa
Blynk.notify("Espere hasta que la máquina se prepare para acceder al control fisiológico.");
delay(10000);
Blynk.notify("Máquina lista. ¡Ha empezado tu entrenamiento!");
for (int i = 0; i < numSesiones; i++) {
  i = sesionActual;
  while (millis() <= (tiempoCiclo * 60 * 1000)) {
    timer.setInterval(1000L, sendSensor);
  }
  Blynk.notify(String("Ciclo finalizado. Descanse ") + tiempoDescanso + String(" minutos."));
  delay(tiempoDescanso * 60 * 1000);
}
Blynk.notify(String("Entrenamiento finalizado."));
  }
}

Well, that’s a horrible piece of code. The 10 second blocking delay is likely to cause a server disconnection, and the two notifications are being sent at the minimum frequency specified in your server properties file.

Pete.

Vale, ahora entiendo porque se me desconectaba del servidor. Tenía el presentimiento de que los delays no funcionaban bien, los voy a quitar y probar de nuevo.

Lo de mandar dos notificaciones una detrás de otra, ¿también debería quitarlo?

Gracias,

Paula

Yes!

Pete.

¿Y existe alguna manera de enviar 2 notificaciones seguidas?

Gracias,
Paula

The notifications have to be at least the minimum number of seconds defined in your server.properties file apart, and that’s assuming that you don’t exceed Google’s limits for this messaging service.

As far as I’m concerned, yopure using notifications in the wrong way. They shpould be used to tell you about exceptional or random events, nit telling you about two things that happen 10 seconds apart.

For that sort of data you’d be better using value, table or terminal widgets.

Pete.

Vale, muchas gracias Pete!!

Una última pregunta, ¿este tipo de código es inviable para Blynk? ¿Cuáles podrían ser soluciones alternativas sin variar su funcionalidad? (Esos delay no dan fallo, que ya he hecho pruebas antes, así que el problema debe estar con el bucle for y while, pero no sé como implementar una alternativa)

BLYNK_WRITE(V34) {
  startTraining = param.asInt();
  if (startTraining == 1) { // si se pulsa
    Blynk.notify("Espere hasta que la máquina se prepare para acceder al control fisiológico.");
    delay(4000);
    Blynk.virtualWrite(V39, "Máquina lista. ¡Ha comenzado tu entrenamiento!");
    delay(5000);
    Blynk.virtualWrite(V39, "Ve a Sensórica para seguir tu entrenamiento.");
    for (int i = 1; i < numSesiones; i++) {
      sesionActual = i;
      int start = millis();
      while (millis() < start+(tiempoCiclo * 60 * 1000)) {
        timer.setInterval(1000L, sendSensor);
      }
      Blynk.notify(String("Ciclo finalizado. Descanse ") + tiempoDescanso + String(" minutos."));
    }
    Blynk.notify(String("Entrenamiento finalizado."));
  }
}

You have to avoid all blocking code. That means the delay, and while statements have to go.

You should use BlynkTimer in Timeout mode. This could either be as a lambda function, or by restructuring your code to have the events that happen once the timer has elapsed in a different function.

Search the forum for examples.

Pete.