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.
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!!
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!!
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
–>Button in App Switches but “Relay” Code does not Exceed.
Arduino Sketch:
#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!!
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!!
New release !!
And another new release…
Thanks @gab.lau
Pete.
This was happening to me, I thought it was just me clicking the wrong button.
Many thanks @gab.lau for the invaluable nodes
First release
Utf-8 support in blynk message
ESLint to increase code quality and discover problems
Adopted the Airbnb javascript code style
Refactoring and adjusted all the source code to the new standard
Various code improvements