Update: Unexplained rapid data sends to Cayenne

Update:
Could this be caused by the current MQTT connection problem? The unit is being randomly disconnected but I thought it was due to rate limiting, which it probably is, yet I don’t understand how my device or code could be the cause the repetitive transmits. Another device is doing a similar thing now.
John

It appears this device is being occasionally rate limited. It normally updates every 30 sec, but the log shows much more than that randomly. Any ideas?
Thanks
John


#include <CayenneMQTTESP8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define SENSOR_PIN 14 // AC Fail
#define SENSOR_PIN 16 // Status
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
#include <DHT_U.h>
#define DHTPIN 5
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

char ssid = “J”;
char wifiPassword = “x”;
char username = “x”;
char password = “x”;
char clientID = “x”;

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
DeviceAddress tempSensorA = { 0x28, 0xFF, 0x57, 0x8A, 0xC3, 0x17, 0x04, 0x1A };
DeviceAddress tempSensorB = { 0x28, 0xFF, 0x81, 0xC4, 0xB3, 0x17, 0x01, 0xFD };

unsigned long lastMillis = 0;

void setup()
{
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
pinMode(12, OUTPUT);

dht.begin();
sensor_t sensor;
sensors.begin();

//set the resolution to 10 bit
sensors.setResolution(tempSensorA, 10);
sensors.setResolution(tempSensorB, 10);
}

void loop() {
Cayenne.loop();

//Publish data every 30 seconds.
if (millis() - lastMillis > 30000)
{
lastMillis = millis();
sensors_event_t event;

Cayenne.virtualWrite(5, dht.readTemperature(true),"temp","f");
Cayenne.virtualWrite(4, dht.readHumidity(),"rel_hum","p");

sensors.requestTemperatures();
Cayenne.fahrenheitWrite(9, sensors.getTempF(tempSensorA));
Cayenne.fahrenheitWrite(10, sensors.getTempF(tempSensorB));

Cayenne.virtualWrite(14, digitalRead(14), "digital_sensor", "d"); // ac fail
Cayenne.virtualWrite(16, digitalRead(16), "digital_sensor", "d"); // status

int battReading = analogRead(A0); // read the input on analog pin 0  // Battery
float volts = battReading * 3.3;  // converting that reading to voltage, which is based off the reference voltage
volts /= 1024.0;
float volts1 = volts * 2.62;  // factor to correct for external voltage divider on ADC input
Cayenne.virtualWrite(17, volts1, "voltage", "v");

long rssi = WiFi.RSSI();
Cayenne.virtualWrite(6, rssi, "rssi", "dbm");    
}

}
// This function is called when data is sent from Cayenne.
CAYENNE_IN(12)
{
int value = getValue.asInt();
// Write the value received to the digital pin.
digitalWrite(12, value);
}

Log:

