espressif / esp-mesh-lite

A lite version Wi-Fi Mesh, each node can access the network over the IP layer.
133 stars 22 forks source link

OTA LAN in inverted direction? (AEGHB-796) #122

Open Magnatto opened 2 months ago

Magnatto commented 2 months ago

Let's say I have 50 devices on a single mesh-lite and I want to do a LAN OTA update and only have the local network (so no external update). If i replace the root device with an updated version it will update all others eventually through esp_mesh_lite_transmit_file_start, that's great. But what if it's impossible or very incovenient to replace or know who is the root. Is there a way for me to replace ANY device with the updated version, so it may update the entire network, so the OTA LAN is trasmitted both ways, not just father to children?

tswen commented 2 months ago

https://github.com/tswen/esp-mesh-lite/blob/docs/mesh_lite_LAN_OTA/components/mesh_lite/User_Guide_CN.md#esp-mesh-lite-lan-ota

image

Magnatto commented 2 months ago

https://github.com/tswen/esp-mesh-lite/blob/docs/mesh_lite_LAN_OTA/components/mesh_lite/User_Guide_CN.md#esp-mesh-lite-lan-ota

image

Thanks for the reply, I understand this logic, which relies on an external URL and ALWAYS from root to children.

What I'm asking is if it's possible to NOT to rely on an external URL (replacing one of the devices in the network with an upgraded version), and for the OTA to spread from ANY device (not just from root to children).

This way I don't need an outside network connection (for client safety reasons), but can still update all devices from any given device in the network (since the root is not easily found among many devices and strict information requirements)

tswen commented 1 month ago

The external URL is just a fallback OTA method used when fetching firmware from the parent node fails. If you do not wish to upgrade via an external URL, you can set extern_url_ota_cb to NULL.

For LAN OTA, each node can only retrieve firmware from its parent node. If your root node has stored the binary file required by the child nodes in a specific partition, you can use esp_mesh_lite_ota_register_file_transfer_cb to provide the binary file to the child nodes. For a simple usage example, please refer to: https://github.com/espressif/esp-mesh-lite/blob/master/components/mesh_lite/include/esp_mesh_lite_core.h#L828-L885

Magnatto commented 1 month ago

Thank you, I understand that what I want (LAN OTA from child to parent, instead of parent to child) is not currently possible. @tswen would it be possible then to add it in the plan for a future feature? In a network of 50 devices it would be amazing to start and finish the LAN upgrade in the entire network from any device, not just the root.

tswen commented 1 month ago

If a child node obtains a firmware and wants to upgrade all devices directly through LAN OTA, the best way is to transfer the firmware to the root node first, and then upgrade it layer by layer.

LAN OTA cannot meet the requirement of upgrading all devices from any node.

Magnatto commented 1 month ago

If a child node obtains a firmware and wants to upgrade all devices directly through LAN OTA, the best way is to transfer the firmware to the root node first, and then upgrade it layer by layer.

LAN OTA cannot meet the requirement of upgrading all devices from any node.

Understood, will try that, thanks