Reading variables on one Photon from another Photon

I want to read a couple of variables residing on a Photon named ‘Photon-TX’ from a second Photon named ‘Photon-RX’. I have seen how to access the variables from a web script but not from another Photon. The data does NOT need to be secure. Have I missed something? Are there any tutorials for doing this? Any help will be appreciated. I would even accept a few words of encouragement. :slight_smile:

1 Like

Hi @geek4life

You want publish and subscribe, not variables for Photon to Photon communication. Photon-TX publishes values periodically (less than 1 per second on average) and Photon-RX has a listener that subscribes to the published events.

Right now variables are accessed in the Particle cloud using HTTPS secure connections which is possible but hard to do from a device. Publish is easy and all the data is encrypted both ways already.

Please be encouraged–it is pretty easy!

4 Likes

I’m afraid using ‘regular’ variables is not possible at this time, but using publish/subscribe can achieve the same thing.

1 Like

@bko and @Moors7

Thanks for the speedy response and the good information. I guess I missed the part about publishing and subscribing. I am new to the Particle platform. Thanks again! --geek4life

2 Likes

That would have TX transmitting ‘continuously’, even though it might not be needed. If a value is only required occasionally, the RX Photon could publish a “requesting-data” event, to which the TX is subscribed. TX will then, in turn, publish the required data, to which RX is subscribed. Not trying to ‘correct’ @bko (I couldn’t if I tried :wink:), but wanted to put it out here for others who might be looking to do the same, but save on data (Electron based projects for example).

4 Likes

@Moors7

Thanks for the additional info. That gives me some options for my project(s). Thanks! --geek4life

1 Like