Check status of particle photon iOS

Is there a way I can invoke a function which returns the status of the particle photon device? Similar to the one in the web IDE?

There is nothing regarding that in the iOS SDK reference docs.


Could you elaborate what kind of status?

You can call Particle.function() from any mobile SDK (and by other means too).
You can also trigger a Particle.publish() and/or request a Particle.variable().

1 Like

The web IDE only shows a circle icon that glows the same color as the device status LED. There is also a button to signal the device. Are you referring to the web console which has diagnostic information?

If you are referring to the device diagnostics, there was a post recently about a new library to help with retrieving diagnostics from user firmware: Getting system diagnostic data from user firmware.

As in if the device is turned on, or off, or not connected to wifi, or connected properly…etc

It'd be rather hard to have the device to actively inform anybody about the bold status since there is no way to actively communicate under these circumstances. Consequently these status can only be "assumed" from the fact that the device hasn't checked in for a while.
That's how the cloud does "guess" the most likely status.

But you can request that guess from the cloud via the Cloud API which in turn is wrapped into the iOS SDK
The iOS SDK reference isn't that brilliantly structured, but you may want to look at these functions and classes

(NSURLSessionDataTask *)getDevice:(NSString *)deviceID completion:(nullable void (^)(SparkDevice * _Nullable device, NSError * _Nullable error))completion

SparkDevice class

So, actually that sentence wasn't quite accurate :wink: