Beyond introducing a millis timer, is there any way I can rejig my code so that if there is no network connection, the relayPin0 doesn’t wait for the Particle Publish to go through before noticing it needs to turn off?
I’m guessing that’s what’s causing the relay to remain on when there is no network, anyway!
Sometimes Particle.connected() doesn’t work as expected, but this should help most cases.
Also using SYSTEM_MODE(MANUAL) may help till Particle hopefully sometime decides to undo the changes that introduced all the blocking into several functions that didn’t use to block.
Also the NO_ACK switch for Particle.publish() might be worth a try (although when I last tried a long time ago it didn’t quite live up to its name )