OTA over painlessmesh possible with Blynk?

I have a setup with a “hub” with two ESP32 connected by serial.
One of the ESP32 is running Blynk, the other one is running painlessmesh.
There are currently four other devices running in the mesh network, and there will be several more coming.
The mesh network is running everything with and without internet and doe need to function even if internet is down. Blynk is used to control and monitor.
So, the question is, is there anyway to do FW update OTA for the devices in the mesh network?

You can use Blynk.Air to update the firmware on your device that’s “running Blynk” provided that you’re running the Edgent sketch or the Blynk.Air minimal code is incorporated into your sketch, and the device is online as far as Blynk is concerned.

Devices that aren’t running Blynk code won’t be updatable via Blynk.Air.

It may be possible to use Arduino OTA to update your non-Blynk devices, but only from a computer on the same network.

Pete.

Thanks,
Yes I am able to use Blynk.Air to update the FW on the device running Blynk.
I would like to know if anyone had been able to somehow do OTA for the mesh devices (the “first” mesh device is connected to the Blynk device by serial)

Simple way is to add elegant OTA to all your non blynk devices. This way you can upload the bin file over the air. Just enter the ip address of the device that needs to be updated, that will present you with a webpage to upload the bin file and you are done.

Thanks, I looked at it and I do not believe it will work in a mesh network?
Or would I be able to connect to the mesh wifi with the computer and upload that way?

TBH, as we’ve established that BlynkAir isn’t going to work with your mesh devices, this is probably a discussion for another forum which deals with painlessmesh issues and OTA for the painlessmesh architecture.

Pete.

While I do agree, I am probably not the only one using Blynk together with mesh, so there would be a value to others if there is a solution.

If you find a solution that you think may be of use to other Blynk users then by all means share it here.
However, I suspect that you’ll need to explain your topology in rather more detail than

for it to be of value to other Blynk users.

Pete.

If you can post your code of the device running on mesh! May be i can help you.

Thanks,

As I wrote earlier, one of my “boxes” (units, devices or whatever you want to call them, I called this one the “hub”) has two ESP32’s in it. One of them is running Blynk, the other one is running mesh. They both also have several IO’s connected.
The two ESP’s are connected via Serial2, pin 16/17.

I do not believe it is possible to do a internet OTA through Blynk, but if you have any ideas of how that would be possible, please let me know, that of course would be the best option.

What seems to be possible is:

  1. Build a separate ESP32 with a SD card. Connect to mesh and run OTA.
  2. Connect laptop to mesh via wifi and upload FW.

I have not tried either of them, I have seen discussions on forums but not a complete solution.

Attached is an example code of one of the devices in the mesh. All it does is act as a repeater for devices too far from others.

// Repeater for Mesh
//************************************************************

#include <Arduino.h>
#include <esp_task_wdt.h>
#define WDT_TIMEOUT 100
// Necessary Libraries
#include <painlessMesh.h>
#include <ArduinoJson.h>

// WiFi Credentials
#define   MESH_PREFIX     "ESP_Mesh"
#define   MESH_PASSWORD   "somethingSneaky"
#define   MESH_PORT       5555

Scheduler userScheduler; // to control your personal task
painlessMesh  mesh;

// Prototype so PlatformIO doesn't complain
/*void timer1sec();
void timer2sec();
void timer10sec();

Task task1sec(TASK_SECOND * 1, TASK_FOREVER, &timer1sec);
Task task2sec( TASK_SECOND * 2 , TASK_FOREVER, &timer2sec);
Task task10sec( TASK_SECOND * 10 , TASK_FOREVER, &timer10sec);

void timer1sec(){
}

void timer2sec(){
}

void timer10sec(){
}

void sendMessage()
{
  // Serializing in JSON Format
  DynamicJsonDocument doc(1024);
  String msg ;
  serializeJson(doc, msg);
  mesh.sendBroadcast(msg);
  Serial.println("Message sent: " + msg);
  //taskSendMessage.setInterval((TASK_SECOND * 1));
}
*/
void receivedCallback( uint32_t from, String &msg )
{
  //Deserializing
  String json;
  DynamicJsonDocument doc(1024);
  json = msg.c_str();
  Serial.println("Received message: " + msg + " From: " + from + " Json: " + json);
  DeserializationError error = deserializeJson(doc, json);
  
  if (error)
  {
    Serial.print("deserializeJson() failed: ");
    Serial.println(error.c_str());
  }
}

void newConnectionCallback(uint32_t nodeId) {
  Serial.printf("--> startHere: New Connection, nodeId = %u\n", nodeId);
}

void changedConnectionCallback() {
  Serial.printf("Changed connections\n");
}

void nodeTimeAdjustedCallback(int32_t offset) {
  Serial.printf("Adjusted time %u. Offset = %d\n", mesh.getNodeTime(), offset);
}

void setup() {
  Serial.begin(115200);
  //mesh.setDebugMsgTypes( ERROR | MESH_STATUS | CONNECTION | SYNC | COMMUNICATION | GENERAL | MSG_TYPES | REMOTE ); // all types on
  mesh.setDebugMsgTypes( ERROR | STARTUP );  // set before init() so that you can see startup messages
  mesh.init( MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT );
  mesh.onReceive(&receivedCallback);
  mesh.onNewConnection(&newConnectionCallback);
  mesh.onChangedConnections(&changedConnectionCallback);
  mesh.onNodeTimeAdjusted(&nodeTimeAdjustedCallback);
/*
  userScheduler.addTask( task1sec );
  task1sec.enable();
  userScheduler.addTask( task2sec );
  task2sec.enable();
  userScheduler.addTask( task10sec );
  task10sec.enable();
  */
}

void loop() {
  esp_task_wdt_reset();
  mesh.update();
}

I am not able to access my computer at the moment.
Did you try to add in the elegant OTA sketch to your existing mesh device ?

Elegant ota opens a web server on its ip address. So you can access the ip address and upload the FW. However this is can be done only locally.

I would suggest you to add the ota bit to your mesh device, see if that compiles and upload and see if that allows the ota functionality.

Thanks,
From what I understand, elegant OTA will connect to my wifi and open a web server, where I can enter with my computer.
I do not see how to use that while my ESP32 is connected to the mesh and not to my wifi.