Historic data working, but live data missing

Hi All,

I was wondering if anyone else has experienced this very strange problem?

I have a project that works fine against the blynk.cc servers, but doesn’t show live data when using my local server.

I can look at the historical data in a SuperChart (for any of the non live time ranges), but the “Live” time range shows nothing (note that when I change time range, I do see the data that has been received since the last change). So data is definitely being accepted from the nodemcu module by the local server. Value Displays also don’t show any values either.

I have a very simple test project consisting of:
1x NodeMCU
1x DHT22 (on pin D4)

I’ve setup a local server, running on a Pi on Raspbian (following the instructions), but running under a dedicated standard user account. I’ve setup custom ports and opened these up in Raspbian:

$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing)
New profiles: skip

To                         Action      From
--                         ------      ----
37952                      ALLOW IN    Anywhere
37344                      ALLOW IN    Anywhere
37244                      ALLOW IN    Anywhere
37144                      ALLOW IN    Anywhere
37980                      ALLOW IN    Anywhere
37443                      ALLOW IN    Anywhere
37952                      ALLOW IN    Anywhere (v6)
37344                      ALLOW IN    Anywhere (v6)
37244                      ALLOW IN    Anywhere (v6)
37144                      ALLOW IN    Anywhere (v6)
37980                      ALLOW IN    Anywhere (v6)
37443                      ALLOW IN    Anywhere (v6)

server.properties:

# Application mutual ssl/tls port
app.ssl.port=37344

# Hardware plain tcp/ip port - Default hardware port that needs opening
hardware.default.port=37244

# Hardware ssl/tls port (for hardware that supports SSL/TLS sockets)
hardware.ssl.port=37144

#Http and web sockets port
http.port=37980

#Https, web sockets, admin port
https.port=37443

I have forwarded only the following through my broadband router

app.ssl.port
hardware.default.port
hardware.ssl.port

The NodeMCU code, that I have already successfully tested against the blynk.cc servers (sensitive values *** out).

 **************************************************************
 * This example shows how value can be pushed from Arduino to
 * the Blynk App.
 *
 * WARNING :
 * For this example you will need SimpleTimer library:
 * and Adafruit DHT sensor library:
 *
 * App project setup:
 *   Value Display widget attached to V5
 *   Value Display widget attached to V6
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "********";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "********";
char pass[] = "********";


#define DHTPIN D4          // What digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321

DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
   Blynk.begin(auth, ssid, pass, "****.dtdns.net", 37244);

   dht.begin();

  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

void loop()
{
  Blynk.run(); // Initiates Blynk
  timer.run(); // Initiates SimpleTimer
}

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) 
  {
    Serial.println("Failed to read from DHT sensor!");
  }
  else
  {
    // You can send any value at any time.
    // Please don't send more that 10 values per second.
    Blynk.virtualWrite(V5, h);
    Blynk.virtualWrite(V6, t);
    Blynk.virtualWrite(V7, millis() / 1000);

    Serial.print("Tempurature: ");
    Serial.print(t);
    Serial.print(" , Humidity: ");
    Serial.print(h);
    Serial.print(" , Seconds: ");
    Serial.println(millis() / 1000);

    if( t > 40.0 ) {
      Serial.println("Tempurature above 40.0");
      Blynk.notify("Tempurature above 40.0");
    }
  }
}

My Blynk mobile app consisting of:

2x Value Displays

  • Humidity V5
  • Temperature V6
    1x Super Chart
  • Humidity V5
  • Temperature V6
  • Uptime V7

Any help, or debugging suggestions would be gratefully received.

Neil

It looks like the forum doesn’t like * characters, so I apologise for it messing up the pasted code

Is the time correct on the Pi as it will not give you live data without the correct time on the server.

Very good point. I’ll check that now :slight_smile:

Time is correct. Worth checking, but I’ve set it up to sync via NTP

$ date
Sun 12 Nov 19:02:33 GMT 2017

PI$ date
Sun 12 Nov 19:03:51 GMT 2017
PI$ exit
PC$ date
Sun 12 Nov 2017 19:03:55 GMT

Even if the date was wrong, I’d still expect the Value Display components to get their values from the push even.

Is there a way to debug push events?

Try manually setting and reading values to virtual pin using http api. Does that work?

Hi Eugene,

Sounds like a really good idea. Many thanks for the suggestion.

Do you happen to have a link to a page describing the http api?

Thanks

Neil

@Futurity the API for Blynk is at https://blynkapi.docs.apiary.io/#

Great thanks