Data from ESP8266 does not arrive on dashboard

Hi there,

@Alseb3 reported that he is having problems seeing data on his dashboard.

With kind regards,

Dear Sayed,

Your Beekeeper ID is "yqLBxx", but apparently no data has arrived for that yet. You can watch the output of

mosquitto_sub -h -t '#' -v

to verify data from your device is getting through.

Maybe, if it won’t work even after trying harder, you can share the code you are using on your ESP8266?

With kind regards,

Actually I don’t think it’s a code issue, it looks like some thing needs to be done on the dashboard.

The source code I am using.
#define WEIGHT                  true
#define SENSOR_BATTERY_LEVEL    false  // Falls Spannungsmessung ĂĽber Spannungsteiler erfolgen soll, wenn kein SIM800 Modul verwendet wird.
#define DEEPSLEEP_ENABLED       true   // Code ist aktuell nur auf TRUE ausgelegt, falls False, muĂź noch im main() ein Delay eingebaut werden.
#define SLEEP_TIMER             true   // Sleep-Dauer abhängig vom Ladezustand, Sleep_Timer noch nicht mit Wifi verifziert.
#define WUNDERGROUND            false  // Funktionert aktuell nur mit GSM_ENABLED false
#define SHT             true  // Temp&Humidity
#define WIFI_ACTIVE true

  int adc_level;

// Variablen für Spanungsmessung, werden unabhängig der Messmethode (Spannungsteiler o. SIM800 Modul benötigt)
int volt_level;
float voltage;
float temp=0;
float humid=0;
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>

#include <Wire.h>
#include "SparkFunHTU21D.h"

//Create an instance of the object
HTU21D myHumidity;

//Library for WifiManager
#include <ESP8266WebServer.h>

  #include <WiFiManager.h>         //


  #include <EEPROM.h>
  int power_save_mode;
  int address = 1;     // WillkĂĽrlich von mir festgelegt das im EEPROM an Adresse 1 der Wert fĂĽr den Ladezustand abgelegt wird.
  int voltbe4;         // Wert der vorherigen Messung 
  int voltbelow = 75;  // Schwellwert für die Aktivierung des PowerSave Modus (Verlängerung des SleepTimers auf 60 min)

int sleepTimeS = 900;  // 15-Minuten SleepTimer als Startwert

// Adafruit MQTT
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"

// JSON serializer
#include <ArduinoJson.h>

// ----
// ----

// Note that the "testdrive" channel as outlined within "MQTT_TOPIC" is not
// authenticated and can be used anonymously.
// To publish data to a personal data channel, please ask for appropriate
// credentials at or
// Documentation:

// How often to retry connecting to the MQTT broker
#define MQTT_RETRY_COUNT    5

// How long to delay between MQTT (re)connection attempts (seconds)
#define MQTT_RETRY_DELAY    1.5f

// The address of the MQTT broker to connect to
#define MQTT_BROKER         ""
#define MQTT_PORT           1883

// A MQTT client ID, which should be unique across multiple devices for a user.
// Maybe use your MQTT_USERNAME and the date and time the sketch was compiled
// or just use an UUID ( or other random value.

// Hier eigenen Wert eintragen.
#define MQTT_CLIENT_ID      "yqLBxx"

// The credentials to authenticate with the MQTT broker.
// Eigene Login-Daten beim netten Team von Hiveeyes anfragen (s.o.)
#define MQTT_USERNAME       ""
#define MQTT_PASSWORD       "{redacted}"

// The MQTT topic to transmit sensor readings to.
#define MQTT_TOPIC          "hiveeyes/testdrive/area-42/node-1/data.json"


  WiFiClient client;
  WiFiClient clientMQTT;


// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details

