[Solved]Collecting Data from Multiple Xenons for a single Publish

Hello,

I have a mesh network consisting of a single Boron LTE gateway and 3 Xenon endpoints. The Xenons are connected to different sensors (light, motion, etc). The Boron subscribes to the Xenon sensor data and publishes it to the cloud.

Currently, the boron handler function is publishing the data as and when the event is invoked by individual Xenons. I.e:

Boron:

void publishSensorData(const char *event, const char *data)
{
     Particle.publish(event, data);
}

Is there any way to modify this function to get the data from all the (active) Xenons on the mesh and publish it all at once in a single string. I.e

On Boron:

void publishSensorData(const char *event, const char *data)
{
     //String collective_sensor_data = xe_1_data + xe_2_data ...;
     Particle.publish(event, collective_sensor_data);
}

Thank you!

I was able to achieve this by publishing a heartbeat event from the Boron to which each Xenon responds with its sensor data. The handler on the Boron side just concatenates the “data” it receives upon each invoke and sets a flag (I inserted a delay of 15 seconds between each Mesh.publish(“heartbeat”) in the Boron’s loop. This allows sufficient time for the handler to gather all the xenon data ). Finally, I check for the validity of the flag in the loop function and publish the concatenated data string.

My concern now is that the Xenons have to be awake ALL the time to listen for a heartbeat signal from the Boron - highly power inefficient. Is there a timeline on when the SLEEP MODE power optimizations will be released?

You could also just have the Boron catch the individual asynchronous events from the Xenons store their readings individually (e.g. with timestamp) and publish the collected data either at a regular interval or whenever you have fully replaced previously published values with new data.

1 Like