Run post scripts for factory binaries for flashing (#3003)

Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
This commit is contained in:
Jesse Hills
2022-01-11 15:24:26 +13:00
committed by GitHub
parent 073828235f
commit ece71a0228
7 changed files with 103 additions and 1 deletions
+11
View File
@@ -410,6 +410,17 @@ class DownloadBinaryRequestHandler(BaseHandler):
filename = f"{storage_json.name}.bin"
path = storage_json.firmware_bin_path
elif type == "firmware-factory.bin":
storage_path = ext_storage_path(settings.config_dir, configuration)
storage_json = StorageJSON.load(storage_path)
if storage_json is None:
self.send_error(404)
return
filename = f"{storage_json.name}.bin"
path = storage_json.firmware_bin_path.replace(
"firmware.bin", "firmware-factory.bin"
)
else:
args = ["esphome", "idedata", settings.rel_path(configuration)]
rc, stdout, _ = run_system_command(*args)