Correct Websocket Address for Blynk Server?

I am attempting to use Node-Red with the cloud Blynk Server.

I have to enter 2 pieces of information to configure the palette.

  1. The url - which I have put as wss://blynk-cloud.com:9443/websockets
  2. The application project key xxx

But when I try and read an event on virtual pin 1 I am seeing the following errors in window:

21 Feb 17:01:40 - [info] [blynk-ws-client:Weather Station] Start connection: ws://blynk-cloud.com:8080/websockets
21 Feb 17:01:40 - [info] [blynk-ws-client:Weather Station] login -> 187f15xxxxxaffxxxxxxxb7b84
21 Feb 17:01:40 - [info] [blynk-ws-client:Weather Station] SEND -> Cmd: LOGIN Id: 1 Data: “\u0002\u0000\u0001\u0000 187f1xxxxxxxxxxaffccc3xxxxxx4”
21 Feb 17:01:40 - [info] [blynk-ws-client:Weather Station] RECV <- Cmd: CONNECT_REDIRECT, Id: 1, responseCode: SERVER_EXCEPTION
21 Feb 17:01:55 - [info] [blynk-ws-client:Weather Station] Connection closed: ws://blynk-cloud.com:8080/websockets

My Node-Red installation is running on AWS and I have opened port 8080 inbound on the firewall.

Can anyone suggest what might the problem please?

Thanks

Trev

Does this one works for you:

ws://blynk-cloud.com:8080/websockets

?

Apologies. I had actually changed it to 8080.

The error message seems to confirm that.

I must be doing something wrong as I guess somebody must have got that palette working…

No idea what I’m doing wrong :frowning:

I use the non-SSL server URL of ws://blynk-cloud.com:8080/websockets and this works fine for me.

You say that you’re using the SSL version which begins “wss”

but the error message seems to be using the non-SSL version which begins with “ws”:

Also, are you sure that you’ve copied the project key correctly and not missed any characters, or included any additional characters?

Maybe you should delete the connection data for your Weather Station connection and set-up a new connection with a different name and see if this works.

Also, it’s the “Write Event” node that is used to read the status of a virtual pin. Are you using the correct node type in the correct way?
image

Pete.

Hi Pete,

Many thanks for taking the time to look at my issue.

I have checked the connection url and it was as you defined.
I have also resent the auth token and copied and pasted it so there should be no errors with that.
I have uninstalled and then re-installed the palette.
I have rebooted the server
I have restarted the Node-Red
I have swapped from a read to a write event as you stated

My Blynk app is running perfectly on my phone and is receiving data from my NodeMCU

And I am still getting connection problems to the Blynk server…

Here are the logs:

Using username "ubuntu".
Authenticating with public key "imported-openssh-key"
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-1052-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.


Last login: Thu Feb 22 09:12:57 2018 from 2.123.194.140
ubuntu@ip-172-31-22-99:~$ node-red
22 Feb 09:24:29 - [info]

Welcome to Node-RED
===================

22 Feb 09:24:29 - [info] Node-RED version: v0.18.3
22 Feb 09:24:29 - [info] Node.js  version: v4.8.7
22 Feb 09:24:29 - [info] Linux 4.4.0-1052-aws x64 LE
22 Feb 09:24:29 - [info] Loading palette nodes
22 Feb 09:24:31 - [info] Dashboard version 2.8.1 started at /ui
22 Feb 09:24:31 - [warn] ------------------------------------------------------
22 Feb 09:24:31 - [warn] [node-red/rpi-gpio] Info : Ignoring Raspberry Pi specific node
22 Feb 09:24:31 - [warn] ------------------------------------------------------
22 Feb 09:24:31 - [info] Settings file  : /home/ubuntu/.node-red/settings.js
22 Feb 09:24:31 - [info] User directory : /home/ubuntu/.node-red
22 Feb 09:24:31 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
22 Feb 09:24:31 - [info] Flows file     : /home/ubuntu/.node-red/flows_ip-172-31-22-99.json
22 Feb 09:24:31 - [info] Server now running at http://127.0.0.1:1880/
22 Feb 09:24:31 - [info] Starting flows
22 Feb 09:24:31 - [info] [blynk-ws-client:Weather Station] LOG PINS ["0","1","2","3","4","5","6","7","8","9","10"]
22 Feb 09:24:31 - [info] [blynk-ws-client:Weather Station] Start connection: ws://blynk-cloud.com:8080/websockets
22 Feb 09:24:31 - [info] [blynk-ws-client:Weather Station] Register input node - type: write pin: 0
22 Feb 09:24:31 - [info] Started flows
22 Feb 09:24:32 - [info] [blynk-ws-client:Weather Station] login -> 187f15b3dfgfgdgdfgc313feb7b84
22 Feb 09:24:47 - [info] [blynk-ws-client:Weather Station] Connection closed: ws://blynk-cloud.com:8080/websockets
22 Feb 09:24:52 - [info] [blynk-ws-client:Weather Station] Start connection: ws://blynk-cloud.com:8080/websockets
22 Feb 09:24:52 - [info] [blynk-ws-client:Weather Station] login -> 187f15b3dfgfgdgdfgc313feb7b84
22 Feb 09:25:07 - [info] [blynk-ws-client:Weather Station] Connection closed: ws://blynk-cloud.com:8080/websockets
22 Feb 09:25:12 - [info] [blynk-ws-client:Weather Station] Start connection: ws://blynk-cloud.com:8080/websockets
22 Feb 09:25:12 - [info] [blynk-ws-client:Weather Station] login -> 187f15b3dfgfgdgdfgc313feb7b84

