Particle.publish validity

Hi,

I have a photon which wakes, takes and publishes some readings and then sleeps for 30 minutes. I’ve just added a subscribe function for it to check before going back to sleep, so that I can keep it awake long enough to flash OTA as necessary (its site is remote with solar power). Everything seems to work fine but I’d like to publish the event to which it subscribes from a CLI. How long does such a publish remain valid for?

Everything seems to work fine but only if the publish is made whilst the photon is awake, ie it seems that the event expires almost instantly. Is there a way to extend its lifetime to 30 minutes so that it doesn’t matter when I publish?

I’m all new to this so apologies if I’m missing something obvious

Thanks

DG

@DGJC, the published event is ephemeral and has no “time to live”. There is no way to define its lifetime, yet. This has been a requested feature for a while.

The TTL field in published events was an indicator for the intent to implement this, but it hasn’t materialised yet. However, support for it (or similar feature) on the Particle servers is still on the ToDo list but no ETA is given.

Currently the only thing you can do is to request the availability of new firmware.
For this you need some server that holds the flag which can be requested by the waking device e.g. via a webhook.

Thanks @peekay123 & @ScruffR. So, since I have no servers of my own, my only realistic option is a script on my computer that publishes the flag, say every 15 seconds, at around the time the photon is due to wake? I have a little snippet that corrects any time drift so that it comes on line very close to each half hour.

I read a while back about an OTA update function that was in the pipeline but I guess that isn’t functional yet either?

Thanks for the help, much appreciated

DG

Is this a device listed as product?
If not, there is no way to have OTA updates pending anway.
If it is a product, you just need to hang round for 1-2 minutes once a day (or whatever update “latency” you can accept) to consume the pending update.

On the other hand, if you want to OTA update a non-product device, you can run a JS server on your developer machine, make it publicly accessible (e.g. via DynDNS or a static IP and port forwarding on your router), have it run temporarily while you are waiting for your device to come online and request the flag from that server and then start your OTA update once the server registered the request.

1 Like