gablau / node-red-contrib-blynk-ws

Old/Legacy Blynk library implementation for Node-RED using WebSockets
MIT License
31 stars 10 forks source link

Allow for Digitalpins to be controlled #27

Closed Dud3z closed 2 years ago

Dud3z commented 3 years ago

i have a usecase where i would like to control the D1 trough Nodered. os there a possibility you coould implkement this?

877dev commented 3 years ago

This can already be done depending on what you exactly mean. Use node red Blynk nodes to write the payload, then in your Arduino code use BLYNK_WRITE to read the value.

Check the Blynk help page for lots of usage examples.

Dud3z commented 3 years ago

hi, tahnk you for the fast reply :) to controle Digital pins which only require high or low you dont need to programm anything in the arduino code. you can use them as they are in the Blynk app. my goal was to get a selection wheter i want to control a Virtual or a Digital Pin over Nodered. Right now i can only select Virtual Pins.

877dev commented 3 years ago

Yes I see what you mean, I also use only node red and the app together.

The question is how would the Arduino communicate with node red at all, even if digital pins were enabled? What software would be running on the Arduino?

Dud3z commented 3 years ago

blynk is defined in the Arduinocode. you just dont need to device pins or any functions for the pins.

Peterkn2001 commented 3 years ago

Personally, I never use Blynk to directly control digital pins, and I never run Blynk code on my devices - I always use MQTT for Device—>Node-Red—>Device communication.

However, if you really needed to control a digital pin directly from Node-Red then you could use the HTTP Request node to make a GET or PUT API call (I find that GET is best for both read and write operations) to control the digital pin. The API syntax for this is described here: https://blynkapi.docs.apiary.io/#reference/0/get-pin-value/write-pin-value-via-get

Pete.

gablau commented 3 years ago

Yes, it is already possible. Node-red can send commands to a "Blynk" device via the "Bridge" node.

You must have:

Configure a "Bridge" node, whatever arrives at this node will be sent to the device, on the pin you have chosen.

example: on the arduino device (auth code: 350cf64f1fa111cc936d111bb77b94d0) I want to control pin D5 I configure the Bridge node in this way nodered1 then to the bridge node I connect two "inject" nodes to send 0 or 1 nodered2 Done, that's all

Regards Gabriele

877dev commented 3 years ago

@gablau I am trying to get a bidirectional bridge, i.e. synch two virtual buttons on different auth tokens.

This does work and each button dresses the other, but I'm getting a debug error of DEVICE_NOT_IN_NETWORK when pressing the V97 button.

image

Auth tokens obscured, and pin 9 is free on both projects...

Top bridge node: image

Bottom bridge node: image

gablau commented 2 years ago

@gablau I am trying to get a bidirectional bridge, i.e. synch two virtual buttons on different auth tokens.

This does work and each button dresses the other, but I'm getting a debug error of DEVICE_NOT_IN_NETWORK when pressing the V97 button.

image

Auth tokens obscured, and pin 9 is free on both projects...

Top bridge node: image

Bottom bridge node: image

Hi @877dev , i was reviewing this problem but have you solved it?

I have a question: Are the "Blynk (LIVE SYSTEM)" and "Family Blynk account" connections under the same "blynk account" (email / password), or are they two different blynk accounts?

Because the bridge works for devices that are in the same account. and cannot send messages to other accounts.

Otherwise, from my devices, I could send messages to your devices, if I know your auth token.

best regards