Hello everyone this is my first project and what I am trying to do is running a command with a button press(virtual) and display the output on another virtual. Is this possible or do I have to read directly through the 1wire expansion module, in that case use this(dont know how at all to do with this, library?i2c DS2482 https://github.com/cybergibbons/DS2482_OneWire
Or even easier maybe - have a widget always display the latest graph/temperature all the time
My setup:
rpi3
R-pi i2c 1wire expansion module[v1.1 (DS2482-100+) where I got all my temp-meters connected to.
I read my temperatures through this commands and get the output for example 15.8125 right now
cat /mnt/1wire/28.D8F92F040000/temperature
cat /mnt/1wire/28.B11BBB030000/temperature
cat /mnt/1wire/28.88DB2F040000/temperature
My thougts is that a button/widget is getting the temperature and another widget is posting the temperature/output from the commandā¦
var Blynk = require('blynk-library');
var AUTH = 'zzzyyxx';
var blynk = new Blynk.Blynk(AUTH);
var v1 = new blynk.VirtualPin(1);
var v5 = new blynk.VirtualPin(5);
var process = require('child_process').exec,
child;
v1.on('read', function(param) { // Watches for V1 Button
console.log('V1:', param[0]); // prints value to CLI
});
// "run the command ifconfig"
v5.on('write', function(param) { // Watches for V5 Button
console.log('V5:', param[0]); // prints value to CLI
if (param == 1) { // Runs the CLI command ifconfig if the button on V5 is pre$
process.exec('cat /mnt/1wire/28.D8F92F040000/temperature',function (err,stdout,stderr) {
if (err) {
console.log("\n"+stderr);
} else {
console.log(stdout);
}
})
}
});
For the moment the code isnāt working at all. I think it has something to do with āprocess.execā regarding the error I get, combined with child_processā¦ Something
I am hoping there is a simple, and totally another type of, solution, for my function
(Secondary it would be awesome if I could move my rrddata in to Blynk (as I have stored many years of data in my rrddata files. for the moment Iām running it all in Apache as a webpage blynk.servebeer.com/daily.png)
@Jonaa please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```
It is possible (although I donāt use NodeJs as a Blynk client, so I canāt tell you how), but the normal process would be to use a timer to take readings on a regular basis (say every 5 or 10 seconds), and push the results to Blynk.
Have you looked at the NodeJs examples on the Blynk GitHub site?
Blynk doesnāt have a mechanism for uploading/importing historical data. I guess that if youāre running a local server and youāre experienced with PostgreSQL then you could try populating the database with your old records.
I guess āuse a timer to take readingsā is what I need to do - but how still remain then!
I use a DS2482 board and I found out something lika ālibraryā but I donāt know what to do with thisā¦ can I use it some way? i2c DS2482 https://github.com/cybergibbons/DS2482_OneWire
Yes I have read all but they all refer to āpgio pinā but I guess the problem is that none of my sensors is directly connected to my rpi but through the i2c 1wire breakout board / expansion module so Blynk canāt reach them.
AFAIK Blynk doesnāt read anything directly on the RPi GPIO (and only rudimentary GPIO control with other Arduino based MCUs).
One best uses whatever library works with the sensors and your choice of programming language, then utilize Blynk to control/display across that libraries commands.
What you need to do is find a suitable library to support your i2c device directly in NodeJS.
They all explaining āUsageā but I suck too hard on programming and unfortunately I donāt have the time this time in lifeā¦ I whish someone already have done the whole chain with this ds2482 bridge/controller step by step explaining it for me and I just change to my setup
Ok thenā¦ Neh I donāt have a clueā¦ I canāt even identify the programming langue when I see it, and therefore I also donāt know how to use what I seeā¦ I dont know what I am looking atā¦ as the npmjs.com librariesā¦ dunno what to do with then, use them etc.
Giving this thread a few more days and then leaving Blynk it seems not skilled enough to use it.
Blynk is not the real issueā¦ Yes, it advertises (or did at one time) as āprogramming freeā but that is only for the bare āBlinkinā an LEDā basics. But it does make a good starting ground, particularly as a GUI.
All DIY projects involving some form of MCU or SOC board, require a learning curve on the programming side. I am still (slowly) learning how to program my RPiās with Python (My prefered choice after trying a few). They can be very powerful devices with a little effort and the plentiful info/training resources on the web.
I think your main problem is that youāve chosen the wrong hardware with the Pi.
Blynkās ideal hardware platform is probably the ESP8266 based NodeMCU or the ESP32, and the best programming language for these boards is C++
These boards cost bust a few Dollars/Euros/Pounds each and you donāt have to mess around with operating systems and cope with long boot times the same way you do with the Pi. They obviously have much less processing power, memory and storage than the Pi, but are perfect for having a few sensors attached to them, connecting to WiFi and pushing data to the Blynk app.
Because most Blynk users use this type of hardware there are lots of ready-made examples in the Sketch Builder and many more in the forum topics. Even if you canāt find examples in these locations, there are a great many forum users who can easily point you in the right direction to get your code working. Very few forum users use NodeJS, so there is a much smaller pool of examples and experience to help out.
Blynk is an extremely powerful, flexible and affordable way of achieving the sort of results that you seem to be looking for, and itās worth sticking with it - but with the right hardware.
Take a read of this topic if you want more info about hardware choicesā¦
Might be so but I have build everything around Pi and hoped Blynk could work with the setup but the conclusion seems to be it isnāt so I will go try something else in the future if I run into something it was worth a try though.
Thanks for answering in the thread anyway, happy blynking to you all signing out
Well, the OP seems to have given upā¦ unfortunately, while still under the impression that the issue is Blynk related, rather then his needing to learn how to program a little with either NodeJS or Python.
I agree with you, my setup requires too much programming than I can handle. I will try docker and Home Assistans as I run Synology NAS too, and try that setup with my piās
I just want something more graphical that this and something with the possibility to put more stuff in the future in there.
Blynk is a fairly nice GUI/HMI, but some degree of programming will always be essential for custom projects that do real work. Start small, and learn a bit at a time. I didnāt know any programming when I started with Blynk (I donāt think BASIC, from waaay back when counts )
PS, here is a simple Python tutorial with RPi, for reading a temperature sensor like what I think you are usingā¦
Then once you have that figured out, it should be a bit easier to integrate that code into a Blynk Python sketch using SuperChart.
Before you go down the Home Assistant route, why not try a different approachā¦
Have you ever heard of Node-Red? Itās a graphical programming/workflow system that runs beautifully on an RPI and has a Blynk plug-in. It can access the ports on your RPI (GPIO pins, SPI, I2C etc) and doesnāt need any real programming skills. If you want to write custom functions you can do, but most of the time you can achieve what you want using the existing nodes and additional plug-ins.
Thereās a large community of developers who contribute plug-ins (known as āContribsā in Node-Red speak) and an active Node-Red support forum.
This is what I use as the heart of my home automation system and itās great. Personally, I donāt attach any sensors directly to the RPI (although that can be done). Instead I use ESP8266/NodeMCU type devices and get them to exchange data with the RPI via MQTT messages. This data can be things like temperature, pressure and humidity readings, or commands to activate relays etc attached to the NodeMCU devices.
Node-Red also has a built-in dashboard which can be used to display data, and provide widgets to control devices. Personally, I donāt like the dashboard, so use Blynk instead.
I recently decided to try exploring a Home Assistant. It has a massive learning curve, and the Docker version is crippled in a way which makes it almost impossible to use. I quickly switched to a conventional install on an RPI4 (which requires you to burn the image files to an SD card rather than do a conventional install from Buster etc) and spent around 3 full days evaluating it. Although it clearly has some nice features, but for me it was too far outside of my comfort zone to be worth the additional investment in time that would be needed to become fully comfortable with it, and migrate my systems to it.
If you want to know more about the way I use Node-Red in our Spanish holiday home then have a read of thisā¦