// Setup MQTT publishing handler
Adafruit_MQTT_Publish mqtt_publisher = Adafruit_MQTT_Publish(&mqtt, MQTT_TOPIC);


  #include <HX711.h>
  #include <RunningMedian.h>  //
  #define SCALE_DOUT_PIN_A 0 // DT
  #define SCALE_SCK_PIN_A 2 // SCK

  //#define SCALE_DOUT_PIN_B D2 // DT
  //#define SCALE_SCK_PIN_B D1 // SCK

  HX711 scale_A;
  //HX711 scale_B;

  long AktuellesGewicht_A = 0;
  //long AktuellesGewicht_B = 0;

  float Taragewicht_A = 186.5;  // Enter the value from the calibration here
  float Skalierung_A = 22.22;  // Enter the value from the calibration here
  //float Taragewicht_B = -238537;  // Hier ist der Wert aus der Kalibrierung einzutragen
  //float Skalierung_B = -42.614;  // Hier ist der Wert aus der Kalibrierung einzutragen

  long Gewicht_A = 999999;
  float GewichtEinzelmessung_A;

  //long Gewicht_B = 999999;
  //float GewichtEinzelmessung_B;

  // create RunningMedian object with 10 readings
  RunningMedian GewichtSamples_A = RunningMedian(10);
  //RunningMedian GewichtSamples_B = RunningMedian(10);


#if SENSOR_DS18B20

  // Temperatur Sensoren DS18B20 connectet to Pin D5
  #define DS18B20_PIN D5
  // 1-Wire library
  #include <OneWire.h>
  // DS18B20/DallasTemperature library
  #include <DallasTemperature.h>
  // For communicating with any 1-Wire device (not just DS18B20)
  OneWire oneWire(DS18B20_PIN);
  // Initialize DallasTemperature library with reference to 1-Wire object
  DallasTemperature sensors(&oneWire);
  // Device Adresses - dedected by oneWireSearch.ino or Multiple similar
  // Update device adress
  uint8_t Sensor1 [8] = { 0x28, 0xFF, 0xCF, 0xBD, 0xA4, 0x16, 0x04, 0x46 };  // Nr. 3 grĂĽne Schrift
  uint8_t Sensor2 [8] = { 0x28, 0xFF, 0x67, 0x65, 0x51, 0x16, 0x04, 0xEE }; // langes Kabel
  // Define Variable to hold temperature value for Sensor1
  float temps1;
  // Define Variable to hold temperature value for Sensor2
  float temps2;



  // Weatherundeground
  const char* weatherhost = "";
  // TextFinder Lib used for text extractation of XML Data
  #include <TextFinder.h>
  // Define variable as "char" as they will be extracted via finder.string of XML Data
  char currentTemp[8];
  char currentHumidity[8];
  // Weatherunderground Station - Alternative Station IMNCHEN1945
  const char*  WUG_Station = "IMANAM4";


bool mqtt_connect();
void transmit_readings();
void setup_weight();
void read_weight();
void setup_tempsensor();
void read_tempsensor();
void read_battery_level();
void power4sleep();
void read_weatherunderground();

