Hi everyone!
I’ve been recently creating a new dash for my ongoing blynk home automation project (it’s been running now for over three years now) and I’m starting to integrate my computer with it.
I’m running a nodejs script which reads (from now) reads data from the system and display it on the blynk app.
My “problem” is that i’m not able to change widget properties within the code:
var Blynk = require('blynk-library');
const si = require('systeminformation');
var AUTH = 'xxxx';
var blynk = new Blynk.Blynk(AUTH);
var vTemp = new blynk.VirtualPin(1);
var vMem = new blynk.VirtualPin(2);
blynk.on('connect', function() {
console.log("Blynk ready.");
});
setInterval(function() {
getTemp()
getMem()
}, 5000);
function getTemp(){
si.cpuTemperature()
.then(tmp=>{
vTemp.write(tmp.main)
blynk.setProperty(vTemp,"color","#D3435C")
});
}
function getMem(){
si.mem()
.then(mem=>{
var used = mem.used
var total = mem.total
var percent = used/total*100;
vMem.write(percent)
});
}
So, as you can see, in line:
blynk.setProperty(vTemp,"color","#D3435C")
I pass the pin, the parameter and the blynk red color to the setProperty function, which is on blynk.js source code (@ line 667 btw). and I’m not getting any errors here. Maybe I’m missing something.
Also, would love to know if there is any way for reading data from other devices besides using the bridge functionality.