New Node-Red library: node-red-contrib-blynk-ws

Based on that description I don’t think I can help.
If you’d like to share the code that’s running on the ESP, and a screenshot of the Node-Red Node then I’d probably have a better idea of what you’re trying to explain.

Pete.

Hi Marcin,
as Pete said, to help you we need the code, please both the sketch loaded on the esp and the flow of node-red.

gab.lau

Hi All,

Does this library still work ? I am currently getting the following error ?

Unhandled response { type: 41, typeString: undefined, msgId: 1, status: 19 }

Thanks,
Serge

Hi Serge,
which version of the library still use?? Please update to 0.4.0 version!!

Thanks, that solved it.

New release today!! Please send feedback!!

0.5.0 - 2018-04-14

Added

  • Blynk protocol - Handle any number of Blynk commands (virtualWrite(), setProperty(), etc.) in a row see Blynk Library 0.5.0
  • Control max lenght of message and max number of commands in a single message
  • Config node - Option to enable “Multiple blynk command in single message” (blynk cloud or local server >= v0.34.0)
  • Config node - Implemented server proxy configuration
  • Config node - Option to log protocol “sync” and “bridge” messages type
  • Node - Bridge - New node that implements the functionality of sending commands to other blynk devices.
  • Node - Sync - New node that implements the “syncAll” and “syncVirtual” blynk commands
  • Node - Set Property - Implemented “step” for Step Widget (blynk cloud or local server >= v0.32.2)
  • Node - Set Property - Implemented “url” for Video Straming Widget (blynk cloud or local server >= v0.28.7)
  • Node - Set Property / LCD / Table - Send multiple blynk command in a single message
  • Node - Read Event - Option to receive all pins events
  • Node - Write Event - Option to receive all pins events
  • Node - Write Event - Added pin number that generate event in msg.pin variable
  • Initial support to Internationalisation

Changed

  • Better handle of configuration node error, now blocks child nodes if some parameter is missing.
  • More check on “pin” parameter before send message
  • The PING command is only sent if no data has been sent or received in the “heart beat” time
  • Hide “Auth token” - from all log message
  • Config node - Rename “Private key” to “Auth token” and better help message
  • Split every node on single file
  • Removed dependency from “DataView” package
  • Code clean