void setup() {

  Serial.println("Booting Wifi Mode ");

  // Start Wifi Manager to connect
  WiFiManager wifiManager;


  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");

    Serial.println("ESP8266 in sleep for 1 min mode");
    ESP.deepSleep(60 * 1000000, WAKE_RF_DEFAULT);



  Serial.print("IP address: ");





void loop() {
  humid = myHumidity.readHumidity();
  temp = myHumidity.readTemperature();
  if (!mqtt_connect()) {





  #ifdef SLEEP_TIMER



      ESP.deepSleep(sleepTimeS * 1000000, WAKE_RF_DEFAULT);

  // This is currently still missing: What do we do if there is no DeepSleep, i.e. we stay in Main ()
  // delay (60 * 1000)


void setup_weight() {

  #if WEIGHT

    scale_A.begin(SCALE_DOUT_PIN_A, SCALE_SCK_PIN_A);
//    scale_B.begin(SCALE_DOUT_PIN_B, SCALE_SCK_PIN_B);

    // Waage A Setup
    // Waage B Setup
//    scale_B.set_offset(Taragewicht_B);
//    scale_B.set_scale(Skalierung_B);


void read_weight() {

  #if WEIGHT
    //clearRunningMedian Sample
  //  GewichtSamples_B.clear();

    // read x times weight and take median
    // do this till running median sample is full
    while (GewichtSamples_A.getCount() < GewichtSamples_A.getSize()) {

      // wait between samples

      // power HX711 / load cell
//      scale_B.power_up();

      delay(2);  // wait for stabilizing

      // read raw data input of HX711
      GewichtEinzelmessung_A =;
//      GewichtEinzelmessung_B =;

      // switch off HX711 / load cell
 //     scale_B.power_down();

      // calculate weight in kg
      Gewicht_A = (GewichtEinzelmessung_A - Taragewicht_A) / Skalierung_A;
//      Gewicht_B = (GewichtEinzelmessung_B - Taragewicht_B) / Skalierung_B;

      // use calculated kg values for median statistic
 //     GewichtSamples_B.add(Gewicht_B);

      AktuellesGewicht_A = GewichtSamples_A.getMedian();
 //     AktuellesGewicht_B = GewichtSamples_B.getMedian();

      Serial.print("Gewicht A: ");
      Serial.println(" g");
 //     Serial.print("Gewicht B: ");
 //     Serial.print(AktuellesGewicht_B);
 //     Serial.println(" g");

bool mqtt_connect() {

  // If already connected, don't do anything and signal success
  if (mqtt.connected()) {
    return true;

  Serial.println("Connecting to MQTT broker");

  // Reconnect loop
  uint8_t retries = MQTT_RETRY_COUNT;
  int8_t ret;
  while ((ret = mqtt.connect()) != 0) {

    Serial.println("Anzahl MQTT Connection Retries:");

    if (retries == 0) {
      Serial.println("Giving up connecting to MQTT broker");
      // Falls keine MQTT Verbindung aufgebaut werden kann, hängen wir hier ewig in der Schleife
      // da solange die Funktion mqtt.connect aufgerufen wird
      // deshalb fangen wir von vorne an in dem wir den ESP 1min schlafen geht und die Schleife von vorne beginnt

      // Sleep fĂĽr 60 Sekunden.

          ESP.deepSleep(60 * 1000000, WAKE_RF_DEFAULT);

      return false;

    Serial.println("Retry MQTT Connection in x Seconds:");

    // Wait some time before retrying
    delay(MQTT_RETRY_DELAY * 1000);

  if (mqtt.connected()) {

    Serial.println("Successfully connected to MQTT broker");

    return true;

  // Giving up on further connection attempts
  return false;

void setup_tempsensor() {

#if SENSOR_DS18B20

  Serial.println("Temperaturmessung mit dem DS18B20 ");

  // Start Dallas Temperature Library / Instanz
  sensors.begin();  // DS18B20 starten

  // Präzision auf 12 Bit
#ifndef TEMP_12_BIT
#define TEMP_12_BIT 0x7F // 12 bit

  //Anzahl Sensoren ausgeben
  Serial.print("Sensoren: ");



void read_tempsensor() {

#if SENSOR_DS18B20

  // Temperatursensor(en) auslesen

  // Read Temperature form each Sensor
  temps1 = sensors.getTempC(Sensor1);
  temps2 = sensors.getTempC(Sensor2);



void read_battery_level() {


  // Read the battery level from the ESP8266 analog input pin.
  // Analog read level is 10 bit 0-1023 (0V-1V).
  // Our 1M & 220K voltage divider takes the max
  // MY 1M & 3,3 K
  // LiPo value of 4.2V and drops it to 0.758V max.
  // This means our minimum analog read value should be 580 (3.14V)
  // and the maximum analog read value should be 774 (4.2V).

   // Read Value from A0 - max 3.3V, daher etwas andere Teiler
  // 1024 / 3,3  * 1,73 = 537 1,73V laut spannungsteiler bei 4,2 V mit 4,7k & 3,3k
  // 1024 / 3,3  * 1,3 = 400 1,3V lt. spannungsteiler bei 3,14 V mit 4,7k & 3,3 k

  adc_level = analogRead(A0);
  Serial.print("ADC_level: ");

  // Map Value to % Level
  volt_level = map(adc_level, 400, 537, 0, 100);

  // Calculate Voltage Value
  Serial.print("Voltage: ");
  voltage = adc_level * 4.2 / 537 ;
  Serial.println( voltage );
  // Give operating system / watchdog timer some breath

void power4sleep() {



  //letzten Ladungsstand Wert aus EEprom auslesen
  voltbe4 =;
  Serial.print("Read Value:");

  //aktuellen Ladungsstand Wert in EEprom ablegen
  EEPROM.write(address, volt_level );

  if (volt_level < voltbelow && voltbe4 < voltbelow )
    // If the charge value is below 75%, the sleep duration is extended to 60 min (= 3600 seconds)
    sleepTimeS = 3600;
    power_save_mode = 1;
    // If the charge value is over 75%, the sleep duration is set to 15 min (= 900 seconds)
    sleepTimeS = 900;
    power_save_mode = 0;

    Serial.print("Set Sleep Timer to:");
    Serial.print("Set Power Save to:");


void read_weatherunderground() {

// Function provides current temperature and air humidity of a weather station in the area of ​​Weatherunderground
  // My station is IMANAM4 - if necessary, select a nearby station via the Weatherunderground website.


  if (client.connect(weatherhost, 80))
    String wurl = "/weatherstation/WXCurrentObXML.asp?ID=IMANAM4" ;
    client.print(String("GET ") + wurl + " HTTP/1.1\r\n" + "Host: " + weatherhost + "\r\n" +  "Connection: close\r\n\r\n");

    while (!client.available()) {
      //  delay(200);
      Serial.print("client not availabel connect: ");

    // Read all the lines of the reply from server and print them to Serial
    TextFinder finder(client);  // No idea why - but the text finder won't work without intancing

    //   while (client.available()) {
    String line = client.readStringUntil('\r');

    finder.getString("<temp_c>", "</temp_c>", currentTemp, 8) ;

    finder.getString("<relative_humidity>", "</relative_humidity>", currentHumidity, 8) ;

    Serial.println("closing connection");



void transmit_readings() {

  // Build JSON object containing sensor readings
  // TODO: How many data points actually fit into this?
  StaticJsonBuffer<1024> jsonBuffer;

  // Create telemetry payload by manually mapping sensor readings to telemetry field names.
  // Note: For more advanced use cases, please have a look at the TerkinData C++ library
  JsonObject& json_data = jsonBuffer.createObject();

    json_data["WXD_Temp"]        = currentTemp;
    json_data["WXD_Humi"]        = currentHumidity;

  #if SHT
    json_data["Temp"]           = temp;
    json_data["Humid"]           = humid;

  #if WEIGHT
    json_data["Waage1"]          = AktuellesGewicht_A;
    //json_data["Waage2"]          = AktuellesGewicht_B;

     json_data["power"]          = power_save_mode;

  json_data["volt_level"]        = volt_level;
  json_data["voltage"]           = voltage;

  // Debugging

  // Serialize data
  int json_length = json_data.measureLength();
  char payload[json_length + 1];
  json_data.printTo(payload, sizeof(payload));

  // Publish data
  // TODO: Refactor to TerkinTelemetry
  if (mqtt_publisher.publish(payload)) {
    Serial.println("MQTT publish succeeded");
  } else {
    Serial.println("MQTT publish failed");


Hi again,

It looks like you are using a modified version of @Stefan’s node-esp8266-generic.ino, right?

At this place:

you should be using something like

#define MQTT_TOPIC          "hiveeyes/yqLBxx/my-location-01/my-node-01/data.json"

Please replace my-location-01 and my-node-01 with anything that fits your needs.

Notwithstanding the above, "mosquitto_sub -h -t '#' -v" doesn’t show any data arriving on the MQTT topic "hiveeyes/testdrive/area-42/node-1" from you either, only one submission going to the subtopic message-jsonhive-teststand, which is apparently a Homie device.

With kind regards,

Hi once more,

did you also actually recognize the fork of the Adafruit_MQTT_Library library, where the MQTT buffer size has been increased?

Essentially, this line of the PlatformIO configuration used for building this sketch pulls in the commit, adjusting MAXBUFFERSIZE more appropriately, see also Inbetriebnahme der DatenĂĽbertragung per MQTT und TinyGSM-Bibliothek ĂĽber SIM800-Modul auf ESP8266 - #23 by Stefan.

With kind regards,

yes i use that sketch with minor modification, where i can use this " "mosquitto_sub -h -t '#' -v""
actually i am not expert in programing only hobbies!
thanks very much for support,
i had change for trail #define MQTT_TOPIC “hiveeyes/yqLBxx/my-location-01/my-node-01/data.json”
and run the sketch

You can use it on any system’s terminal where you can install the Mosquitto MQTT broker and its client tools. For example:

# Install on Debian Linux
apt-get install mosquitto-clients

# Install on macOS/Homebrew
brew install mosquitto

However, you can also watch the stream of transmissions at without the need to install anything on your workstation.

Maybe also, just to be more safe than sorry, modify this setting to “#define SLEEP_TIMER false”.

i had disable this,
how i can setup the dashboard to receive the sent data from ESP8266,

Dear Sayed,

have you been able to confirm that data transmissions from your device are arriving on the MQTT bus, for example through

Otherwise, there will be no data to display on the dashboard.

With kind regards,

1 Like

just i confirm there is issue with my gateway ip is not correct,
also i had noticed that i have issue with scale initialization,
i will use another library which was working for me on normal sketch,

further more it success after i used another library for Hx711, now looks it is transmit the data to Wtee,
now how to setup dashboard and display the data?

1 Like

Indeed, congratulations.

hiveeyes/yqLBxx/my-location-01/my-node-01/data.json {"WXD_Temp":"","WXD_Humi":"","Temp":21.2651,"Humid":66.53265,"Weight":0,"volt_level":0,"voltage":0}

Corresponding dashboards should have been created automatically. Here we go:

You can adjust them to your own needs and use “Save as…” to save them under a different name. Enjoy!

Please note that both values now have been saved as strings into the database and can not be augmented to float values again, see also Data acquisition for specific measurement fields gets rejected.

You will have to change to another channel (my-location-01/my-node-01) in order to make that happen. Please assure those items have values in them.

There is no thing to worry about because you are just in trial & error mode right now. Your system will stabilize and then, before actually deploying it, you might want to change to a stable channel name.


I have another question about the data flow.

Currently, I am running 4 separate ESP8266 with scales, they suppose to transmit data at approximately the same time. All nodes are running the same sketch. Only a single board is different and holds the SHT sensor.

My dashboard is at: Alseb3 Hive - Grafana (

When I connect to the board over serial, I occasionally can observe failures to transmit data. Is there any issue that could block the transmission to the server?

With kind regards,

Dear Sayed,

Congratulations that you managed to put them together and make them submit data to the Hiveeyes Backend. Everything looks fine now, no?

Hm, it is hard to tell from the distance what the reason might be for this. I am pretty confident that the server backend currently does not have any issues. Data from other users is constantly acquired successfully.

Maybe you can share your code by uploading it somewhere appropriate?

With kind regards,

the issue that it could be using same credential to login to Server
i am not able to join all together in same board as limitation of gpio

Best regards,

Sayed Baqer Mohammed Alseba

the sketch as following
but i noticed one note there // A MQTT client ID, which should be unique across multiple devices for a user.
and the error code in serial MQTT publish failed
the cause of the issue was Client ID, by changing it with numbering it is able to connect successfully at same time


Great to hear you figured this out. Thanks for letting us know!