OTA on esp32 for AWS need to manually update shadow and commit

If you are asking a question, please follow this template:

  1. My goal is: have OTA on esp32 using AWS automatically update the shadow with the url and commit the new firmware
  2. My actions are: currently I have to do a: mgos_shadow_updatef(0, “{ota:{url: %Q}}”,url); /* clear OTA url so an OTA update does not start again*/ otherwise I get an endless loop. In addition I commit the firmware manually because otherwise it timesout and reverts to the original fw
  3. The result I see is: have to manually update shadow and commit new ota fw
  4. My expectation & question is: I expect the shadow to be updated automatically. Is this an error? Another developer says that he never had to update the shadow.

Thanks. What is your goal?
To update your device automatically as you upload a new firmware to some URL?

Yes, we are doing OTA using the shadow

This method might work well for you: https://vcon.io/docs/#automatic-ota

We manually copy the url as desired in the shadow and that starts the process on our esp32- but we are finding that we have to manually acknowledge the desired using mgos_shadow_updatef(0, “{ota:{url: %Q}}”,url); /* clear OTA url so an OTA update does not start again*/

One of us said that they did not need to clear the desired url, but I am finding that I do. In either way, it would be nice if the mgos code would clear the desired url from the shadow.We have it working so the esp32 does not constantly try to apply the OTA by manually acknowledging the desired shadow in the shadow delta callback. In addition, the documentation indicated that mgos will autocommit the new firmware, but I found that not to be the case- unless I commit it, it will timeout.

Could you elaborate more on “clear the desired URL from the shadow” please - what does that mean?

Once we receive the shadow delta with the OTA url, we have to manually send back a mgos_shadow_updatef(0, “{ota:{url: %Q}}”,url); /* clear OTA url so an OTA update does not start again*/ or else the OTA will keep trying to start, - that code is closed source so I don’t know where, but it outputs something like “OTA already started” if we do not send this mgos_shadow_update

Do you see shadow-initiated update is already in progress messages in the device log?

In such a case, ota-shadow lib does not update the shadow.
In other cases, i.e. when an update successfully starts, ota-shadow lib sends an update exactly as you’ve mentioned, and must clear the delta.

Try to reboot a device - get to a clean state. Make sure that there is no delta. Then, change the URL in the desired.ota.url in a shadow. Observe the reported.ota.url - make sure it changes too, once an update has started.