Mgos_ota_commit() is not getting automagically called on AWS Shadow OTA

I am working on demonstrating OTA to my customer. Progress is being made.

The OTA is reverting after a timeout (as it should) apparently because mgos_ota_commit() is not being called.

I thought I had read somewhere that the OTA got committed once MQTT was able to connect to it’s server. Am I recalling that correctly and I need to do some configuration, or is it necessary for me to call mgos_ota_commit() explicitly?

I did some more research and found the documentation.

The overview

https://github.com/mongoose-os-libs/ota-shadow states

  • On success, reboot to the new firmware
  • After reboot, commit the new firmware after the successful AWS IoT handshake
  • If AWS IoT handshake does not happen during 5 minutes (the default commit timeout), rollback to the old firmare

The commit does not seem to be happening for me. I am seeing this.

[Jun  4 10:21:00.436] mgos_provision_state:43 Current state: 2 -> 3
[Jun  4 10:21:00.447] net.c:62                MQTT_EV_MQTT_CONNACK (ret_code: 0)
[Jun  4 10:21:00.447] net.c:27                gateway alive gw/sti_B4E62DD60069, published: yes, msg: {"alive": 1}
[Jun  4 10:21:00.517] net.c:78                MQTT_EV_MQTT_PUBACK (msg_id: 2)
[Jun  4 10:21:00.627] mgos_aws_shadow.c:294   Subscribed
[Jun  4 10:21:00.634] mgos_ota_core.c:936     Update state: 300

Am I doing something wrong?

I got delta changes in ESP32 on updatin/adding ota url on aws shadow desired state. and it inundation is not starting

@dwegscheid did you manage to solve this? I am having the same issue, it applies and then reverts after the 5 minute timeout.

If anyone is trying to figure this out, auto-commit is disabled by default you need to add the setting to your mos.yml file

  • [“shadow.autocommit”, true]

It is documented in the mos config for the module