0

THROTTLE WARNING
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

THROTTLE WARNING

by Nimbleq on Mon Jan 13, 2020 5:24 am

I am getting a Warning sms again and again : Throttle warning nimbleq data rate limit reached , 7 seconds until throttle released.

I am using following codes.

Code: Select all | TOGGLE FULL SIZE
#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
int sensor = D1;// we will use an digital sensor
/************************* WiFi Access Point *********************************/

#define WLAN_SSID       "XT"
#define WLAN_PASS       ""

/************************* Adafruit.io Setup *********************************/

#define ARB_SERVER      "io.adafruit.com"
#define ARB_SERVERPORT  1883                  // use 8883 for SSL
#define ARB_USERNAME    ""
#define ARB_PW         ""


/************ Global State (you don't need to change this!) ******************/

// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;
// or... use WiFiFlientSecure for SSL
//WiFiClientSecure client;

// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
Adafruit_MQTT_Client mqtt(&client, ARB_SERVER, ARB_SERVERPORT, ARB_USERNAME, ARB_PW);

/****************************** Feeds ***************************************/

// Setup a feed called 'arb_packet' for publishing.
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
#define ARB_FEED "Nimbleq/feeds/Fan"
Adafruit_MQTT_Publish ap = Adafruit_MQTT_Publish(&mqtt, ARB_FEED);


// Arbitrary Payload
// Union allows for easier interaction of members in struct form with easy publishing
// of "raw" bytes
typedef union{
    //Customize struct with whatever variables/types you like.

    struct __attribute__((__packed__)){  // packed to eliminate padding for easier parsing.
        char charAry[10];
        int16_t val1;
        unsigned long val2;
        uint16_t val3;
    }s;

    uint8_t raw[sizeof(s)];                    // For publishing

    /*
        // Alternate Option with anonymous struct, but manual byte count:

        struct __attribute__((__packed__)){  // packed to eliminate padding for easier parsing.
            char charAry[10];       // 10 x 1 byte  =   10 bytes
            int16_t val1;           // 1 x  2 bytes =   2 bytes
            unsigned long val2;     // 1 x  4 bytes =   4 bytes
            uint16_t val3;          // 1 x  2 bytes =   2 bytes
                                            -------------------
                                            TOTAL =    18 bytes
        };
        uint8_t raw[18];                    // For publishing
*/

} packet_t;

/*************************** Sketch Code ************************************/

// Bug workaround for Arduino 1.6.6, it seems to need a function declaration
// for some reason (only affects ESP8266, likely an arduino-builder bug).
void MQTT_connect();

void setup() {
  Serial.begin(115200);
  delay(10);
  pinMode(D1,INPUT); 

  Serial.println(F("Adafruit MQTT demo"));

  // Connect to WiFi access point.
  Serial.println(); Serial.println();
  Serial.print(F("Connecting to "));
  Serial.println(WLAN_SSID);

  WiFi.begin(WLAN_SSID, WLAN_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(F("."));
  }
  Serial.println();

  Serial.println(F("WiFi connected"));
  Serial.println(F("IP address: ")); Serial.println(WiFi.localIP());

}

packet_t arbPac;

const char strVal[] PROGMEM = "Hello!";

void loop() {
  // Ensure the connection to the MQTT server is alive (this will make the first
  // connection and automatically reconnect when disconnected).  See the MQTT_connect
  // function definition further below.
  MQTT_connect();

  //Update arbitrary packet values
  strcpy_P(arbPac.s.charAry, strVal);
  arbPac.s.val1 = -4533;
  arbPac.s.val2 = millis();
  arbPac.s.val3 = 3354;

  /*
   // Alternate Union with anonymous struct
   // (see union declaration above)

     strcpy_P(arbPac.charAry, strVal);
     arbPac.val1 = -4533;
     arbPac.val2 = millis();
     arbPac.val3 = 3354;
  */
int value = digitalRead(sensor);
int cvalue = 1-value;
Serial.println(cvalue);
delay(10);
  if (! ap.publish(cvalue))
        Serial.println(F("Publish Failed."));
        delay(500);
      else {
        Serial.println(F("Publish Success!"));
        delay(500);
      }

      delay(2000);// it should be proper otherwise if less than needed than
      //THROTTLE WARNING: user name data rate limit reached, 15 seconds until throttle released kind of sms will be seen and after few secxonds project will be closed by adafruit



  // ping the server to keep the mqtt connection alive
  // NOT required if you are publishing once every KEEPALIVE seconds
  /*
  if(! mqtt.ping()) {
    mqtt.disconnect();
  }
  */
}

// Function to connect and reconnect as necessary to the MQTT server.
// Should be called in the loop function and it will take care if connecting.
void MQTT_connect() {
  int8_t ret;

  // Stop if already connected.
  if (mqtt.connected()) {
    return;
  }

  Serial.print(F("Connecting to MQTT... "));

  uint8_t retries = 3;
  while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
       Serial.println(mqtt.connectErrorString(ret));
       Serial.println(F("Retrying MQTT connection in 5 seconds..."));
       mqtt.disconnect();
       delay(5000);  // wait 5 seconds
       retries--;
       if (retries == 0) {
         // basically die and wait for WDT to reset me
         while (1);
       }
  }
  Serial.println(F("MQTT Connected!"));

 
}

Nimbleq
 
Posts: 1
Joined: Tue Sep 24, 2019 6:01 am

Re: THROTTLE WARNING

by brubell on Mon Jan 13, 2020 10:42 am

Your loop is sending new data to Adafruit IO every 2.51 seconds. So, 23.90 data points/min.

Adafruit IO's free tier has a data rate of 30 data points per minute, you shouldn't be seeing that warning.

Could you run your sketch again with this page open (http://io.adafruit.com/monitor). Please screenshot the page, make sure it shows the Live Data and Live Errors sections. This'll help me diagnose exactly what the issue is.

Thanks,

Brent R.

brubell
 
Posts: 696
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.


cron