BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Communication between devices in Blynk 2.0

Hello,
I’m building an esp32 weather station, with anemometer, thermometer, rain gauge, ecc… I have two esp32, one outside with the sensors and one inside with an lcd display. My idea is to put the data from the sensors (first esp32) on the lcd (second esp32). I have the plus plan (5€ month). My idea is to use the same bylnk 2.0 template for both esp32. For the one with the sensors I think to use this function to send the data to the app:

blynk.virtualWrite(vpin, value) 

So I can have the data on the mobile app.
For the other esp32 (with the lcd) , I don’t know if this function

BLYNK_WRITE(vpin) 
param.asInt()

can take the data sent by the other esp32 (with the sensors) to the app.
So what I want to do is to make two esp32 communicate with blynk and also use the app to see the data. Do someone know if this is possible?

Thanks!

Currently there’s two ways to send data between devices :

  1. You can use blynk API to send data between devices using Http Client library or any 3rd party API client app or platform.

  2. You can use Node-RED and blynk plugin
    node-red-contrib-blynk-iot (node) - Node-RED
    to send data between devices without coding.

I guess you could use the Blynk Server as your bridge between both devices with just one token.
The first Esp will take all measurements writing the results into Blynk and the second Esp will take those results to write them at your LCD

So two devices with the same token? I didn’t know it was possible. I will try, but I don’t know if the server can handle two devices with the same token. However it is a good idea.

Using the same template doesn’t achieve anything useful - in fact, if anything it can complicate matters.
Your approach still creates two different devices with different Auth tokens (which is necessary for proper operation) and Blynk doesn’t provide an out of the box method for device to device communication.

The HTTP(S) API method of device to device communication is the easiest to implement. This has a limit of 500,000 update calls per day, but that will be fine for your needs.

This shows you how it can be done…

Personally though I use Node-Red for my Home Automation integration with Blynk.

There’s a few snippets of info about my weather station scattered throughout this topic…

although I’ve since moved away from the BME280 sensor to a weatherproof variant of the SHT30 temperature & humidity sensor and a separate pressure sensor (which can be housed in the indoor module if you wish).

@John93 having devices share the same Auth token isn’t a great idea, it leads to confusing info about on/offline status and messes with the way that Blynk handles everything internally.
I’d guess that Blynk will put more effort into trying to detect Auth token sharing too, as this undermines the device limits set by the various billing subscription tiers. So while it might be a clunky yet confusing workaround at present, it could simply be blocked in future causing a project to stop working altogether.

Pete.

2 Likes

No, not really - see my comments above.

Pete.

Hi @PeteKnight, I guess you wanted to reply to me rather than @John93:wink:

I did something similar in the past using Blynk Legacy a few years ago and the result was good, it’s true that the on/off status will be confusing… you are absolutely right, but I don’t really think my idea was so bad at all…lol.

Anyway, your comments are accurate as always and you are in a better position that me with your knowledge and experience using Blynk 2.0… I’m always learning a lot with your comments.

Best Regards!!!

Yes, thank for pointing that out, and apologies to @John93 :wink:

I was trying to do more than one thing at once, and as Mrs K is always keen to remind me, I just don’t have the necessary chromosomes to multi-task successfully :grinning:

Pete.

1 Like

There’s no need to apologize, it’s not a big deal :slightly_smiling_face:

1 Like

Automation will soon allow that. In fact, it’s already supported on the server side. We need just to fix few UI/UX issues and it will be done.

3 Likes

How soon?

Are there any limits on the frequency of data writes from one device to another?
For example, can you send data for multiple datastreams once every 5 seconds 24/7 ?

Any restrictions based on the type of subscription?

Pete.

2 Likes

I have had a look at the https api. It doesn’t seem to be difficult. My question is: the device (esp32) that has to read the Virtual pins of the other esp32 through the api has to be connected to blynk at the same time, to send the data from an internal temperature sensor. How can I make the https requests with the blynk firmware? Also because the blynk firmware is really good for handling disconnections from wifi. Thanks again, you are giving me an amazing help!

I don’t understand why you would use a 3rd party product to do the data interchange.

Pete.

Very good questions Pete.

At the moment automations have a default minimum 1 minute ignore period, meaning you can’t trigger the same automation more than once within 1 minute. However, this will be tuned based on the plan. Paying users should be allowed to trigger more often.

2 Likes

As 3rd party product you mean the blynk firmware? Because you suggested me to use the blynk api’s.

You should use the HttpClient library.

1 Like

Thanks, i will see if it works and if it is reliable.

Sorry, I misunderstood what you were asking.
You shouldn’t be using the API to read virtual pin values (this is why I thought you were using something like Thingspeak or IFTTT as3rd party middleware).

The API is used to write data from the sensors to the device that will be mounted internally and have the display attached.
When the external device uses the API to make these data writes, the corresponding BLYNK_WRITE(vPin) callback will trigger on the receiving device. You then extract the incoming data values using the param.asInt or param.asFloat methods.

Pete.