Blynk 2.0 Bridge widget doesn't work?

Hi dears.
Bridge widget doesn’t work in blynk 2.0.
Are there any new conditions or parameters in the new bridging blynk?

BR,
Artem.

Hello. You can use automations instead. Automations are replacements for Timer, TimeInput, Eventor, and Bridge widgets. Docs - Automations - Blynk Documentation.

1 Like

Yes, but before I have to register devices for $4.99 each in the free plan, right?

Artem.

Yes, $4.99 each devices , I have 9 devices :smile:
Maybe one day we will have a package with 20 devices for only $10 :stuck_out_tongue_winking_eye:

@Blynk_Coeur we will definitely add free devices to the most active members of the forum. As many as you need.

6 Likes

That’s good news indeed, tell me when I can access to that !

1 Like

It will happen after june 25th

5 Likes

:cry: to bad I am moving and will be to busy to setup again for a month or two…

1 Like

Not very easy to move old project to blynk V2 :smile:
I got some problems , can’t find how to get time and date, don’t know how to bridge 2 MCU.

@Dmitriy @vshymanskyy please explain how to access time api and also add it to docs.

Thanks

And how to bridge :bridge_at_night:

  • Open the app
  • Go to automations tab
  • And you’ll see it all by yourself

I did, but nothing to see with how to get time and date, no more with how to bridge MCU.

Dimitri,
I tried following the link for the documentation you provided and there is a dead-end. No docs found, can you please correct as I would like to see the docs.

new link
https://docs.blynk.io/en/blynk.apps/automations

2 Likes

@CGLEON sorry, we did doc re-structuring recently. Please use @Blynk_Coeur link.

1 Like

Hi, in the previous version I used widget bridge to send a virtual value from one device to another showing it on the display, what can I do with the new version?
Thanks.

Pete.

2 Likes

Replacing Bridge widgets.

I’ve seen a couple of good posts on this, so here is my current go-to routine for “getting” and “updating” Blynk Datastreams on other devices. It is more powerful than the old Bridge Widget in that you both can send and receive data from other Blynk devices. It’s fast, too, for ESP8266 and ESP32… just don’t try to use HTTPS if you’re in a hurry. (This code uses HTTP, not HTTPS for that reason.) And yes, kill the Serial.prints once you see how it works.

It’s written for ESP32 and ESP8266 only.
Hope this is helpful to someone. All comments welcome.

// Blynk has pretty good doc on this...
// https://docs.blynk.io/en/blynk.cloud/update-datastream-value
bool BlynkGetPutBridge ( const String& requestType, const String& BlynkAuthcode, const int& BlynkDatastream, String &requestValue ) 
{
  // requestType = "get" or "update" 
  // String BlynkAuthcode = Blynk authcode of device we are writing TO
  // int BlynkDatastream = Blynk Datastream we are writing TO
  // String requestValue = value to write into or read from external BlynkDatastream 
  // example: String value= 267.8; BlynkGetPutBridge ( "update", "authcode", V6, value )
  // example: String value;        BlynkGetPutBridge ( "get", "authcode", V6, value ) )
  
  // returns true or false on success or failure
  // example if ( ! BlynkGetPutBridge ( "update", "authcode", V6, value ) ) Serial.println ( "Error" );

  String returnedValue; // temporary working String
  
  if ( requestType != "get" && requestType != "update" ) 
  {
    Serial.print ( "BlynkGetPutBridge has BAD requestType = " ); Serial.println ( requestType );
    return false; 
  }
  
  Serial.print ( "\nBlynkGetPutBridge called a \"" ); Serial.print ( requestType ); 
  Serial.print ( "\" on BlynkDatastream V" );         Serial.print ( BlynkDatastream ); 
  Serial.print (  " on device with authcode " );      Serial.println ( BlynkAuthcode ); 
  if ( requestType == "update" ) { Serial.print (  " with update data = " ); Serial.println ( requestValue ); }
  

  // Set up an HTTP client object for the IFTTT POST 
#if ESP32
  HTTPClient temporaryHTTPclient;  
#elif ESP8266
  WiFiClient temporaryWiFiClient; 
  HTTPClient temporaryHTTPclient;  
#endif

  // Blynk datastream get and update BOTH use HTTP.GET and a single request string
  // Server name URL with get or update (put) information
  // Format: http://BlynkserverURL/external/api/get-or-update?token=authcode&dataStreamId=value
  String BlynkGetRequest = "http://" + String ( MY_BLYNK_SERVER ) + "/external/api/";
  
  BlynkGetRequest = BlynkGetRequest + requestType; // add "get" or "update"
  
  // Blynk's GET payload for a "get"     is "token=authcode&dataStreamId"
  BlynkGetRequest = BlynkGetRequest + "?token=" + BlynkAuthcode       // Authcode of device to be updated
                                    + "&v"      + String ( BlynkDatastream );    // Virtual pin to update
               
  // Blynk's HTTP payload for an "update" is "token=authcode&dataStreamId=value"
  if ( requestType == "update" ) 
  {
    // Get rid of any spaces in the passed parameter (without altering the passed parameter) 
    String passedString = requestValue; 
    passedString.replace ( " ", "%20" ); 
    BlynkGetRequest = BlynkGetRequest + "=" + String ( passedString ); // value to PUT (update)
  }

  Serial.print ( " BlynkGetRequest <" ); Serial.print ( BlynkGetRequest ); Serial.println ( ">" ); 

  //long elapsed = millis();  // I found the HTTPS calls took 1-2 seconds, moved to HTTP
#if ESP32
  temporaryHTTPclient.begin ( BlynkGetRequest );  // Blynk GET wants the URL AND request
#elif ESP8266
  temporaryHTTPclient.begin ( temporaryWiFiClient, BlynkGetRequest );  // Blynk GET wants the URL AND request
#endif

  //temporaryHTTPclient.addHeader ( "Content-Type", "text/plain" ); // both seem to work fine
  temporaryHTTPclient.addHeader ( "Content-Type", "application/x-www-form-urlencoded" );

  // Execute the HTTP.GET containing the "get" or "updae" request, get a return code
  int BlynkAPIcallReturnCode = temporaryHTTPclient.GET ();         // use GET to send the request to Blynk
  //Serial.print ( " elapsed time in ms = " ); Serial.println ( millis() - elapsed ); 

  Serial.print ( "  Blynk API return code: " ); Serial.print ( BlynkAPIcallReturnCode ); 
  if ( BlynkAPIcallReturnCode > 0 ) //Check the returning code (200 is AOK, anything > 0 should get a response)
  {
    returnedValue = temporaryHTTPclient.getString();   //Get the request response payload
    Serial.println ( ", response string: <" + returnedValue + ">" );  
  }
  else 
  {
    Serial.println ( " failed" ); 
  }

  // Close the connection
  temporaryHTTPclient.end(); 

  // Load up the return variable on a "get" 
  if ( requestType == "get" ) requestValue = returnedValue; 
  
  if ( BlynkAPIcallReturnCode == HTTP_CODE_OK ) return true; else return false;
  
} // end BlynkGetPutBridge
1 Like