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
jeffxor
November 13, 2022, 7:55pm
4
@dwegscheid did you manage to solve this? I am having the same issue, it applies and then reverts after the 5 minute timeout.
jeffxor
November 14, 2022, 10:56pm
5
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
author: mongoose-os
type: lib
description: OTA firmware update via the AWS IoT device shadow
version: 1.0
sources:
- src
filesystem:
- fs
config_schema:
- ["shadow.ota_enable", "b", true, {title: "Enable OTA via shadow"}]
- ["shadow.autocommit", "b", false, {title: "Autocommit OTA if the shadow connection is successful"}]
libs:
- location: https://github.com/mongoose-os-libs/ota-common
- location: https://github.com/mongoose-os-libs/ota-http-client
- location: https://github.com/mongoose-os-libs/shadow
This file has been truncated. show original