Notification for photon that has not been online for a period of time

Hi all,

I’m looking to create a notification to tell me when my photon has been offline for a while.

I want to implement code that will go to sleep, wake periodically to send an “I’m OK” message, then sleep again. If the photon does not connect to the cloud for a period longer than the sleep/wake cycle, I want to receive a message saying that the expected connection was not seen.

Can anyone point me in the right direction to the best way to do this?

Thanks,
J

You can use Particle.publish() to send such notification or you can also use the spark/status event that is published by default when the status changes.

The interesting bit is how to catch that event (which is a standard SSE), but you haven’t provided any info what “backend” you’d intend to use for that and hence the question is too open to answer properly.

Hi
Thanks for the quick reply - so…
I guess what I’m looking for is if there is a way within the Particle Cloud to monitor when the photon has last been seen, and to send a notification when it’s overdue. Perhaps it can be done with IFTTT or the like? I don’t want to run a separate piece of hardware to serve the event, am hoping for an existing solution.

Hi,

I run an IoT platform called Tinamous, we integrate with Particle to do a variety of things, one of those is detecting when a device is not reporting (i.e. has not sent measurements/status in the last x minutes/hours/days), this can then be linked to notifications such as email, sms or even calling a function on a Particle device.

You can read more about it here: http://tinamous.com/Help/Bots/ParticleBot

Essentially:

  1. Register an account at Tinamous.com
  2. From the Bots page, Add a Particle Bot. This handles the integration with Particle and will automatically create devices within Tinamous for each of your Core/Photon/Electrons.
  3. Edit the device and set the “Not Reporting After” time as you like.
  4. On the Notifications page, add a new notification for “A Device is not reporting”
  5. Leave the “For Members/Devices” section blank to monitor all your Particle devices.
  6. Select emal/sms etc. for the notification method (you will need to have confirmed your email/cell number for this to work properly).

Then on your device publish something every now and then as either a “status” or “senml” message.
e.g. Particle.publish(“status”, “I’m OK”); or some measurements in the senml format (these will get automatically stored and plotted for you).

Hopefully that would help you. Let me know if you have any questions.

Steve.
https://Tinamous.com

Nice :+1:
Could you update your usage samples to the “new” Particle.variable("someVar", thatVar) format tho’ :wink:

2 Likes

Ahh yes, well spotted! It’s been a while since I updated that page clearly!

It has been updated now.

Thanks!

1 Like

Thanks Steve, I’ll give that a try, sounds like just the thing I needed!
J

Hi Steve, this looks like a good service - just trying to get it work. A few queries if I may?

  1. The service seems to think my devices are not connected/reporting when they are? Any way to convince it otherwise? Do I need to tell my devices to do a “heartbeat” publish every couple of minutes to convince the system they’re alive or is there another way?
  2. It also says the particle bot is disabled when it seems to be working.