Check value of Particle.variable() from another core. (not webpage)

I know how to set a variable from a core, and check it from a GET call from the web, but I imagine this is simple, but I can’t see to check it from another core…? Is this possible?

From the documentation for Particle.variable() …
Expose a variable through the Cloud so that it can be called with GET /v1/devices/{DEVICE_ID}/{VARIABLE}. Returns a success value - true when the variable was registered.

No, you can’t get a variable or call a function from one device to another. The easiest way to get data passed between devices is to use the publish/subscribe system. If you want the device that you want to get the data to have control over when it gets that data, you could have it publish to the other device (the one with the variable you want to access), and then have that device publish an event where the data is the value of that variable. The receiving device would have to subscribe to that event.


Thanks @Ric

Thats what I am currently doing. The problem (not really a problem) is that the core’s are not always online so I created a publish/subscribe that will allow a core to ask for updates when it comes online…this just slows things down and there is no way to know the last status of cores that have gone offline.

Just seems strange if these variables are stored in the particle could, you can not retrieve them with a simple call.


By the way, variables are not stored in the cloud. The value is stored on the device until queried, then the value is requested from the device. So if the device is offline, the current value of the variable won’t be available.


Thanks @rickkas7

Didn’t realize that either…I assumed they because variables in the cloud. So if you call an HTTP request from a web page for a variable in which the core is offline nothing will be returned? (need to try this, just assumed last value was there).

thanks - kinda new to this!