Alarma para aplicación

Hola, buenas tardes. Estoy creando una app para recibir datos de una esp32 en tiempo real por via wifi, eso ya lo tengo, pero quiero implementar como una alarma audible o alerta que cuando reciba datos de temperatura <35 y >38 suene la alarma y entre 35 y 38 se desactive, pero he intentado varias maneras y no se muy bien, la verdad siento que puede ser mi mala colocación de mis condiciones if then else. Si alguien tiene conocimiento de como puedo hacerlo, se lo agradecería.

En when Web1.GotText, set Texto_recibe.Text to get responseContent eso es lo que me imprime los valores en la app, debajo de /data. Gracias,espero alguien me haya entendido. Y otra, no se si habrá alguna forma de quitar ese cuadro que sale de “Bad arguments to” y que solo salga la temperatura en pantalla y pues que suene la alarma si se requiere.


Are you expecting to receive anything besides a temperature?

You are receiving a JSON object that needs to be parsed into a dictionary, and the value for key "Temperatura" needs to be looked up.

Upload your .aia here for sample code.

alarma.aia (93.4 KB)
No, I only want to receive these temperature values ​​and only have the alarm work between those ranges, but I can't find how... look, i don't have my esp32 physically to generate the temperature data, so i'm using a python file to generate random values ​​from 30 to 40, and it works as a local server in the absence of my esp32. This is my python file

Because you wrapped the temperature in JSON, the app now has to unwrap it out of the JSON.

Here's how:
alarma (1).aia (93.9 KB)

1 Like

wow, I really appreciate your help, it works just as I needed, I was already desperate, thank you very much, really

I did not look closely at the temperature upper and lower limits from your app .aia

Both were 35, making for a super sensitive monitor that would almost never stop sounding its alarm.

Ohh, right. I have a detail, I don't know, I hope it's not too bothersome. When I connect the application to my local server on my laptop, the alarm works perfectly, when it is below or above the ideal temperature the alarm sounds and at the precise moment it enters the appropriate parameters it stops. But already using my esp32 with my temperature sensor, this does not happen, the alarm never stops whether it is inside or outside the parameters, I think it could be my code in Arduino IDE or I don't know what it could be. I know it should be my job to know, sorry, thank you.


I don't see any place in your Arduino code that sounds any alarm on the Arduino.

If you wanted something to stop an alarm on the AI2 app, add an ELSE clause to the if/then on temperature range, and do a Stop on your sound.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.