2 x devices - issue with data stream

Hi

I have two devices that send info to Blynk (BlynkEdgent). It is working really well except that I have one Data Stream with all of the virtual pins (A combination of both devices)
What I am confused about is that I have to have one IOS App page that is accessed from each device.

So I have to choose the 1st device then look at the data then exit and select the other device and then view its data.
Can I not see all data in the one IOS View???

ie
Device 1 has V0 and V1
Device 2 has V3 and V4

Am I able to have a one IOS App that allows me to view both Device 1 and Device 2 in the same view or am I doing something wrong?

Cheers

Ants

Not at the moment.

You can however send data from one device to another, using the HTTP(s) API, so that all data is available on one device, so can be used on one device tile.

Pete.

And if you have only a few important values, you can put max. 3 values in 1 template… like this.

Thanks - that worked perfectly

Hi, can you explain it better? maybe with the code needed to send a data from 1 device to the other. Thank you

@Amenasme you should follow the links in this post…

Pete.

Hi, thanks, it works on my nodemcu. Do you have any suggestion to make the same things with arduino mkr wifi 1010 (wifinina)?

I’m not familiar with that board I’m afraid, but if you can find an example of how to make an http client call with that board then it should give you some clues.

Pete.

You can try this example

You can also use automation to forward data between devices

thank you, can you help me to modify the code you linked me? I need to send this:
http://blynk.cloud/external/api/update?token=MyTokenCode&dataStreamId=3&value=0
I do not understand where insert this address. I tried but unsuccesfully. Thanks
Salvatore

If I were you I’d use the code structure from my ESP8266 and ESP32 examples, but use the HTTP library from the example that @John93 provided and tweak the HTTP syntax if necessary.

Pete.

Yes… I tried to do that, but it is too difficult for me. I am searching the internet if someone did this but it seems that nobody in the world used an arduino mkr 1010 wifi to send web request to blynk server!

Maybe that tells you something about your choice of hardware?

Pete.

You can try your luck with the ArduinoHttpClient library.

I will try, thank you

I need to be as small as I can, but I have ran out of pins. I have a gpio extender for the node mcu but I prefer to use mkr 1010 wifi because it have more native pins (enough for my project) without adding another hardware piece, because all the stuff must fit in a hand (like a small tv remote).

I’d suggest using esp32 board instead. It’s cheaper, faster, and has more GPIO pins.

1 Like

I agree with @John93, the ESP32 should be your first choice.
If you want small form factor then look at the Lolin ESP32 S2 Mini, although personally I find that the double header layout can be tricky to work with.

Pete.

ok, If I will buy the esp32 board, can I run the code you linked me:

// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "REDACTED"
#define BLYNK_DEVICE_NAME "REDACTED"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_SPARKFUN_BLYNK_BOARD
#define USE_NODE_MCU_BOARD
//#define USE_WITTY_CLOUD_BOARD
//#define USE_WEMOS_D1_MINI

#include "BlynkEdgent.h"
#include <ESP8266HTTPClient.h>

String server_name = "http://lon1.blynk.cloud/external/api/"; // <<< SEE COMMENTS

String bridge_token_1 = "REDACTED"; // token for the receiving device

float temperature = 10.0; // Used for testing, will be incremented in the "push_some_data" function

BlynkTimer timer;


void setup()
{
  Serial.begin(74880);
  delay(100);

  BlynkEdgent.begin();
  timer.setInterval(10000L, push_some_data);  
}

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

void push_some_data()
{
  api_bridge(bridge_token_1,0,temperature); // Token for receiving device, virtual pin number, value to send

  // Increment the temperature value to simulate changing data...  
  temperature = temperature + 0.3;
  if (temperature >= 50)
  {
    temperature = 10.0;
  }
}


void api_bridge(String token, int virtual_pin, float value_to_send)
{
  WiFiClient my_wifi_client;
  HTTPClient http;

  String server_path = server_name + "update?token=" + token + "&pin=v" + String(virtual_pin) + "&value=" +  float(value_to_send);

  // Your Domain name with URL path or IP address with path
  http.begin(my_wifi_client, server_path.c_str());
  
  // Send HTTP GET request
  Serial.print("Sending ");
  Serial.print(value_to_send);
  Serial.print(" to pin V");
  Serial.println(virtual_pin); 
  
  long request_time = millis();
  int httpResponseCode = http.GET();
  
  if (httpResponseCode>0)
  {
    Serial.print("HTTP Response code: ");
    Serial.println(httpResponseCode);
    String payload = http.getString();
  }
  else
  {
    Serial.print("Error code: ");
    Serial.print(httpResponseCode);
    Serial.print(" <-----------------------------------");    
  }
 
  Serial.print("Response time = ");
  Serial.print(millis() - request_time);
  Serial.println(" milliseconds");
  Serial.println(); 
  
  // Free resources
  http.end();
}

or I have to modify it for the new board?
I really apreciates both of you for the patience you have with me. Thank you

#include <HTTPClient.h> library for esp32