I´m using an ESP and an Bosch BMP180 sensor to monitor our office enviroment over MQTT.
Everything works, i can see the values and they are refreshing like a charm but when i use the preconfigured “Value” boxes on the dashboard which are popping up after the device delivers data.
When i ad a new Gauge widget the gauge will display for about 5 sec the real data and after that it shows 0.00.
When i switch to the data tab in devices and back to dashboard the again gauge will display the right value and after a refresh when new datas are cumming in, the gauge will fall to 0.
The chart widget does also show “no data for this period”.
The simple Value Widgets are working fine and i can see under data that the values are being transmitted and saved.
I´ve tried multiple Borwsers…that is not the issue. Also the iOS App shows this error.
Dashboard after few seconds:
Dashboard directly after switching from data:
Here is the Link to the public dashboard if it helps:
https://cayenne.mydevices.com/shared/599296f71e7f7d35d51ca803
can you share the code you are using.
here is the code:
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10
Adafruit_BME280 bme; // I2C
// WiFi network info.
char ssid[] =
char wifiPassword[] =
char username[] =
char password[] =
char clientID[] =
unsigned long lastMillis = 0;
void setup() {
Serial.begin(115200);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
bme.begin();
}
void loop() {
Cayenne.loop();
}
CAYENNE_OUT_DEFAULT()
{
int P;
Cayenne.virtualWrite(0, millis());
Cayenne.virtualWrite(1, bme.readTemperature());
P = bme.readPressure() / 100.0F;
Cayenne.virtualWrite(2, P);
Cayenne.virtualWrite(3, bme.readHumidity());
}
First delete all the widgets from the dashboard, then make the below changes into your code and upload it. this will populate your dashboard with widget, add them.
int p;
CAYENNE_OUT_DEFAULT()
{
Cayenne.virtualWrite(0, millis());
Cayenne.virtualWrite(1, bme.readTemperature(), "temp", "c");
P = bme.readPressure() / 100.0F;
Cayenne.virtualWrite(2, P, "bp", "pa");
Cayenne.virtualWrite(3, bme.readHumidity(), "rel_hum", "p");
}
Have a look at this Data types for Cayenne MQTT API
Thanks a lot, that solves the problem.
I´ve not found this Data Type topic in the official Cayenne manual.
Maybe a more visual place would be helpful…
2 Likes