Bridge: Syntax for 3 Way Bridge

TH1 , TH2 and RELAYS is ESP8266 version 12F (nodemcu).

Tnx
Greg

You never really provided the details of what you are wanting to do.

Presumably the 2 relays are connected to a single nodemcu and they are receiving signals from each of the other two nodemcu’s with the temperature sensors attached.

Are the 2 relays independent of each other i.e. temperature changes in room 1 then turn relay1 on / off and temperature changes in room 2 then turn relay2 on / off?

If this is not the case please explain the function of the relays.

I’m trying to work out why you need this “virtualREAD”

I may be totally off on this, but I will give it a try.

on TH1, bridge1.virtualWrite(V1,temp); //would send a value of temp to virtual pin 1 on bridged device 1 (RELAY).
on TH2, bridge1.virtualWrite(V2,temp); //would send a value of temp to virtual pin 2 on bridged device 1 (RELAY).
on RELAY,
BLYNK_WRITE(V1){
int pinData = param.asInt(); // pinData variable will store value that came via TH1 Bridge
}
BLYNK_WRITE(V2){
int pinData1 = param.asInt(); // pinData1 variable will store value that came via TH2 Bridge
}

you could then use pinData and pinData1 in the RELAY code to do stuff.

WHY need READ.

Id like use one master ESP8266. At this point use function WRITE and READ.
Id like optimizate sample from TORO_BLANKO.

In my plane is complex house regulation.
In center is MASTER. All around are SLAVE.
Master READ data from SLAVE ( temperature) and WRITE ( Light switch) on slave.
Program on SLAVE is EQUAL for ALL.
MASTER control all data in run different scenarius on SLAVE.

BR GREG

I use this system with numerous master units sending 1’s and 0’s to a distant ESP-controlled relay. The relay unit adds up the numbers- if they are >1, the relay turns on and they all add up to 0, it turns off. I have a little bit of logic in there that does a virtual write of 0 to each receiving pin after it does the reading just in case one of the master units dies after sending over the 1 value. The master units send values every 5 seconds or so, and the slave adds up the values every 30 seconds.

1 Like

@GsmKey temperature controlled light switch sounds like a strange project but nonetheless @Toro_Blanco and @zeeko have given you some good tips on how to proceed.

Just a point on @Toro_Blanco’s code extract:

Many examples for BLYNK_WRITE will show the param.asInt() as a local variable but this will need to be a global variable if you are going to combine it with SimpleTimer or your own functions etc.

Come back to us if you have further questions and we would need to know if the light switches are independent of each other for the 2 rooms you refer to, which you would expect them to be.

I may have an example that might need a virtualRead on bridge or maybe Blynk has better method to do the following case.
I have 9 devices of NodeMCU each with an ACS712 current sensor attached. each device monitors a water pump. If the current sensor senses current up to a certain value (threshold), then a LED in Blynk app project will become green. if it is under the threshold, it will be red. this threshold will be uniform for all 9 devices. if i want to change this threshold, i dont want to upload arduino sketch 9 times for each device. i also dont want 9 sliders or step widgets in my blynk app. I want only one Step widget which can set the threshold for those 9 devices. i dont mind adding another device as a MASTER. (which makes the 9 devices SLAVES)

looking forward to any responses

thank you Blynk team and Blynk Community

Have you considered the Device Selector widget for devices / tags? 1 slider / 1 step widget but selectable for each device.

A post was split to a new topic: Bridge alternative for when 2nd NodeMCU is out of WiFI range

Thanks @psoro for providing the example sketches and test UI. I have just put this together using the Blynk cloud server, latest library ( [v0.6.1]) and iOS app (2.26.3). While the app starts and all 3 devices connect, nothing appears to change when sliders are moved. Have you tested Bridge function or this example on a later version of Blynk? Thanks!

Dear @drewc228,
This code was done 3 years ago… SimpleTimer has been included into Blynk Library but the code should work with minor adjustments like the tokens, the lines pointing at Blynk Server rather than Local Server, things like that…

This example was done to help @Costas, unfortunately I have no time now to enjoy with Blynk and do the tests for you, I’m sorry…

Let us know the result of your tests, it can help other Blynkers

Regards,

1 Like

José is back !

1 Like

Nothing would make me happier Alexis!! :wink:
I’ve got lots of new projects in my mind to play with Blynk…

Best regards!!

1 Like

I’m playing with nextion display and Blynk.
My new project is a smart thermostat, with forecast weather , this smart thermostat will drive my fuel boiler😂

1 Like

Thanks @psoro. I have updated the code you provided and modified to point to Blynk Server and appropriate tokens, etc. Still no obvious exchange of data between the devices via Bridge function. I have in mind using Bridge to share location data across my Blynk-powered mobile air quality monitors (https://www.instructables.com/id/Lets-Make-the-BackpAQ-Personal-Air-Quality-Monitor/) using Blynk Map widgets on each smartphone. Appreciate hearing from anyone who is using Bridge in this kind of use case. Thanks!

@drewc228

Start a new topic, and provide specific details to your problem. Include a copy of the code you have tried (properly formatted that is), along with detail such as hardware, wiring etc… You might get a little more help this way.

I think the map widget has the ability to be passed an index parameter to allow multiple devices to be plotted on the map. Not sure if this would help your particular project, as you’ve not provided much info.

Pete.

Hi Pete, yes, I use index to handle multiple devices. But my question was about how to efficiently provide location data from these multiple devices to the map widget. Here’s a much more complex example of what I want to do on Blynk: PurpleAir Map . Using a shared token will get the data there, but will mess up my other controls, displays and widgets. I am looking for a way to only update map but noting else. Thought bridge might be the ticket but having trouble getting it to work with latest Blynk server, iOS app.

The link you provided doesn’t really tell me any more about what you’re trying to achieve in Blynk, but as @Toro_Blanco suggested you should start a new topic and describe exactly what it is that you’re trying to achieve, and maybe not focus on Bridge as the solution to your issue (although Bridge may be a part of the answer).

Pete.

Pete, ok will do. Thanks as always for your insight.