Strange behavior of Bridge (App data still received when device offline)

• Smartphone OS (iOS or Android) + version: Huawei P9 lite, Android 6.0
• Blynk server : cloud
• Blynk Library version : latest

2 WEMOS D1, the first (A) reads the brightness value from LDR and sends it to seconds (B) via bridge.
On Blynk app created project that only displays value on B (virtual V8 pin).
The problem: if I disconnect B from the power supply, the value on the app is always displayed and updated.
Question: if I unlink B, should the value update stop? I think yes.

Device " A" transmitter

//DEVICE "A"

//#define BLYNK_PRINT Serial 
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <RBD_Timer.h>
char auth[] = "TOKEN_A";
IPAddress staticIp(---,---,---,---);
IPAddress subnet(255,255,255,0);
IPAddress gateway(192,168,1,1);
char ssid[] = "SSID";
char pass[] = "pass";
WidgetBridge bridge1(V1);
RBD::Timer timer;
BLYNK_CONNECTED() {
  bridge1.setAuthToken("TOKEN_B");
}
void setup(){
  //Serial.begin(9600);
  WiFi.config(staticIp, gateway, subnet);
  Blynk.begin(auth, ssid, pass, IPAddress(139,59,206,133), 8442);
  timer.setTimeout(1000);
}
void loop(){
  Blynk.run();
    if(timer.onRestart()){
      reading();
    }
}
void reading(){
  int value= analogRead(A0);
  if(lettura > 700){
    digitalWrite(2, HIGH);
  } else {
    digitalWrite(2, LOW);
  }
  bridge1.virtualWrite(V8, value);
}

Device “B” receiver

//DEVICE "B"

//#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <RBD_Timer.h>
char auth[] = "TOKEN_B"; 
IPAddress staticIp(---,---,---,---);
IPAddress subnet(255,255,255,0);
IPAddress gateway(192,168,1,1);
char ssid[] = "SSID";
char pass[] = "pass";
RBD::Timer timer;
BLYNK_WRITE(V8){
    int pinData = param.asInt(); 
}
void setup(){
 //Serial.begin(9600);
  WiFi.config(staticIp, gateway, subnet);
  Blynk.begin(auth, ssid, pass, IPAddress(139,59,206,133), 8442); 
}
void loop(){
  Blynk.run();
}

Not sure if i am interpreting your issue correctly… but the bridge is sending data from A to B via the server, so even if device B is offline the server is still connecting the B’s App project and thus the App could still be receiving the data stream from the bridge.

1 Like

ok, do you confirm that the app displays data that is received by the server regardless of whether the bridge receiver is connected or not?

I confirm nothing as I am not a developer, thus can’t be certain without testing :wink:

However, the server is at the centre hub of the App(s) <–network–> SERVER <–network–> Device(s) communication, so it makes sense that it could simply be passing the data to the offline device’s App if there is no required logic or data manipulation required in the device itself first… and I don’t see any such in your receiver code.

In fact all that the Blynk function is doing in the receiving device code is loading the bridge value (received from the transmitter, via server) into a variable and doing nothing else with it. So if V8 is a display widget, then yes, it would simply be getting the data from the server regardless of the devices status. That function is superfluous in this case.

Yes. This is actually a feature. You may or may not restore this value when necessary for device B.

Perhaps another way to understand is to look at what a Bridge is and why it works this way… It is a way of sending data or controls to the App(B) and/or Device(B) as if it was coming from same Device and/or App respectively… but actually coming from another “outside” source altogether, Device(B).

As long as the Auth code matches, the Server doesn’t know or care where the source of the data is from, or where it is going (App or Device), it just passes it on… the type of data and/or method used to receive it will determine if the receiving Device needs to be online or not for the proper results.

OK thanks a lot