InfluxDB Webhook Event wont publish if less than 250ms delay

Hello,
I have made a successfully working webhook event that retrieves data from my particle boron and inserts it on an influxdb database I have running on a VPS. The issue is that when I set the delay to less than 250ms on the code that runs on my Particle Boron or when I remove the delay completely then after the first measurement nothing gets inserted anymore on my database. Here is my code:

float analogPin;
String myID;
void setup() {
    Serial.begin(9600);
    pinMode(A5, INPUT);
    myID = Particle.deviceID();
}
void loop() {
  analogPin = analogRead(A5);

  String data = String::format("{ \"tags\" : {\"id\": \"%s\"},\"values\": {\"temp\": %f}}", myID.c_str(), analogPin);
  Particle.publish("db", data, PRIVATE);
  delay(250); // The mentioned delay
}

Any idea on whats going wrong? Is it even possible to achieve lowest delay between measurements?

This might be the explanation for what you are seeing
https://docs.particle.io/reference/device-os/firmware/boron/#particle-publish-

After four events in one second you have hit the rate limit and after that your device will be muted till it obeys the 4 seconds radio silence.

It would make sense, but my device is not getting muted… thats strange. Anyway, is there any way to avoid this?

Nope, there is no way to get around the rate limit - and there shouldn't be to keep things orderly.

That is unexpected and I'd not build my product on that.
The rate limit is (or at least used to be) enforced by the device OS. Maybe some undocumented change has upped that limit or it's an oversight.

The best practice to obey the limit while still transfering four readings per second would be to buffer your readings, wrap them in a single event and publish that once per second.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.