diff --git a/esphome/components/esphome/ota/__init__.py b/esphome/components/esphome/ota/__init__.py index b55d66ba0a..0a9a76e771 100644 --- a/esphome/components/esphome/ota/__init__.py +++ b/esphome/components/esphome/ota/__init__.py @@ -77,7 +77,7 @@ def ota_esphome_final_validate(config): merged_ota_esphome_configs_by_port[conf_port] = merge_config( merged_ota_esphome_configs_by_port[conf_port], ota_conf ) - if config.get(CONF_ALLOW_PARTITION_ACCESS, False) and not CORE.is_esp32: + if ota_conf.get(CONF_ALLOW_PARTITION_ACCESS, False) and not CORE.is_esp32: raise cv.Invalid( f"{CONF_ALLOW_PARTITION_ACCESS} is only supported on the esp32" ) diff --git a/esphome/components/ota/ota_backend_esp_idf.cpp b/esphome/components/ota/ota_backend_esp_idf.cpp index d09f4c48d4..a378adb0e3 100644 --- a/esphome/components/ota/ota_backend_esp_idf.cpp +++ b/esphome/components/ota/ota_backend_esp_idf.cpp @@ -347,6 +347,7 @@ OTAResponseTypes IDFOTABackend::update_partition_table() { ESP_LOGE(TAG, "esp_ota_end failed (err=0x%X) ", err); return OTA_RESPONSE_ERROR_PARTITION_TABLE_UPDATE; } + esp_partition_deregister_external(this->partition_table_part_); this->partition_table_part_ = nullptr; esp_partition_unload_all(); @@ -358,12 +359,12 @@ OTAResponseTypes IDFOTABackend::update_partition_table() { const esp_partition_info_t *new_part = &new_partition_table[new_app_part_index == -1 ? new_app_part_index_with_copy : new_app_part_index]; if (p->address == new_part->pos.offset) { + ESP_LOGD(TAG, "Setting next boot partition to 0x%X", p->address); new_boot_partition = p; } it = esp_partition_next(it); } esp_partition_iterator_release(it); - ESP_LOGD(TAG, "Setting next boot partition to 0x%X", new_boot_partition->address); err = esp_ota_set_boot_partition(new_boot_partition); if (err != ESP_OK) { ESP_LOGE(TAG, "esp_ota_set_boot_partition failed (err=0x%X) ", err);