Problem installing in RPi3: onoff library and later

Linux raspberrypi 4.4.32-aufs #1 Sat Nov 19 00:02:41 CET 2016 armv6l GNU/Linux

Yes a button in switch mode on V2.

Can you provide a screenshot so I can check the pin settings from

gpio readall

I have a relay board hooked up to BCM 23 & 24

Unlike the Zero, you donā€™t have a 21, so you will need to change the number in the sample I provided.

Numbers are BCM.

Keeps throwing this errorā€¦ not sure what I am doing here :stuck_out_tongue:

  relay = new Gpio(23 'out');   // Pi BCM # 23
                      ^^^^^

Oppsā€¦ missed a ,

Trying again :stuck_out_tongue:

OK, relay works :smiley: and I can get the other relay to toggle via direct pin control from appā€¦ but still no PWM on GP18 (toggling HIGH/LOW worksā€¦ guess ONOFF means exactly thatā€¦ no middle ground :wink: ).

But overall success I guess :+1: Just wish I understood how :confused:

Alsoā€¦ what programming language is thisā€¦ and where do I find command references?

Itā€™s basically javascript but known as nodejs.

@vshymanskyy has a few more examples at https://github.com/vshymanskyy/blynk-library-js/tree/master/examples/nodejs that include bridge, syncall and you will find term (terminal) if you search around.

Examples for Blynk are very thin on the ground but you can take from the wider internet.

As you have found, working with nodejs can be very fast. Quick change of the script and the pin is changed. Takes forever to recompile a sketch for ESPā€™s / Arduinoā€™s.

The error messages are a bit cryptic at first but you get used to them over time.

The other massive benefit is that you have all the rest of the Pi utilities available to you through nodejs. So now you can control a whole computer via the internet rather than just an MCU.

1 Like

Java, ehā€¦ guess I need to add another language to my bucket list after allā€¦ still just banging sticks together with C+ or whatever Arduino isā€¦ and I also canā€™t find too many examples (aka 0 ) of Blynk related wiringPiā€¦ which I have running concurrently with Nodejsā€¦

[quote=ā€œCostas, post:27, topic:11457ā€]
control a whole computer via the internet rather than just an MCU.
[/quote] Haā€¦ not likely for awhileā€¦ lots of sticks, but no fire yet :stuck_out_tongue:

Well, thank you again @Costas for sticking with me on this. Now I have some additional hope of actually using my RPi after years of neglect.

I would like all 11 million Raspberry Piā€™s connected to Blynk, in the next 2 weeks, and controlling appliances around their homes and businesses.

If only to silence some of the Omega technical gurus that donā€™t rate it, still think it suffers with SD card corruption and has no real world applications. Many of these gurus donā€™t know what Blynk can do when paired up with a Pi.

nodejs is cross platform too so you can use it elsewhere, even on an Omega.

There has been a lot of problems with the Omega 2 (no GPIO access and no SD card access etc). They are being fixed but they should have been available from launch date and they still have more issues to resolve. I would wait 6 months before considering an Omega unless you are a technical wizard and by then maybe Omega 3 will be available.

1 Like

Wise words, @Costas !

1 Like

Guys, avoid node v0.12 and before. v4.0.0+ is available for a long time.
Just remove previous node versions and follow our tutorial to install the fresh one

1 Like

Like this?

Which led to thisā€¦

Which brings us right back to the whole compatibility issue with ONOFF and thus limited Blynk usability.

If the solution is to simply not use older hardware, then please just specify such in the tutorials. Donā€™t keep pointing back to that which does not work.

Sorry, didnā€™t mean thatā€¦ It appears that they dropped support some time ago - which we were not aware of.
Iā€™ll try to find a new, working way

Thank you @vshymanskyy

I know the issue is not ā€˜directlyā€™ Blynk related, but again, thank you for continuing to look into it :+1:

if uname -m gives you armv6l, check if this works for you:

sudo su

cd /opt

wget https://nodejs.org/dist/v6.9.5/node-v6.9.5-linux-armv6l.tar.gz -O - | tar -xz
mv node-v6.9.5-linux-armv6l nodejs

apt-get purge node nodejs -y
apt-get autoremove
apt-get update
apt-get install build-essential

ln -s /opt/nodejs/bin/node /usr/bin/node
ln -s /opt/nodejs/bin/node /usr/bin/nodejs
ln -s /opt/nodejs/bin/npm /usr/bin/npm

npm install -g blynk-library onoff

exit

Now, to run Blynk:

export PATH=$PATH:/opt/nodejs/bin/
unset NODE_PATH
blynk-client your_auth_token

After sudo su, (nice trick, I will have to remember that one), the next few lines were essentualy the same as my previously mentioned alternative methods of installing NODE, just with a slightly newer version.

The rest of the commands are becoming familiar, from repetition :stuck_out_tongue:

However, in the end nothing happensā€¦ no error, no delay, nothingā€¦

PS, not worried about showing the authā€¦ it is for testing only :wink:

OK, @vshymanskyy I cleared out all remnants of node, nodejs & npm that I could find, including any in /opt and /usr/bin, so I could start from relative scratch. I did not remove any Blynk directories as I didnā€™t know which ones were related to my wiringPi install.

I then re-ran through your entire list of commands againā€¦ and the only warnings were at the very last installā€¦

root@raspberrypi:~# npm install -g blynk-library onoff
/opt/nodejs/bin/blynk-client -> /opt/nodejs/lib/node_modules/blynk-library/bin/blynk-client.js
/opt/nodejs/bin/blynk-ctrl -> /opt/nodejs/lib/node_modules/blynk-library/bin/blynk-ctrl.js

> epoll@0.1.20 install /opt/nodejs/lib/node_modules/onoff/node_modules/epoll
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.9.5"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/opt/nodejs/lib/node_modules/onoff/node_modules/epoll/.node-gyp"
make: Entering directory '/opt/nodejs/lib/node_modules/onoff/node_modules/epoll/build'
  CXX(target) Release/obj.target/epoll/src/epoll.o
  SOLINK_MODULE(target) Release/obj.target/epoll.node
  COPY Release/epoll.node
make: Leaving directory '/opt/nodejs/lib/node_modules/onoff/node_modules/epoll/build'
/opt/nodejs/lib
ā”œā”€ā”€ blynk-library@0.4.5
ā””ā”€ā”¬ onoff@1.1.1
  ā””ā”€ā”¬ epoll@0.1.20
    ā”œā”€ā”€ bindings@1.2.1
    ā””ā”€ā”€ nan@2.4.0

Unfortunately, after running the blynk-client <auth> command, I still have the same null resultā€¦ no errors or delays before jumping back to the CLI prompt.

@Gunner I did it on my Raspberry PI Model B without mounting holes from 2012 - and it works.
run these commands and show your output:

uname -m
uname -a
cat /etc/os-release
cat /etc/debian_version
cat /proc/cpuinfo
echo $PATH
echo $NODE_PATH
node --version
npm -v

P.S. I did a clean install of 2017-01-11-raspbian-jessie, expanded image, enabled VNC and SSH if that can matter

You can also try:
npm install -g npm
and then reinstall blynk and onoff
I will take looooots of timeā€¦

Which one of the symbolic links above, if any, allows us to use commands without the .js suffix i.e.

blynk-client <token>

rather than

blynk-client.js <token>