1

Topic: OTA and RemoteXY cloud server

Hi,

Is it possible to set OTA in parallel with cloud server connection ?

For OTA I need to specify a webserver. I have try to had a webserver on port (80), but it doesn't seem to work. My sketch without RemoteXY GUI works OK, but don't when GUI is added.

Maybethere is conflict with an already running webserver with RemoteXY cloud server connection ?

I use ElegantOTA library, I just need to specify the server : ElegantOTA.begin(&server);

If it exist, I don't know how to point/use to the webserver already running from RemoteXY cloud server connection...

Thank you !

2

Re: OTA and RemoteXY cloud server

You can try this example. It compiles. But we haven't tested it.

// RemoteXY select connection mode and include library 
#define REMOTEXY_MODE__ESP32CORE_WIFI_CLOUD
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <RemoteXY.h>
#include <ElegantOTA.h>


// RemoteXY connection settings 
#define REMOTEXY_WIFI_SSID "YOUR_SSID"
#define REMOTEXY_WIFI_PASSWORD "YOUR_PASS"
#define REMOTEXY_CLOUD_SERVER "cloud.remotexy.com"
#define REMOTEXY_CLOUD_PORT 6376
#define REMOTEXY_CLOUD_TOKEN "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"


// RemoteXY configurate  
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =   // 19 bytes
  { 255,1,0,0,0,12,0,16,31,1,1,0,24,22,12,12,2,31,0 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // input variables
  uint8_t button_1; // =1 if button pressed, else =0 

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0 

} RemoteXY;
#pragma pack(pop)

/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////

WebServer server(80);


void onOTAStart() {
  // Log when OTA has started
  // <Add your own code here>
}

void onOTAProgress(size_t current, size_t final) {
  // Log every 1 second
}

void onOTAEnd(bool success) {
  // Log when OTA has finished
  // <Add your own code here>
}



void setup() 
{
  RemoteXY_Init (); 
  
  // wait for the RemoteXY to set up the connection
  while (WiFi.status() != WL_CONNECTED) {
    RemoteXY_Handler ();
    delay(10);
  }
  
  server.on("/", []() {
    server.send(200, "text/plain", "Hi! This is ElegantOTA Demo.");
  });

  ElegantOTA.begin(&server);    // Start ElegantOTA
  // ElegantOTA callbacks
  ElegantOTA.onStart(onOTAStart);
  ElegantOTA.onProgress(onOTAProgress);
  ElegantOTA.onEnd(onOTAEnd);

  server.begin();
  
}

void loop() 
{ 
  RemoteXY_Handler ();
  
  server.handleClient();
  ElegantOTA.loop();
  
  
  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay(), use instead RemoteXY_delay() 


}

3 (edited by sbarabe 2023-12-18 20:44:37)

Re: OTA and RemoteXY cloud server

Thank you ! it seems to work, even with dual connections exemple (Bluetooth and Cloud server).

I was putting "WebServer server(80)" at the beginning of the sketch and it didn't work. It seems that putting it after "END RemoteXY include", just like in your exemple, made it work, I don't know why...

Regards !

4

Re: OTA and RemoteXY cloud server

"OTA (Over-The-Air) and RemoteXY cloud server offer convenient and efficient ways to update and manage devices remotely. These services streamline connectivity, enhancing accessibility and control for users across various applications and industries."
PM kisan status