1 master 2 slave photons, sharing variables

I am using Photon1 (master) with a 4 line LCD & DHT22 to monitor & display house environment data. Photon1 also has two buzzers Subscribed to Photon2 & Photon3 (slaves), which Publish alerts when an alarm condition is required. Photon2 monitors building low temperatures to turn on a heater and monitor a food freezer and publishes an alarm if it’s temperature rises. Photon3 monitors another building for door open and/or motion detected and publishes an alert; it also utilizes a DHT22 to monitor the environment and turn on a heater.

The two slaves send variable data to ThingSpeak, which is read by Photon1 and the status is displayed on the LCD of the master. Synchronizing data written by the two slave devices to ThingSpeak and being read by the master many times displays only zero’s because apparently Thingspeak data has expired.

QUESTION
How can I read Particle.variable(s) from the two slave photons by the master photon to eliminate using ThingSpeak and assure that my data is current and will be properly displayed?

@DGG-KY, the slaves can Particle.publish() their data and the master can Particle.subscribe to those published events and decode/display the data.

1 Like

Can you give an example? I understood only fixed strings could be used, as shown in my example

void Heater_Status( const char *event, const char *data)
{
if (strcmp(data, “on”)==0)
{
// turn on heater
}
else if (strcmp(data, “off”)==0)
{
// turn off heater
}
}

Any string can be published and caught via subscriptions.

Have a look here

There are loads of similar topics to take from too.

1 Like

Another method would be UDP... constantly updating the master device locally. No need to bounce off of the cloud.

1 Like