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

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

Hi, I was testing to set property of button widget but it is not working. Not a single property is changing.

Even i change the input to true and false but not working

If a inject it directly it is working

but i want one button that can change the another button property

@Pranav, I’ve responded to your other thread about this issue, here:

Pete.

A new release is available:

[1.0.3 | 2020-04-10]

Repository: gablau/node-red-contrib-blynk-ws · Tag: 1.0.3 · Commit: e1d9b6d · Released by: gablau

Changed

  • Updated dependencies for security reasons

Thanks @gab.lau

Pete.

2 Likes

I’m having the same problem as ingoingo, above. I posted about it here:

Is there a simple tutorial how to use it? I have no idea how to start, even I am not new in HA or Blynk (but I haven’t done anything new in the last period with blynk since all my new projects are on HA).

I have ESP8266 HVAC control (well not the last version) and I would like to see desired and actual temperature, change the desired temperature and turn the heater on and off in HomeAssistant via NodeRed. Can anyone help me how?

Not really a tutorial, but this might get you started…

I’ve recently installed HA on my Pi, but haven’t really tried to do anything with it yet.

Pete.

New Hot Fix Release!!!

1.0.5 | 2021-03-17

Fixed

  • Interim fix for server certificate expiration. You can continue to use the wss connection even if the certificate has expired. See this forum post
1 Like

Hello.
How monitoring physical pins write events? For example d1 or d2?

@NvAriec I’d suggest creating a new " need help with my project topic " and provide as much details as possible.

But it question about node-red node “Write event” and “Read event”. In this node i can’t choose this pins. But can see this actions.

@NvAriec start a new topic and explain your issue in detail, with screenshots and any other relevant information, and we’ll help you to resolve the problem.

Pete.