[solved] Launch blynk-client for associated the hadware with the server

Hello all,

I am Joel and I am French.

I have install blynk server and follow the get started and I can connect my phone with blynk application with the local server. I create a first project with buttons and I choice the hardware Raspeberry pi 3b on ethernet. it send the auth token and launch blynk-client for associated the hadware with the server. se under the bad result.

I don’t know how solving this issue. thank for your help
Joel

Blockquote

pi@raspberrypi:~ $ sudo blynk-client 7ce8779c39674e168a72fbe30906ce27

___  __          __

/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/

Give Blynk a Github star! => GitHub - vshymanskyy/blynk-library-js: Blynk library for JS. Works with Browsers, Node.js, Espruino.

OnOff mode
Connecting to: blynk-cloud.com 443
SSL authorization…
Connected
Could not login: INVALID_TOKEN
events.js:188
throw err;
^

Error: Unhandled “error” event. (INVALID_TOKEN)
at Blynk.emit (events.js:186:19)
at Blynk.onReceive (/usr/lib/node_modules/blynk-library/blynk.js:466:20)
at exports.SslClient. (/usr/lib/node_modules/blynk-library/blynk.js:607:50)
at emitOne (events.js:116:13)
at exports.SslClient.emit (events.js:211:7)
at TLSSocket. (/usr/lib/node_modules/blynk-library/blynk-node.js:212:16)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:246:13)
pi@raspberrypi:~ $

Blockquote

blynk-client defaults to connecting to blynk-cloud. Its really there as a first step to get your feet wet.

since you have your own server, take these six lines. save them as test.js. … create a v1 push button on your project screen.
and run it by doing `

sudo node test.js

var blynk = require('/usr/local/lib/node_modules/blynk-library');
var AUTH = '7ce8779c39674e168a72fbe30906ce27';
var tcp = new blynk.TcpClient(options={addr:"127.0.0.1", port:8080});
var blynk = new blynk.Blynk(AUTH, options = {connector :tcp});
var v1 = new blynk.VirtualPin(1);
v1.on('write', function(param) {console.log('V1:', param[0]);});

Then pickup where you left off on your reading/testing.

`

oops… there was an error in my code… may have to grab it again.

Hi Larry,

I try your code with modifications. the path for node_modules was not my path.

your code :

var blynk = require('/usr/local/lib/node_modules/blynk-library');

my code :

var blynk = require('/usr/lib/node_modules/blynk-library');

var AUTH = 'ef7a57a02ed4447ab2816e360e7f0ddd';

your code :  
```cpp
var tcp = new blynk.TcpClient(options={addr:"127.0.0.1", port:8080});  --> don't work ???

my code :

var tcp = new blynk.TcpClient(options={addr:"127.0.0.1", port:8081}); 

–> it work because I change my port

var blynk = new blynk.Blynk(AUTH, options = {connector :tcp});

var v1 = new blynk.VirtualPin(1);
v1.on('write', function(param) {console.log('V1:', param[0]);});

result

pi@pi-desktop:~/python$ sudo node test.js

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/

  Give Blynk a Github star! => https://github.com/vshymanskyy/blynk-library-js

OnOff mode
Connecting to TCP: 127.0.0.1 8081
Connected
Authorized
V1: 0
V1: 1
V1: 0
V1: 1
V1: 0

joel

Good job! I found that after the first time i got connected to my local server (just a few months back), my learning began. Hope you enjoy blynk as much as i do.

1 Like