Traduit de English par IA ·
Nous avons eu exactement ce cas avec des cartes compteurs installées par un prestataire. Vous pouvez interroger le firmware en cours : l’API de partitions d’ESP-IDF fonctionne très bien depuis le core Arduino. Envoyez un build aux cartes que vous pouvez atteindre (celles de votre propre lot), ou attendez que les autres soient au dépôt ; il remontera la table en attributs client une fois, après la connexion :
#include "esp_partition.h"
void reportPartitions() {
String json = "{";
esp_partition_iterator_t it =
esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
bool first = true;
while (it != NULL) {
const esp_partition_t *p = esp_partition_get(it);
if (!first) json += ",";
json += ""part." + String(p->label) + "":"" +
String(p->address, HEX) + "/" + String(p->size) + """;
first = false;
it = esp_partition_next(it);
}
esp_partition_iterator_release(it);
json += "}";
mqtt.publish("v1/attributes", json.c_str());
}
Ensuite, dans l’onglet Attributes, scope Client, vous verrez part.app0, part.app1, part.otadata etc. pour chaque carte. Ce qu’il faut voir : deux slots applicatifs (ota_0 et ota_1, appelés app0/app1 dans les tables Arduino) plus otadata, chacun au moins aussi grand que votre image. Si vous ne voyez qu’un seul app0 de 3 Mo et pas d’app1, c’est le schéma « Huge APP », pas d’OTA possible.Pour les cartes sur lesquelles vous ne pouvez pas envoyer un nouveau build, la méthode d’emily fonctionne au dépôt :
esptool.py --port /dev/ttyUSB0 read_flash 0x8000 0xc00 pt.bin
python gen_esp32part.py pt.bin
Les cartes avec le mauvais schéma nécessitent un reflash USB unique avec une table à deux slots. Ensuite, l’OTA fonctionnera durablement.
Had this exact situation with meter boards a contractor did. You can ask the running firmware: the partition API in ESP-IDF works fine from the Arduino core. Push one build to the boards you can reach (the ones from your own batch), or wait until the others are at the depot, that reports the table as client attributes once after connecting:
#include "esp_partition.h"
void reportPartitions() {
String json = "{";
esp_partition_iterator_t it =
esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
bool first = true;
while (it != NULL) {
const esp_partition_t *p = esp_partition_get(it);
if (!first) json += ",";
json += ""part." + String(p->label) + "":"" +
String(p->address, HEX) + "/" + String(p->size) + """;
first = false;
it = esp_partition_next(it);
}
esp_partition_iterator_release(it);
json += "}";
mqtt.publish("v1/attributes", json.c_str());
}
Then the Attributes tab, Client scope, shows part.app0, part.app1, part.otadata and so on per board. What you want to see is two app slots (ota_0 and ota_1, called app0/app1 in the Arduino tables) plus otadata, each at least as big as your image. If you see one app0 of 3 MB and no app1, that’s the « Huge APP » scheme, no OTA possible.
For the boards you can’t get a new build on, emily’s way works at the depot:
esptool.py --port /dev/ttyUSB0 read_flash 0x8000 0xc00 pt.bin
python gen_esp32part.py pt.bin
Boards with the wrong scheme need one USB reflash with a two-slot table. After that OTA works for good.

