Error connect blynk and node-red

What happens if you try the other way around…
Add a button widget in the Blynk app, connected to say V20.

Add a Blynk write node in Node-Red connected to virtual pin 20 and wire it to a debug node and deploy.

When you put the app in Play mode and press the button widget what happens?

Pete.

blynk and node-red states are heterogeneous even though the value has been sent
5

Sorry, I don’t quite uunderstand your reply.

Did anything appear in the debug monitor screen in Node-Red when you pressed the button widget in Blynk?

Pete.

no … actually my problem is your question

Okay, I’m out of ideas.
Maybe @gab.lau can chip-in?

Pete.

I do not use the node-red dashboard, but I can try and let you know!

Me neither, but he can’t even get a Blynk write node to output to the debug window, but this screen shot seems to show that the data is being received:

5

Pete.

But is the 12 pin an LED?
why do you write us true or false?
it should be 0 for off and 255 to on

Yes, you’re correct - they are virtual writes, not reads as I’d thought

@thanh - We need more clarity from you about what happens when you try this:

and what exactly the screenshot you supplied relates to.

Pete.

OK it works but you have to be careful in configuring the switch UI node!

In blynk app:

  • a button (V6) in switch mode to output 0 and 255
  • an LED (V7)

In node-red

  • a “Write event” not set pin V6 to read from button
  • a “Write” not set pin V7 to write on led
  • a switch UI node, configure with:
    check " If msg arrives on input, pass through to output:"
    When clicked, send:
    on payload as ‘String’ and 255 value
    off payload as ‘String’ and 0 value

IMPORTANT: the switch ui node "accepts as input what it must give in output" so it must be put type "string" because the event node returns a string

switch

So now the button in the app and the switch in the ui will be synchronized

Sample flow below:

[
    {
        "id": "31d224ca.0dcd7c",
        "type": "ui_switch",
        "z": "487e4c7.38d5eb4",
        "name": "Led switch",
        "label": "switch",
        "tooltip": "",
        "group": "9ed965a1.157dd",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "",
        "style": "",
        "onvalue": "255",
        "onvalueType": "str",
        "onicon": "",
        "oncolor": "",
        "offvalue": "0",
        "offvalueType": "str",
        "officon": "",
        "offcolor": "",
        "x": 459,
        "y": 238,
        "wires": [
            [
                "52b03515.a8e534"
            ]
        ]
    },
    {
        "id": "c113077e.15d4e8",
        "type": "blynk-ws-in-write",
        "z": "487e4c7.38d5eb4",
        "name": "Button",
        "pin": "6",
        "pin_all": 0,
        "client": "8096728c.4c64d8",
        "x": 260.5,
        "y": 240,
        "wires": [
            [
                "31d224ca.0dcd7c"
            ]
        ]
    },
    {
        "id": "52b03515.a8e534",
        "type": "blynk-ws-out-write",
        "z": "487e4c7.38d5eb4",
        "name": "Led",
        "pin": "7",
        "pinmode": 0,
        "client": "8096728c.4c64d8",
        "x": 644.5,
        "y": 237,
        "wires": []
    },
    {
        "id": "9ed965a1.157dd",
        "type": "ui_group",
        "z": "",
        "name": "Default",
        "tab": "7dcaad4e.ad6994",
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "8096728c.4c64d8",
        "type": "blynk-ws-client",
        "z": "",
        "name": "Progetto Test",
        "path": "wss://blynk-cloud.com/websockets",
        "key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "dbg_all": true,
        "dbg_read": false,
        "dbg_write": false,
        "dbg_notify": false,
        "dbg_mail": false,
        "dbg_prop": false,
        "dbg_sync": false,
        "dbg_bridge": false,
        "dbg_low": true,
        "dbg_pins": "",
        "multi_cmd": false,
        "proxy_type": "no",
        "proxy_url": "",
        "enabled": true
    },
    {
        "id": "7dcaad4e.ad6994",
        "type": "ui_tab",
        "z": "",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]
1 Like

thanks … i did it … i configured it wrong on the blynk app … i switched the level of the button to 1 instead of 255.
Thanks again for the help @gab.lau @PeteKnight

1 Like

@PeteKnight @gab.lau does this works only with virtual pins ??
i’m using Nodemcu and i couldn’t write or read an event from blynk

it does work if i use MQTT
but i wanted to read DHT-11 sensor values and send orders to relay from node red to blynk directly

i need some help right here

The Blynk WS Contrib only allows you to select virtual pins.
However, if you want to manipulate/query digital pins you can, using the “http request” node and an API call.

This will update Pin D2 (the built-in LED on a NodeMCU) with the value of “0”

image

(becauee the LED is Active LOW, “0” turns it on and “1” turns it off). You obviously have to put your Authcode in there.

You query it with:

http://blynk-cloud.com/Authcode/get/D2

Pete.

@PeteKnight thanks for your help but it didn’t work
can you screenshot your page and explain it more
i assume there is nothing to change in my arduino code ??

@PeteKnight…thank you for your help
i did this earlier to read results from virtual pins
and i’m trying to connect ‘‘http request’’ to a ‘‘gauge’’ to see the temperature variation …any ideas ??

image

Not much to explain really, inject something into the http request node to trigger it, and for the one that queries the value, output the result to a debug node.

If your Blynk project was created when you were in a different country, or you’re using a Node-Red cloud server, then you may need to replace http://blynk-cloud.com with the IP address of the Blink cloud server where your project is.

Pete.

You’d need to provide more information.

Pete.

thanks very much @PeteKnight but it didnt work i can read data on my debug node but i cant send data

The results you’re showing in your debug window aren’t coming from the debug node in the screenshot, they’re coming from a debug node that you’ve renamed as “march”, which presumably in on another tab.

How are your http request nodes configured?

Pete.