Receive OTA Updates with Deep Sleep active.

monkey
Posts: 21
Joined: Mon Jun 17, 2019 10:47 pm

Receive OTA Updates with Deep Sleep active.

Postby monkey » Mon Jan 18, 2021 3:30 am

My ESP32 application enters deep sleep for 15 minutes and wakes up for long enough to connect to the cloud and send off some stuff. When the device is left on all the time, the OTA is easy enough to run. If I create the binary and plop it in S3, I can get the OTA to run by simply publishing the URL to the device:

$aws/things/<device-name>/ota/update

Code: Select all

{
       "state": {
		"desired": {
			"ota_url":"******.bin"
		}
	}
}
Equally, if I publish an update to some variables that I want to change, that works fine:

Code: Select all

    jsonStruct_t output_handler;
    output_handler.cb = output_state_change_callback;
    output_handler.pData = &output_state;
    output_handler.dataLength = sizeof(output_state);
    output_handler.pKey = "output";
    output_handler.type = SHADOW_JSON_BOOL;
    rc = aws_iot_shadow_register_delta(&mqttClient, &output_handler);
    if (SUCCESS != rc) {
        ESP_LOGE(TAG, "Shadow Register State Delta Error %d", rc);
        goto aws_error;
    }
And put some stuff inside the callback function (output_state_change_callback).

PROBLEM
-----------
I can't figure out how to get either of these to work for a device that is in deep sleep almost all the time. I tried QOS 1, AWS Jobs, message retention (not available in aws). But I could not figure it out. What 's the normal approach that everyone uses for this problem?

Who is online

Users browsing this forum: No registered users and 118 guests