Cannot send command to esp32

const { Analysis, Device } = require('@tago-io/sdk');const axios = require('axios'); // Import axios libraryasync function startAnalysis(context, scope) {    console.log('Analysis started, preparing command...');         // Command to send to the device    const command = {            command: 'waterpumpON'    };    console.log('Command prepared:', command);        const deviceIP = '192.168.1.245'; // Replace with your ESP32 device's IP address        const port = 80; // Replace with the port number of your ESP32 HTTP server        try {            console.log('Sending command to device...');            const response = await axios.post(`http://${deviceIP}:${port}`, command);            console.log('Command sent to turn on water pump');            console.log('Response:', response.data);        } catch (error) {            console.error('Error sending command:', error.message);        }    }module.exports = new Analysis(startAnalysis);

What do i have to do i am stuck please please please help. If someone can help fix this i will paypal u

Adruino code:

  1. void setupWebServer() {

  2. server.on(“/command”, HTTP_POST, (AsyncWebServerRequest *request){

  3.  String command = request->arg("command");
    
  4.  // Print the received command to the serial monitor
    
  5.  Serial.print("Received command: ");
    
  6.  Serial.println(command);
    
  7.  if (command == "waterpumpON") {
    
  8.    digitalWrite(RELAY\_PIN, LOW);
    
  9.    request->send(200, "text/plain", "Water pump turned ON");
    
  10.  } else if (command == "waterpumpOFF") {
    
  11.    digitalWrite(RELAY\_PIN, HIGH);
    
  12.    request->send(200, "text/plain", "Water pump turned OFF");
    
  13.  } else {
    
  14.    request->send(400, "text/plain", "Invalid command");
    
  15.  }
    
  16. });

  17. server.begin();

  18. Serial.println(“HTTP server started”);

  19. Serial.println("Server started on IP: " + WiFi.localIP().toString());

  20. }

I am stuck i will paypal u i just need help please please please PLEASE PLEASE

Console

[2024-05-06 16:08:49] Error sending command: connect ETIMEDOUT 192.168.1.245:80

[2024-05-06 16:08:49] Duration: 2m 11s Billed Duration: 2m 11s.

[2024-05-06 16:08:49] Analysis finished.

[2024-05-06 16:06:39] Sending command to device…

[2024-05-06 16:06:39] Command prepared: { command: ‘waterpumpON’ }

[2024-05-06 16:06:39] Analysis started, preparing command…

[2024-05-06 16:06:38] Starting Analysis…

Hi,

There’s no way your code can work running internally within Tago, these analyses are being run on a virtual machine, it’s not possible to establish a local connection like you’re trying to do, the only way your code could work would be to run the analysis externally.