The palette I am using seems to be the most popular of the 4 available.

I am stumped :frowning:

Trev

Perhaps I have my architecture muddled on this?

My NodeMCU is using the Arduino code to talk directly to the Blnk Server and then to my app.

I am new to this so could have my design wrong.

Should I be using a MQTT somewhere in this solution? As the NodeMCU is connected to the websockets does that stop Node-Red connecting at the same time?

Just thinking out loud…

Trev

I think you have a problem with your auth token.
It appears in full in the log above as:

If you paste:
http://blynk-cloud.com/187f15b3dfgfgdgdfgc313feb7b84/project
into the address bar of a browser you get “invalid token” returned.

Can you confirm that you’re not using a local Blynk server to generate these tokens?

Also, can you PM me the e-mail from Blynk that contains your token?

Pete.

I deliberately changed my auth token…

I will attempt to DM it to you now.

Apologies. Forgot to answer your entire message.

I am definitely using the Blynk cloud service. I haven’t got as far as building my own server yet

I don’t run any Blynk specific code on my MCU. As you say, I use MQTT to communicate between Node-Red and the MCU, but this isn’t necessary for testing.

Without any MCU involved, put a button widget on you app and link it to the project/Auth Code that you’re using in Blynk and assign it to V0.
Set-up a Blynk Write node and a debug node in Node-Red like the one i showed above and deploy the project. The Blynk node should say “Connected” and when you press the widget button you should get a 0 and/or 1 in the debug window.

I’ve just seen your full auth token and it’s correct, When I modify the URL it gives the project details and when I put it into a new connection in my Node-Red setup it connects to your project. If you send some data to V0 is should see it in my debug screen.

What happens if you ping blynk-cloud.com from your Node-Red server?

Pete.

sending some 1s and zeros now…

it’s on pin v0

temperature is coming in every second on v6…

Yep, this is what I see…

Pete.

how frustrating…

why can’t I get that :frowning:

What happens when you ping blynk-cloud.com from your Node-Red server?

Pete.

it responds to pings

I have to admit that I’m no UNIX expert - in fact I know very little. I’m looking for differences between your setup and mine.
I’m running an earlier version of Node-Red, but a later version of Node.js (v6.13.0 compared to v4.8.7)
Maybe time to upgrad Node.js?

Welcome to Node-RED

22 Feb 10:26:54 - [info] Node-RED version: v0.17.5
22 Feb 10:26:54 - [info] Node.js version: v6.13.0
22 Feb 10:26:54 - [info] Linux 4.9.59-v7+ arm LE
22 Feb 10:26:56 - [info] Loading palette nodes

You can also put Node-Red in verbose debug mode (Ive never done this) using:

Debug
Use the verbose -v flag when starting Node-Red to get more information or use node-red-log and enable log on Configuration Node as needed

Pete.

1 Like

I have updated my version of node… no idea how it was out of date as I only built this server yesterday… must have followed some instructions that specified the actual version to install…

anyway… still no luck. still the same error message…

does your setup look like this?

1_Flow1_EventNode

Just wondering if I have configured something incorrectly?

Trev

Yes, that’s how mine looks, except I don’t have any of the logging boxes checked and nothing in Pin Logging:
image
image

Pete.

I have just setup Node-Red on my local windows 10 PC and with the exact settings I have on my AWS Linux machine it works!

So, it has to be something relating to the box or network…

Okay, that’s good news - I guess!
I use a Raspberry Pi 3 as my Node-Red and Mosquitto server and that works very well. I find it extremely reliable and zero maintenance; which is good as I don’t have much of a clue with the UNIX/Linux stuff.

I actually used Peter Scargill’s script from his website:
https://tech.scargill.net/?s=the+script
The only issue with this is that it installs the old websockets node by default, but it’s easy enough to remove this via the Pallet Manager and install the ws version instead.
Pete’s “Big Timer” node is great if you want to do any timed stuff.

I’m actually in the process of building a Node-Red/ESP8266/Blynk weather station for our holiday home in Spain.
Most of the hard work is done, it just needs the hardware installed on the roof and a few wrinkles ironing out.
The core of my system is a Nextion touch screen which controls the heating and cooling systems depending on readings from the internal temperature sensors, but it also displays data from the outdoor temperature, humidity and pressure sensors.

Blynk shows more detailed outdoor weather data including wind speed, wind direction and rainfall, and I plan to add a raindrop detector (so we know to bring the laundry in) and a light intensity sensor.

For me, using MQTT is a great way to collect data from these various sensors and to push it out to Blynk as required.
I’m aso using Amazon Alexa integration in Node-Red to give me voice control and feedback of temperature. It’s great to be lying in bed in the morning and say “Alexa, what’s the temperature in the lounge” and when the answer is “15 degrees” I can say “Alexa, turn the lounge heating on” and “Alexa, set an alarm 10 minutes”.

Blynk is really handy for remotely monitoring everything, and for checking the temperature at home and turning the heating or cooling on before you get home so that everything nice and comfortable.

Feel free to PM me if you want to pick my brains or kick ideas around.

Pete.

1 Like