Alarma de temperatura (aplicación)

AplicacionIncubadora.aia (212.3 KB)
Hi everyone, I am creating a mobile application that serves as an alarm, when it detects temperature values ​​​​from 35 to 38 that it receives from an esp32 via wifi, the alarm stops, if the values ​​​​are outside the ranges, the alarm sounds, for example: 32,33,34, 39,40,41. I am using a python file to simulate a local server, as if it were an esp32 that generates random data between 30 and 40 as if they were temperature values, however in this simulation the application and the alarm work perfectly, it stops and sounds when it should, however already applied to my esp32 with my temperature sensor in real life, I receive data correctly, but the alarm starts to sound and never stops, the truth is I do not know what can cause my application to work in my simulated python file and in my real environment not.

At the top of your blocks, you ask for a Web Get before loading the URL for the Web component.
You also enable Clock Timers that were left enabled already in the Designer, so they fired before you had a chance to load a URL to the Web component for its Get operation.

Clock1 (same for 2 and 3)
image

Screen2 blocks

P.S. I have never seen a Flask environment on this board before.

In your Flask code you are asking to use IP address 0.0.0.0 port 3000, but that is quite different from the IP address in your AI2 URL.

How is that supposed to work?

ok, it's that, I created like 2 options, one that already has an ip address loaded from the app, and the other option is in case the ip address of the esp32 were to change, due to the change of wifi, I don't know if this could create a conflict. Now, the python file that I'm using I defined the IP address in 0.0.0.0 port 3000 just as an example, since this is the one I use to test my app when I don't have my physical esp32. Let's see when I press the receive data button the data that is received is from the IP and port that is in my blocks, while the button is not pressed no data is received as far as I know, and in case the ip and port that I have in my blocks is another, then I use the second option which is to manually set the endpoint and the ip of the esp32 and press the send button to receive data from this new ip and endpoint, the stop button stops both data deliveries. In this case, when I want to test with my file in python, I enter this data manually which is: IP address 0.0.0.0 port 3000

At this point, if you are having problems and need to localize them either to the AI2 side or the ESP side, I suggest using the web browser on that same phone to go to whatever URL the ESP says it is, and see if the phone can reach that URL.

If the phone can reach that URL, then the problem is in AI2 code, otherwise it's your ESP setup or your phone's network access (WiFi or carrier).

when i access my esp32 ip from my browser this is what i get:


Obviously, since I am obtaining real-time data, I have to constantly refresh the page to update the value.

The incoming JSON has two keys

  • sensor
  • value

But you don't ask for them.

You ask for something that doesn't appear as a key in the JSON, Temperatura