Blynk client on raspberry not triggering on virtual pin write

Hello,
I have the following configuration:

ESP8266+wifi with Blynk running -> Local Blynk Server on PI -> Local Blynk Client running nodejs on PI (the same)

From the ESP8266 I send 0 or 255 alternatively (with a timer) a value on virtual pin 1:

Blynk.virtualWrite(1, 255);
.
.
Blynk.virtualWrite(1, 0);

on the PI (client) I try to get it with a code like this:

v1.on('write', function(param) {
console.log('V1:', param);
});

however it never triggers…

The strange thing is that using an android phone running as a client with the same authorization token I get such virtualwrite (for example on a led that blinks correcty), meaning that esp8266 is working correctly.
Another strange thing is that if from the android phone I send for example a message on another virtual pin, e.g. virtual pin 2, and I try to get it on the pi client with

v2.on(‘write’, function(param) {
console.log(‘V2:’, param);
});

it works, meaning that also the client on PI is working correctly.

So, summarizing:
apparently the client on raspberry does not detect a virtual pin write made by the ESP8266 but it detects a pin write made by android app and on the other hand the client on raspberry detects a virtual pin write made by the android app perfectly.

Anyone can help me on this issue ?

Thanks
Leonardo

I think a little clarification is needed, both about what you have setup as I see it, and clarification from you and what you think you have setup :wink:

Just because the RPi is doing dual duty doesn’t change how your Local Server perceives the situation… it sees both ESP and RPi as individual device clients.

So, first off… how do you have the devices setup? Both in the same project?.. If so, each with its own Auth?

Or as two separate projects, one for each client?

Should it not be Blynk.virtualWrite(V1,255)…? Looks like you missed the V. Or is it just the code written to depict is wrong? Best to publish the sketch, formatted, between a pair of three backticks.

@mohan_sundaram for virtual pins the V is optional.

Well,
they have the same Auth and should be on the same project, is this wrong?

The Auth has been generated from the android app, is there a way to generate it from the rpi client ?
The idea is to have an hardware (e.g. esp8266) sensing a switch status and a local panel (rpi client) showing such status on a real led.
Is there a better way to implement this ? Any example ?

The android phone is not mandatory but would be nice to have it to monitor such switch status remotely.

Cheers,
Leonardo

Set them as separate devices on same project… each with own AUTH, then it will be easier to control with Device Selector/Tiles from the App and use Bridge to link from within the code… for one device to control a pin on the other… your LED for example.

The server generates all the Auth codes… but the process is initiated only from the App.

I only use Android… so I am unsure of your issue between iOS and Android phones… but except for a few missing widgets on the iOS side, they should functionaly work the same way.

Thank you Gunner,
I totally overlooked bridges :open_mouth:, tonight I’ll give a try.

YES ! :rofl:
It works perfectly using bridges ! Thank you very much for your help.

1 Like