Update, took a little fiddling (it really hates when you specify the wrong variable type!) but it seems to be posting with:
const char IDB_template[] =
"{ \"tags\" : {\"influx_db\": \"%s\""
", \"device\": \"%s\""
", \"location\": \"%s\""
"}"
", \"values\": {"
"\"%s\": %d" // value1
", \"%s\": %d" // value2
", \"%s\": %d" // value3
", \"%s\": %0.2f" // value4
", \"%s\": %0.2f" // value5
", \"%s\": %0.2f" // value6
", \"%s\": %0.2f" // value7
", \"%s\": %0.2f" // value8
", \"%s\": %0.2f" // value9
", \"%s\": %0.2f" // value10
", \"%s\": %d" // value11
", \"%s\": %0.2f" // value12
", \"%s\": %0.2f" // value13
", \"%s%s\": %0.2f" // value14
"}}";
char IDB_data[512];
snprintf(IDB_data, sizeof(IDB_data),
IDB_template, // refers to format above
/////// TAGS ///////
IDB_Name, // Influx DB name
IDB_deviceTagValue, // device name
IDB_locationTagValue, // device location
// Spare tags (unlimited, but also update IDB_template[])
// "tag1", tag1Val,
// "tag2", tag2Val,
// "tag3", tag3Val
/////// VALUES ///////
"PM1.0_env", pm1Reading, // value1
"PM2.5_env", pm2_5Reading, // value2
"PM10_env", pm10Reading, // value3
"PM2.5_hourly_avg", pm2_5hourly_avg, // value4
"PM10_hourly_avg", pm10hourly_avg, // value5
"PM2.5_24hr_avg", pm2_5daily_avg, // value6
"PM10_24hr_avg", pm10daily_avg, // value7
"outsideTemp", tempVal, // value8
"outsideHumid_rel", humiVal, // value9
"outsideHumid_pct", absoluteHumiVal, // value10
"outsidePressure", pressureVal, // value11
"noise_dBA", soundSensor_dBA, // value12
"noise1hr_dBA", soundSensor_Hourly_avg, // value13
deviceName.name, "Voltage", voltage); // value14
Particle.publish("Publish_to_IDB", IDB_data, PRIVATE);
Thanks again, I hope the above really helps someone in the future.
Will let this run for a few days and see if it fixes the fragmentation. I also removed all other strings possible with the exception of those nested in publishesā¦
As I am not assigning them to a variable, am I ok doing something such as the below?
Particle.publish("EEPROM Update", "daily index reset to: " + String(storage.dailyReadings_index), PRIVATE);
This device will be positioned remotely, so just need to pop the odd piece of diagnostics to the console to check if something goes odd. The āString(someInt)ā is the bit Iām now worried about⦠Am I right in assuming that if Iām not declaring an actual āString variable;ā that iām not actually storing the string, but rather just using the String() command to convert the int to a string for the purposes of publish?