A command from Node-Red does not affect the hardware, but the app sees it.
- If I tap the button in the app, Node-Red reports the value. The board reports the value.
- If I send the value in Node-Red, the app changes. The board does nothing.
I have tried this with two different Node-Red servers. Am I doing something wrong?
I’m controlling a Wemos D1 Mini Pro with library version 0.6.1 over Wifi. I’m using Node-Red and the node-red-contrib-blynk-ws library version 1.0.3. My app is on iPhone 6s, version 2.26.4. Blynk cloud server.
Code (running on Wemos D1 Mini)
(I’m not using a slider, but I just started with boilerplate code from the example library for this example.)
[Opened issue on github: https://github.com/gablau/node-red-contrib-blynk-ws/issues/22]
/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Follow us: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This sketch shows how to read values from Virtual Pins
App project setup:
Slider widget (0...100) on Virtual Pin V1
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "M...t";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "...";
char pass[] = "...";
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin V1
BLYNK_WRITE(V1)
{
Serial.println("Blynk Write V1");
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
Serial.println(String(pinValue));
// process received value
}
void setup()
{
Serial.println();
Serial.println("I'm a machine!");
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
Serial.println("Setup finished.");
}
void loop()
{
Blynk.run();
}
Node-Red
[
{
"id": "591c3a35.6ec74c",
"type": "tab",
"label": "Blynk Test",
"disabled": false,
"info": ""
},
{
"id": "ec174547.a1436",
"type": "inject",
"z": "591c3a35.6ec74c",
"name": "",
"topic": "",
"payload": "1",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 110,
"y": 120,
"wires": [
[
"9f176979.26d2c8"
]
]
},
{
"id": "6f5f2860.a8041",
"type": "inject",
"z": "591c3a35.6ec74c",
"name": "",
"topic": "",
"payload": "0",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 110,
"y": 160,
"wires": [
[
"9f176979.26d2c8"
]
]
},
{
"id": "9f176979.26d2c8",
"type": "blynk-ws-out-write",
"z": "591c3a35.6ec74c",
"name": "Sump Pump - Northeast - V1",
"pin": "1",
"pinmode": 0,
"client": "18828803.811b1",
"x": 360,
"y": 160,
"wires": []
},
{
"id": "932d23a1.e5f3f",
"type": "blynk-ws-in-write",
"z": "591c3a35.6ec74c",
"name": "",
"pin": "1",
"pin_all": 0,
"client": "18828803.811b1",
"x": 310,
"y": 100,
"wires": [
[
"393f84f9.480164"
]
]
},
{
"id": "393f84f9.480164",
"type": "debug",
"z": "591c3a35.6ec74c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 480,
"y": 100,
"wires": []
},
{
"id": "18828803.811b1",
"type": "blynk-ws-client",
"z": "",
"name": "Sump Pump - Northeast",
"path": "ws://blynk-cloud.com/websockets",
"key": "M...t",
"dbg_all": false,
"dbg_read": false,
"dbg_write": true,
"dbg_notify": false,
"dbg_mail": false,
"dbg_prop": false,
"dbg_sync": false,
"dbg_bridge": false,
"dbg_low": false,
"dbg_pins": "",
"multi_cmd": false,
"proxy_type": "no",
"proxy_url": "",
"enabled": true
}
]