[SOLVED] Wake from Sleep on Photon WITHOUT connecting to cloud

[SOLUTION]

Can’t find delete, so I thought I could at least post the solution I found. You can use different operation modes:
https://docs.particle.io/reference/firmware/photon/#semi-automatic-mode
to set how you interact with the cloud.

[ORIGINAL POST]

I have a device that I am trying to minimize power consumption on. I want to use the sleep mode, however, when I wake up from sleep, I don’t want it to automatically connect to the cloud. (I don’t want the wasted power, and I don’t want the wasted time waiting for sleep() to return).

According to the firmware docs:
Since 0.5.0. In automatic modes, the sleep() function doesn’t return until the cloud connection has been established. This means that application code can use the cloud connection as soon as sleep() returns. In previous versions, it was necessary to call Particle.process() to have the cloud reconnected by the system in the background.

Is there anyway I can call sleep() such that when it comes back it does not try to reconnect to the cloud?

I have tried:

WiFi.off()
sleep(…)

but when it wakes from sleep it turns the WiFi back on. I am looking for a solution that is not off the form:

WiFi.off()
sleep(…)
WiFi.off()

Does anyone have any thoughts on this? Many Thanks!

have you tried something like, this turns off the led and disconnects from the cloud and wifi. turning off the led is not necessary as it will turn off when sleeping, but if you want to keep it off when it wakes up to do a quick check this will prevent further power drain.

RGB.control(true);
RGB.color(0, 0, 0);
Particle.disconnect();
WiFi.disconnect();
WiFi.off();
delay(200);
System.sleep(D4, FALLING, sleepDuration);```