Fixed

  • Rightly handles the reception of the BRIDGE type commands.
  • Websocket SSL connection error on nodejs > 8.6.0 see (ws iusse #1227)
3 Likes

new blynk 2 days ago has multiway button. new local server - I updated that too, but the new button (made 3 way) doesnt work with blynk-ws (virtual button) I have 0, 1 and auto turning a led on or off where auto is off as is 0… the led wont turn off. works with normal button

the new blynk segmented switch… it is working, but feeding back into bode-red-blynk-ws write or sync nodes if something else changes the state of the switch does not seem to do anything.

I Peter,
for me all works ok, attached sample node-red flow.
Setup blynk app with one “segmented button” with 3 option on V100 pin.
If i change the state on app the virtual write intercept the change.
If i write the value “1, 2, or 3” on V100 the app update correctly.

Or did I not understand the problem?

[
    {
        "id": "890de765.2cd7d8",
        "type": "blynk-ws-out-sync",
        "z": "3c3c2216.c4bc4e",
        "name": "",
        "pin": "100",
        "pinmode": 0,
        "client": "3d8e7a37.045d06",
        "x": 380,
        "y": 80,
        "wires": []
    },
    {
        "id": "a289325d.030c4",
        "type": "inject",
        "z": "3c3c2216.c4bc4e",
        "name": "sync",
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 210,
        "y": 80,
        "wires": [
            [
                "890de765.2cd7d8"
            ]
        ]
    },
    {
        "id": "451e89b2.01a818",
        "type": "blynk-ws-out-write",
        "z": "3c3c2216.c4bc4e",
        "name": "",
        "pin": "100",
        "pinmode": 0,
        "client": "3d8e7a37.045d06",
        "x": 460,
        "y": 160,
        "wires": []
    },
    {
        "id": "50cc406f.9b5db",
        "type": "inject",
        "z": "3c3c2216.c4bc4e",
        "name": "1",
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 210,
        "y": 140,
        "wires": [
            [
                "451e89b2.01a818"
            ]
        ]
    },
    {
        "id": "efb643d4.ce8b2",
        "type": "inject",
        "z": "3c3c2216.c4bc4e",
        "name": "",
        "topic": "",
        "payload": "2",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 210,
        "y": 180,
        "wires": [
            [
                "451e89b2.01a818"
            ]
        ]
    },
    {
        "id": "4d4ce468.c3fefc",
        "type": "inject",
        "z": "3c3c2216.c4bc4e",
        "name": "",
        "topic": "",
        "payload": "3",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 210,
        "y": 220,
        "wires": [
            [
                "451e89b2.01a818"
            ]
        ]
    },
    {
        "id": "21fafb46.f82464",
        "type": "blynk-ws-in-write",
        "z": "3c3c2216.c4bc4e",
        "name": "",
        "pin": "100",
        "pin_all": false,
        "client": "3d8e7a37.045d06",
        "x": 240,
        "y": 280,
        "wires": [
            [
                "326ea4dd.7c87ac"
            ]
        ]
    },
    {
        "id": "326ea4dd.7c87ac",
        "type": "debug",
        "z": "3c3c2216.c4bc4e",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 470,
        "y": 280,
        "wires": []
    },
    {
        "id": "3d8e7a37.045d06",
        "type": "blynk-ws-client",
        "z": "",
        "name": "test",
        "path": "wss://blynk-cloud.com/websockets",
        "key": "********************************",
        "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": true,
        "proxy_type": "custom",
        "proxy_url": ""
    }
]

New release today!! Please send feedback!!

0.7.0 - 2018-07-30

Added

  • Node - Styled Button - New node to simplify the use of this new button
  • Node - Set Property - Implemented “onColor, offColor, onBackColor, offBackColor” property for Styled Button widget (blynk cloud or local server >= v0.36.2)
  • Node - Set Property - Implemented “fraction” property for Slide widget (blynk cloud or local server >= v0.33.3)
  • Node - Table - Implemented “select, deselcet and order” commands

Changed

  • Code refactor - Extract blynk method and variable to files in “libs” directory
  • Node - Notify - Rate limit increased to 5 msg/s (Blynk Library 0.5.3)

Fixed

  • Node - zeRGBa - Check if the widget is configured in merge mode, otherwise it will generate an alert
  • Missing log on respond illegal command
  • Message ID overflow - see Blynk Library JS PR #44
  • Show protocol warning in debug panel
5 Likes

Hi, i tested the node library yesterday and had the problem that the write command on a virtual pin changed the state in app but did not called the BLYNK_WRITE(V0) function in hardware.

Using timed Blynk.syncVirtual(V0) in hardware code solved this problem.

Is there any other workaround?

hi,
in order to better understand the situation, should you give me more information about your setup? is there an arduino device and also nodered? if you do the virtual write from arduino nodered does not receive it? how is the app configured for that virtual pin?

ESP8266 on a Sonoff Switch with blynk “basic” sketch.
V0 Button in APP Writing 1/0–>Relay Switches

grafik
–>Button in App Switches but “Relay” Code does not Exceed.

Arduino Sketch:

Summary

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

char auth[] = “”; //Token
char ssid[] = “”;
char pass[] = “”;
char namingOta[] = “Switch1”;

int lastConnectionAttempt = millis();
int connectionDelay = 5000; // try to reconnect every 5 seconds
String device;
const int buttonPin = 0; // Knopf an Sonoff
const int ledPin = 13; // LED an Sonoff
const int relayPin = 12; // Relay an Sonoff
int relayState = 0;
int ledState = 1;
int buttonState;
int lastButtonState = LOW;
unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 50;

void setup()
{
delay(10000);
Serial.begin(74880);
WiFi.mode(WIFI_STA);
Blynk.config(auth);
WiFi.begin((char*)ssid, (char*)pass);
startup();
pinMode(ledPin, OUTPUT);
pinMode(relayPin, OUTPUT);
pinMode(buttonPin, INPUT);
digitalWrite(ledPin, ledState);
digitalWrite(relayPin, relayState);
}

void loop() {
if (WiFi.status() != WL_CONNECTED) {
if (millis() - lastConnectionAttempt >= connectionDelay) {
lastConnectionAttempt = millis();
WiFi.begin((char*)ssid, (char*)pass);
Serial.println(“Reconnect Try”);
}
}
else {
Blynk.run();
ArduinoOTA.handle();
}
button();
}

void startup() {
Blynk.connect();

ArduinoOTA.setHostname(namingOta);
ArduinoOTA.begin();
}

//Button an Blynk auslesen
BLYNK_WRITE(V0) {
if (param[0].asInt() == 1)
{
digitalWrite(ledPin, 0);
digitalWrite(relayPin, 1);
ledState = 0;
relayState = 1;
}
else if (param[0].asInt() == 0)
{
digitalWrite(ledPin, 1);
digitalWrite(relayPin, 0);
ledState = 1;
relayState = 0;
}
}

//Knopf an Steckdose auslesen
void button() {
int reading = digitalRead(buttonPin);
if (reading != lastButtonState) {
lastDebounceTime = millis();
}
if ((millis() - lastDebounceTime) > debounceDelay) {
if (reading != buttonState) {
buttonState = reading;
if (reading == LOW) {
ledState = !ledState;
relayState = !relayState;
digitalWrite(ledPin, ledState);
digitalWrite(relayPin, relayState);
Blynk.virtualWrite(V0, relayState);
Blynk.syncVirtual(V0);
}
}
}
lastButtonState = reading;
}

New release today!! Please send feedback!!

0.8.0 - 2019-01-05

Added

  • Node - Configuration - The configuration node can be “enable” or “disable” now, when disabled no connection is start on boot and all linked node show the red dot “disabled” status.
  • Node - Image Gallery - New node to simplify the use of this new widget (set images urls is not yet implemented in app)
  • Node - Set Property - Implemented “url, urls, opacity, rotation, scale” property for Image Gallery widget (blynk cloud or local server >= v0.39.4) [NOTE: url and urls property are not yet supported in app]
  • Check SLL certificate on connection for blynk cloud

Changed

  • All nodes - Conversion, where necessary, of “isBuffer” checks into “isArray” checks
  • All nodes - Avoid input processing on client node disconnected or disabled
  • Node - zeRGBa - Check if a valid RGB value is passed, otherwise it will generate an alert and the message will be discarded
  • Node - Table - It will generate an alert on a simple payload without other parameters and the message will be discarded
  • Increase heartbeat timeout to 15 seconds - see Blynk Server Issue #1294
  • Compatibility with Blynk Library 0.5.4

Fixed

  • Node - Write - Now it accepts multiple values as input via arrays and forwards them to the server correctly - see this
  • Correct some log messages
3 Likes

Many thanks for this @gab.lau

I’m away for the next 3 weeks, so sadly can’t do any testing yet, but I’ll certainly give it a go when I get back.

Pete.

New release !! Please send feedback!!

0.9.0 | 2019-03-19

Add

  • Node - Image Gallery - Implemented “url” and “urls” property [NOTE: url and urls property are supported only in beta app]
  • Node - Set Property - Implemented “url” and “urls” property [NOTE: url and urls property are supported only in beta app]

Changed

  • Node - Configuration - Using tabs for better UI
  • All nodes - Increased the limit of the pins to 255 and better validation checks
  • Improved heartbeat , send PING command only if necessary.
  • Control and blocking of sending too long messages (BLYNK_PROTOCOL_MAX_LENGTH)
  • Compatibility with Blynk C++ Library 0.6.1
  • LOGIN command changed to int 29 (old int 2)
  • Remove unused command and code clean

Fixed

  • Fix TypeError on node-red restart
  • Crash on websocket “timeout” error
2 Likes

New release !!

0.9.1 - 2019-04-17

Fixed

  • No automatic reconnect on connection lost
1 Like

And another new release…

[0.9.2 | 2019-05-08]

Changed

  • Updated images in readme

Fixed

  • Missing release link in the changelog
  • Saving the Vpin setting for the first time does not work - See [Issue #12]

Thanks @gab.lau

Pete.

2 Likes

This was happening to me, I thought it was just me clicking the wrong button.
Many thanks @gab.lau for the invaluable nodes :wink:

First release

1.0.0 - 2019-07-27

Added

  • Utf-8 support in blynk message

  • ESLint to increase code quality and discover problems

  • Adopted the Airbnb javascript code style

Changed

  • Refactoring and adjusted all the source code to the new standard

  • Various code improvements

Fixed

  • Regexp validation for auth token - See Issue #13
4 Likes