Blynk / Node-Red - not getting Data from ESP

Hi!

After a lot of help from a very nice blynk user, I was able to finally setup a gps tracker using an ESP32 and SIM808.
It currently tracks lat, long and speed + I have a temperature / humidity sensor hooked up to it.

In the blynk app, I can see all the data but I’m currently not able to get the readings into Nodered.

I’m using a local server running in docker, ports forwarded from 8080 to 49156.

image

It seems that it’s succesfully connected to the Pins (using write event) but I don’t see anything in the debug console.

Is there anything wrong with the configuration?: (Due to limitations, I’ll post screens in a reply)

Thanks a lot!

Here is the conf in Node-Red:
image

image

At first glance everything looks fine, so lets make sure that you haven’t made any rookie mistakes…

  1. The blue dot in the top right of the debug node means that the node was edited since the flow was last deployed. Have you deployed the flow since taking the screenshot?

  2. Are you looking at the debug messages column on the right hand side of the screen as well as looking for the data to be displayed below the debug node? Showing data below the debug node is a new feature and when I tried to use it (on my test server - my production server still runs an older version) I didn’t get the results I was expecting.

  3. Are you 100% sure that virtual pins 5, 7 & 9 are the ones that you are using in your app, and that you only have one device set-up in your app?

Pete.

Dear Pete,

thanks a lot for your feedback.

Regarding 1:
Yeah, I just moved the position of the widget.

2:
I can’t see any messages below the debug node? Would you have a screen for me?
I’m using Node-Red inside Home Assistant - maybe this is not the latest version?

3:
Yes, I only have one device and also I copied the authkey from the arduino sketch.

Interestingly, I get some output in the debug console if I add a button in the blynk app (V15) and push it:
image

Thanks

What you describe as the debug console is the debug window column I was referring to in question 2.

Can you post the part of your sketch that handles writing the temperature to pin V9, along with details of the timer that calls this code?

Pete.

Here is the relevant part:

void sendGPS() {
modem.enableGPS();
int index = 0;
float lat, lng, speed;
modem.getGPS(&lat, &lng, &speed);
myMap.location(index, lat, lng, "value");
//lcd.clear();
//lcd.print(6, 0, lat);
//lcd.print(6, 1, lng);
Blynk.virtualWrite(V5, lat);
Blynk.virtualWrite(V6, lng);
Blynk.virtualWrite(V7, speed);
}

This is then called by a timer each 5000 millis.

void loop only has Blynk.run and timer,run

Pete,

Sry, there you go:

void sendTempHum()
{
  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!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V8, h);  //V8 is for Humidity
  Blynk.virtualWrite(V9, t);  //V9 is for Temperature
}

And here is the timer:

 dht.begin();

  Blynk.begin(auth, modem, apn, user, pass, server, port);

  timer.setInterval(5000, sendGPS);
  timer.setInterval(50000, sendTempHum);

Sorry, I’m out of ideas then.
I don’t use Node-Red in the same way that you are using it. For me, my devices talk ONLY to the Node-Red server via MQTT messages and and Node-Red acts as the gateway/translator of data between Blynk and the devices.

Also, despite spending a LOT of time playing around with one of the docker systems (IOT Stack) I abandoned it because I couldn’t get it working the way I wanted. For me, Docker simply adds another layer of complexity with little or no benefit.

You could try opening a console window and stopping then re-starting Node-Red (node-red-stop then node-red-start) and see if there are any messages that cast any light on what is happening within Node-Red when it initialises and connects to your local server.

Sorry that I cant be more help.

Pete.

So I tried it with a http request: image

This provides me with the data :slight_smile:

Does such a request (https://server/auth_token/get/pin) only take the already transferred data from the server or will this result in additional data transfer and therefore usage from the hardware device to the server?

It pulls the existing data from the server.

Pete.

1 Like

Hi Smitt,

I faced the same problem 2 months ago but got help. Here is the link:

In short: the Blynk.virtualWrite() command doesn’t trigger the WriteEvent in NodeRed. You should change virtualWrite() to bridge1.virtualWrite(), with the right config. As “OtherAuthToken” you can simply use your normal token, then it writes the data to your app.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

const char* auth        = "YourAuthToken";
const char* ssid        = "YourNetworkName";
const char* pass        = "YourPassword";
const char* server      = "YourServerIP/Domain";
const unsigned int port = 8080;   //YourServerPort

// Bridge widget on virtual pin 1
WidgetBridge bridge1(V1);

// Timer for blynking
BlynkTimer timer;

void myTimerEvent() {
    bridge1.virtualWrite(V5, millis() / 1000);
}

BLYNK_CONNECTED() {
  bridge1.setAuthToken(auth);
}

void setup() {  
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass, server, port);  
  timer.setInterval(1000L, myTimerEvent);
}

void loop() {
  Blynk.run();
  timer.run();
}

This worked for me.

2 Likes