How can we trigger a firmware download on the second attempt?

Hello expert!

I have a device running firmware version V4 that was successfully updated (from V1 to V4) the first time, using script below:

declare(“Downloads.[FileType:1 Firmware Upgrade Image]”, {path: 1}, {path: 1});
declare(“Downloads.[FileType:1 Firmware Upgrade Image].FileName”, {value: 1}, {value: “OTA_V1V4.bin”});
declare(“Downloads.[FileType:1 Firmware Upgrade Image].Download”, {value: 1}, {value: Date.now()});

After preparing a new firmware version (V5), I attempted to upgrade V4 to V5, it using the same script:

let deviceSwVersion = declare(“InternetGatewayDevice.DeviceInfo.SoftwareVersion”, {value: 1}).value[0];
if (deviceSwVersion === 'V4'){
declare(“Downloads.[FileType:1 Firmware Upgrade Image]”, {path: 1}, {path: 1});
declare(“Downloads.[FileType:1 Firmware Upgrade Image].FileName”, {value: 1}, {value: “V4-V5_package_20260324140634.bin”});
declare(“Downloads.[FileType:1 Firmware Upgrade Image].Download”, {value: 1}, {value: Date.now()});}
else if (deviceSwVersion === 'V1'){
declare(“Downloads.[FileType:1 Firmware Upgrade Image]”, {path: 1}, {path: 1});
declare(“Downloads.[FileType:1 Firmware Upgrade Image].FileName”, {value: 1}, {value: “OTA_V1V4.bin”});
declare(“Downloads.[FileType:1 Firmware Upgrade Image].Download”, {value: 1}, {value: Date.now()});
}

but noticed that the parameter “Downloads.1.download” was not updated to trigger the download.

How should this situation be handled?

Please include your entire upgrade script. Please use 3 backticks (```) to create a code block.

Thank you, Akcoder!. I’m new here, so I’m not yet familiar with all the forum rules—please excuse that. I’ve updated my post to make sure it now complies with the guidelines.

In addition, I do have a workaround: clearing all device data to force it to create a new Download object. However, this approach is only feasible for a small number of individual devices and cannot be applied at scale.

Therefore, I’d like to ask this question to better understand how the ACS handles this scenario, and to find a solution that can be applied to a large number of devices, especially as firmware upgrades become more frequent.

Thank you.

Why do you have different time values for the timestamp .Download param? The timestamp param tells GenieACS not to do anything unless the timestamp value given is newer than what is stored in the db.

I bet it starts working if you replace updateTime with Date.now()

Sorry, my mistake! At the first time I used “let updateTime= Date.now() + 60”, but before asking this question, I already change all the value to “Date.now()”, and this situation happended even all the value is “Date.now()”.

Have you verified the FS service is running and accessible to the CPE in question? What is in the logs on the CPE?