Photon OTA vs System.Sleep()?

Having real trouble getting an OTA update to work with a device thats in deep sleep most of the time. I have the OTA scheduled in the console (its set up as a product). The device wakes up once every 15mins, and stays on for a minute.
Watching the Photon sitting on my desk I can see the OTA start, but then the device appears to sleep before the OTA finishes. This has been going on all day. Is there any way to prevent this, other than extending the sleep timer, which wastes precious battery life?
Does System.updatesPending() do anything yet?

Nope, this is a burning problem for me too. The only workarounds I know of so far are

  • add an extra long wake periode once per day, or so
  • have a function to prevent the device to go back to sleep (if you can catch it)
  • have a flag on a seperate server and request its state from there when waking up (this is how System.updatesPending() should work IMO)
  • update in two steps: First flash a tiny program that updates fast enough and then keeps the device awake, second flash your actual firmware

All these are poor workarounds for a broken feature.

@KyleG, could you please bring this forward with the team. I’m sure lots of others have to go these extra miles for a broken feature for much too long.

e.g.
https://github.com/spark/firmware/issues/1285
https://github.com/spark/firmware/issues/1166

Could we use the LEDStatus class to retrieve the LED color and check if its Magenta? Or does this only work if the user has control of the LED.

Thanks for pining me, I am also going to ping @rickkas7.

So I did this:

void FW(system_event_t event, int mode)
            {
                    switch (mode)
                    {
                        case firmware_update_begin:
                        case firmware_update_progress:
                        {
                            flag_FW=true;
                            break;
                        }
                        case firmware_update_complete:
                        {
                            flag_FW=false;
                            tm_await_resp=Time.now(); 
                            break;
                         }
                        case firmware_update_failed:
                        {
                            flag_FW=false;
                        }
                    }    
        }
    void setup()
    {
        
        
        System.on(firmware_update, FW);
...

This catches all the firmware update events, and flags my code to extend the sleep timeout. So long as my code is connected long enough for the OTA to start, this seems to work to catch it and keep my device on until the update is complete. I usually have the device connected for 15 seconds or so - it publishes some data, then waits for a response from Azure IoT server (1 minute timeout) , then sleeps.