Nodejs+multiple ds18b20+blynk

hello everyone and thanks for privious answers!

im trying to get data from multiple ds18b20 in my RPi3

after a few time running my .js, my rpi disconects from server with strange error

   events.js:165
  throw err;
  ^

Error: Uncaught, unspecified “error” event. (EPIPE)
at Blynk.emit (events.js:163:17)
at Blynk.error (/usr/lib/node_modules/blynk-library/blynk.js:590:8)
at . (/usr/lib/node_modules/blynk-library/blynk.js:553:48)
at emitOne (events.js:96:13)
at emit (events.js:188:7)
at Socket. (/usr/lib/node_modules/blynk-library/blynk-node.js:59:14)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at onwriteError (_stream_writable.js:345:10)
at onwrite (_stream_writable.js:363:5)

i use somekind of multiple(four) such blocks in my code to send data to blynk

    W1Temp.getSensor('28-0516709112ff').then(function (sensor2) {

setInterval(function() {
var temp2 = sensor2.getTemperature();
console.log(‘Actual temp2:’, temp2, ‘°C’);
blynk.virtualWrite(21, temp2);
}, 6000);
});

W1Temp.getSensor(‘28-041670bde1ff’).then(function (sensor3) {
setInterval(function() {
var temp3 = sensor3.getTemperature();
console.log(‘Actual temp3:’, temp3, ‘°C’);
blynk.virtualWrite(22, temp3);
}, 7000);
});

Im using w1temp library

var W1Temp = require(’/usr/lib/node_modules/w1temp’);

Can someone discribe error reason? is it uncorrect JS code or its a server write limit?

Can I suggest a New Year’s resolution? - adopt the approach of “Search First - Ask Questions Later”

Happy New Year!

Pete.

but as i can see - the solution is still not found)))

It seems to me that someone with more node.js experience and more willingness to experiment and share their findings was unable to find a solution.
I’d guess that the problem is likely to be connected with the sensor readings taking too long to complete and Blynk timing out, but as I have very limited node.js experience, I’m unable to work-out whether a solution is actually achievable.

Personally, armed with the knowledge that others have tried and failed, I’d be tempted to go for connecting the sensors to an ESP8266 and using the Arduino IDE to write the code. This is the more ‘mainstream’ platform and gives you a wider variety of tools to overcome any issues. You’d probably need to set-up timed loops to poll the sensors individually on different timing cycles and ensure that you’re not timing-out or flooding Blynk with data.

Pete.

found very interesting solution and just testing it now)))

run multiple blynk client with same token on same RPi with all different sensors each.

Get temperature data between them from blynk)))

The other thing you might want to think about is running Mosquitto and Node-Red on your RPI and having physically remote temperature sensors connected to ESP8266 devices such as Wemos D1 Minis.
This is the setup I use, with remote temperature sensors (amongst other things) sending their data back to the Node-Red environment via MQTT messages every 5 seconds.
Node-Red has a Blynk plug-in and this allows data to be read and written, allowing two-way interaction with Blynk widgets.

Node-red is a graphical programming environment that allows you to achieve an awful lot with little or no programming knowledge. In my setup, the ESPs don’t run any Blynk specific code, just something to connect them to the Wi-Fi network, read the sensor data and send MQTT messages.

It depends on what your solution is designed to do. If having multiple sensors connected directly to one RPI device will achieve what you need then MQTT is an overkill, but if you’re looking at wanting to gather data from locations that are more than a few feet from each other then I’d say that you’d be better with multiple devices talking via MQTT messages.

If you want an easy way to set-up an RPI with MQTT, Node-Red etc then take a look at Peter Scargill’s tech blog and search for his “Script”. Peter is in hospital at the moment, so won’t answer questions (and he tends to ignore questions that he doesn’t think are worth answering), but all the info you need on how to run the script and get started are in his blog archive.

The only issue is that his script installs that outdated “node-red-contrib-blynk-websockets” pluig-in which needs to be un-installed and replaced with the newer “node-red-contrib-blynk-ws” one. This is easy to do in the Node-Red pallete manager.

Pete.

you know its not a such situation… nowadays a got nodemcu fully loaded with relay board to controll gas boiler

meanwhile i got rpi with 4 montionjpeg streamers running to monitor gas

Once there was a situation with wifi failure and boier stops on winter… its better to have more controllable device working with sensors in this case, than modmcu or esp. i want Rpi to take functions of nodemcu. i prefer copper wires

8 and 4x relay board.
I use external supply to power 1w devices
My blynk-server runs on intel celeron j1900 mini-itx debian PC… its enough for gateway and blynk.

All my devices are near…
Total length of 1w is aprox 7m

So where does Blynk fit into the equation?
If you’re using a local Blynk server then what happens if communication with the Blynk app fails either because your Wi-Fi or internet connection goes down?
If you’re using the Blynk cloud server then what happens if the cloud server, or your internet connection goes down?

Pete.

  1. Im using latest blynk local server.

  2. Practically nothing happens, but im loosing remote controll of my boiler due to wifi issues
    blynk code continue to execute in nodemcu without wifi

My goal is not a liveability(its also) my goal is decrease device number… And increasce a replay level…
I cant ssh to nodemcu and check something, but i got working RPi3 with empty GPIO nearby

I want one controller for all boiler requirements and i want it sshable)))

Sorry but im get tider of this bullshit called nodejs…

i desided to get all data from w1 with cat /sys/bus/w1/devices and grep and awk all i need and calculate it on bash
and use blynk only as button API

thanks pal… Now im interested with node-red