How to delete widget log history


#1

Hi,
I’m running a BMP180 and have log data that is erroneous due to my testing. Now that the system is working, I want to delete the test data and start collecting real numbers. Can anyone tell me how to delete the old logged data?

Cheers,
Brian


#2

What connection method are you using for your device? Pi Agent, MQTT, Arduin, etc? For most you just want to delete and re-add the widget to erase history.


#3

Hi Adam, I’m using an Arduino. Yes I can delete the widget, thanks.

BTW on a different subject, I’ve noticed that the data package update time can vary from 5 sec to 25 sec between packets. Is this normal? My Android app is frequently not seeing the live project, and I’m wondering if this is the reason.

Cheers,
Brian


#4

25 seconds seems a bit long. I usually see about 7 seconds, but it can be anywhere from 5-10 seconds. When you said you are not seeing the live project, do you mean just that you don’t see the last 30 seconds or so?


#5

Hi Adam,
The list of projects on my phone are greyed out if the sensor/Adruino is offline and black when it is online. I noticed that the active project would appear to be offline (grey) even though the Arduino was still connected to the internet. Later it would be black again as though the phone app couldn’t always see the Cayenne server.

Cheers,
Brian


#6

I understand now. Can you share your code? There are a few common things that will make your device show up as offline - not calling cayenne.run() often being the most common.


#7
//#define CAYENNE_DEBUG             // Uncomment to show debug messages
#define CAYENNE_PRINT Serial        // Comment this out to disable prints and save space
#include <CayenneEthernet.h>        // Comment this out if you uncomment a different Ethernet device below.
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>

// Virtual Pins of the BMP180 widget.
#define BAROMETER_PIN V1
#define TEMPERATURE_PIN V2

Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10180);
bool bmpSensorDetected = true;

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "...";  // House Security

// Virtual Pin of the widget.
#define DoorButton V0 // Virtual pin for Door Button on Dashboard
#define RELAY_DIGITAL_PIN 3 // Door close relay pin
#define DoorClosedSensorPin 4 // Door Position sensor 

void setup()
{
  // set digital pin to output
  pinMode(RELAY_DIGITAL_PIN, OUTPUT);
  digitalWrite(RELAY_DIGITAL_PIN, HIGH); // set initial relay state to normally open
  pinMode(DoorClosedSensorPin, INPUT);
  
  Serial.begin(9600);
  Cayenne.begin(token); // use with auto ID on network
//  Cayenne.begin(token, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac); // use with manual ID on network

  if (!bmp.begin())
  {
    CAYENNE_LOG("No BMP sensor detected");
    bmpSensorDetected = false;
  }

}

void loop()
{
  Cayenne.run();
}

  CAYENNE_IN(DoorButton) // Get current value of Close Door button
{
//  boolean DoorClosedSensor = digitalRead(DoorClosedSensorPin);
  if (digitalRead(DoorClosedSensorPin) == 0) {
    // get value sent from dashboard
    int currentValue = getValue.asInt(); // 0 to 1
    Serial.println(currentValue);
    
    // assuming you wire your relay as normally open
    if (currentValue == 0) {
      digitalWrite(RELAY_DIGITAL_PIN, HIGH);
    } else {
      digitalWrite(RELAY_DIGITAL_PIN, LOW);
    }
  }
}

// This function is called when the Cayenne widget requests data for the barometer's Virtual Pin.
CAYENNE_OUT(BAROMETER_PIN)
{
  if (bmpSensorDetected)
  {
    // Send the command to get data.
    sensors_event_t event;
    bmp.getEvent(&event);
    float Pressure;
    Pressure = event.pressure;
    float hPa = Pressure/100;
    Serial.println(Pressure);

    if (event.pressure)
    {
      // Send the value to Cayenne in hectopascals.
      Cayenne.hectoPascalWrite(BAROMETER_PIN, hPa);
    }
  }
  else
  {
    CAYENNE_LOG("No BMP sensor detected");
  }
}

// This function is called when the Cayenne widget requests data for the temperature's Virtual Pin.
CAYENNE_OUT(TEMPERATURE_PIN)
{
  if (bmpSensorDetected)
  {
    float temperature;
    bmp.getTemperature(&temperature);
    // Send the value to Cayenne in Celsius.
    Cayenne.celsiusWrite(TEMPERATURE_PIN, temperature);
  }
  else
  {
    CAYENNE_LOG("No BMP sensor detected");
  }
}

#8

The code looks good to me… @rsiegel any ideas?


#9

Interestingly, the connection has been rock solid today, unlike yesterday. But I’ve got another system anomaly that is happening on the hour, every hour. My BMP180 signals are momentarily dipping on Temp and Pressure every hour
image
image

Any thoughts on this?


#10

Is this new? Are the graphs any different on your android app?


#11

I’ve only had the project running with the BMP180 for two days, so cannot comment on how long it has been happening, but yes it is on both. Here are the 2pm screenshots of the PC and the Android app
image


#12

At 3pm today, I had a spike on both the PC and the Android app
image


#13

I saw this issue before but can’t seem to find the thread after scrolling through a couple hundred search results. Can you log the temp to debug and then compare when you see an error in the graph to what you see in the debug?


#14

How do I log to debug? That is a function I’ve not used


#15

I should have said log to serial output. You can use Serial.print() to do that.


#16

Yes, can do


#17

Ok, here are the 1pm results. Firstly the visuals

And now the BMP180 output. These number span 12:29 to 13:01. As you can see there is no dip in the sensor numbers…

[5001] Connecting to arduino.mydevices.com:8442
[7293] Ready (ping: 1956ms).
0
25.80 1014.45
25.80 1014.43
25.80 1014.40
25.80 1014.40
25.80 1014.42
25.80 1014.44
25.80 1014.34
25.80 1014.38
25.80 1014.36
25.80 1014.39
25.80 1014.43
25.80 1014.34
25.80 1014.32
25.80 1014.34
25.80 1014.35
25.80 1014.42
25.80 1014.32
25.80 1014.38
25.80 1014.41
25.80 1014.32
25.80 1014.40
25.80 1014.29
25.80 1014.43
25.80 1014.37
25.80 1014.31
25.80 1014.35
25.80 1014.34
25.80 1014.41
25.80 1014.37
25.80 1014.38
25.80 1014.43
25.80 1014.27
25.80 1014.36
25.80 1014.40
25.80 1014.36
25.80 1014.36
25.80 1014.35
25.80 1014.32
25.80 1014.39
25.80 1014.35
25.80 1014.36
25.80 1014.39