2018-04-16 11:55:41Bigg’s66 RSSI6599d0a0-3228-11e8-aa1d-e5677d2125cerssidbm-49
2018-04-16 11:55:41Bigg’s9Upright Freezer62dc5e50-3228-11e8-822e-bbf389efce87tempf-7.6
2018-04-16 11:55:41Bigg’s1616 Status671d1540-3228-11e8-ac80-85ded0fe5d33digital_sensord1
2018-04-16 11:55:41Bigg’s10Chest Freezer61e2e320-3228-11e8-af7b-4f8845dd6501tempf10.85
2018-04-16 11:55:41Bigg’s1717 Battery67bd73f0-3228-11e8-b59c-db84183bf26bvoltagev4.661
2018-04-16 11:55:41Bigg’s14AC Power608d1720-3228-11e8-a353-951fa95ba610digital_sensord1
2018-04-16 11:55:41Bigg’s5Room Temp635a40e0-3228-11e8-b59c-db84183bf26btempf67.28
2018-04-16 11:55:07Bigg’s1717 Battery67bd73f0-3228-11e8-b59c-db84183bf26bvoltagev4.661
2018-04-16 11:55:07Bigg’s66 RSSI6599d0a0-3228-11e8-aa1d-e5677d2125cerssidbm-48
2018-04-16 11:55:07Bigg’s1616 Status671d1540-3228-11e8-ac80-85ded0fe5d33digital_sensord1
2018-04-16 11:55:07Bigg’s14AC Power608d1720-3228-11e8-a353-951fa95ba610digital_sensord1
2018-04-16 11:55:07Bigg’s9Upright Freezer62dc5e50-3228-11e8-822e-bbf389efce87tempf-7.6
2018-04-16 11:55:07Bigg’s10Chest Freezer61e2e320-3228-11e8-af7b-4f8845dd6501tempf11.75
2018-04-16 11:55:07Bigg’s4Humidity60970230-3228-11e8-ab82-a3edb533e078rel_hump35
2018-04-16 11:55:07Bigg’s5Room Temp635a40e0-3228-11e8-b59c-db84183bf26btempf67.1
2018-04-16 11:54:46Bigg’s14AC Power608d1720-3228-11e8-a353-951fa95ba610digital_sensord1
2018-04-16 11:54:46Bigg’s10Chest Freezer61e2e320-3228-11e8-af7b-4f8845dd6501tempf10.4
2018-04-16 11:54:46Bigg’s4Humidity60970230-3228-11e8-ab82-a3edb533e078rel_hump35
2018-04-16 11:54:46Bigg’s1616 Status671d1540-3228-11e8-ac80-85ded0fe5d33digital_sensord1
2018-04-16 11:54:46Bigg’s1717 Battery67bd73f0-3228-11e8-b59c-db84183bf26bvoltagev4.661
2018-04-16 11:54:46Bigg’s66 RSSI6599d0a0-3228-11e8-aa1d-e5677d2125cerssidbm-48
2018-04-16 11:54:46Bigg’s5Room Temp635a40e0-3228-11e8-b59c-db84183bf26btempf67.28
2018-04-16 11:54:46Bigg’s9Upright Freezer62dc5e50-3228-11e8-822e-bbf389efce87tempf-7.6
2018-04-16 11:54:38Bigg’s66 RSSI6599d0a0-3228-11e8-aa1d-e5677d2125cerssidbm-49
2018-04-16 11:54:38Bigg’s4Humidity60970230-3228-11e8-ab82-a3edb533e078rel_hump35
2018-04-16 11:54:38Bigg’s1616 Status671d1540-3228-11e8-ac80-85ded0fe5d33digital_sensord1
2018-04-16 11:54:38Bigg’s14AC Power608d1720-3228-11e8-a353-951fa95ba610digital_sensord1
2018-04-16 11:54:38Bigg’s10Chest Freezer61e2e320-3228-11e8-af7b-4f8845dd6501tempf11.75
2018-04-16 11:54:38Bigg’s1717 Battery67bd73f0-3228-11e8-b59c-db84183bf26bvoltagev4.661
2018-04-16 11:54:38Bigg’s5Room Temp635a40e0-3228-11e8-b59c-db84183bf26btempf67.1
2018-04-16 11:54:38Bigg’s9Upright Freezer62dc5e50-3228-11e8-822e-bbf389efce87tempf-7.6
2018-04-16 11:54:27Bigg’s5Room Temp635a40e0-3228-11e8-b59c-db84183bf26btempf67.1
2018-04-16 11:54:27Bigg’s1717 Battery67bd73f0-3228-11e8-b59c-db84183bf26bvoltagev4.661
2018-04-16 11:54:27Bigg’s14AC Power608d1720-3228-11e8-a353-951fa95ba610digital_sensord1
2018-04-16 11:54:27Bigg’s4Humidity60970230-3228-11e8-ab82-a3edb533e078rel_hump35
2018-04-16 11:54:27Bigg’s9Upright Freezer62dc5e50-3228-11e8-822e-bbf389efce87tempf-7.6
2018-04-16 11:54:27Bigg’s66 RSSI6599d0a0-3228-11e8-aa1d-e5677d2125cerssidbm-48
2018-04-16 11:54:27Bigg’s1616 Status671d1540-3228-11e8-ac80-85ded0fe5d33digital_sensord1
2018-04-16 11:54:27Bigg’s10Chest Freezer61e2e320-3228-11e8-af7b-4f8845dd6501tempf11.3
2018-04-16 11:54:20Bigg’s9Upright Freezer62dc5e50-3228-11e8-822e-bbf389efce87tempf-7.6
2018-04-16 11:54:20Bigg’s14AC Power608d1720-3228-11e8-a353-951fa95ba610digital_sensord1
2018-04-16 11:54:20Bigg’s5Room Temp635a40e0-3228-11e8-b59c-db84183bf26btempf67.28
2018-04-16 11:54:19Bigg’s1616 Status671d1540-3228-11e8-ac80-85ded0fe5d33digital_sensord1
2018-04-16 11:54:19Bigg’s5Room Temp635a40e0-3228-11e8-b59c-db84183bf26btempf67.28
2018-04-16 11:54:19Bigg’s66 RSSI6599d0a0-3228-11e8-aa1d-e5677d2125cerssidbm-48
2018-04-16 11:54:19Bigg’s4Humidity60970230-3228-11e8-ab82-a3edb533e078rel_hump35
2018-04-16 11:54:19Bigg’s10Chest Freezer61e2e320-3228-11e8-af7b-4f8845dd6501tempf9.95
2018-04-16 11:54:19Bigg’s10Chest Freezer61e2e320-3228-11e8-af7b-4f8845dd6501tempf10.4
2018-04-16 11:54:19Bigg’s4Humidity60970230-3228-11e8-ab82-a3edb533e078rel_hump35
2018-04-16 11:54:00Bigg’s1616 Status671d1540-3228-11e8-ac80-85ded0fe5d33digital_sensord1