Questions about using Blynk / nGrok with Onion Omega devices
-
Thanks for the link. I actually came across another variation of that article elsewhere, but this is still some good info.
So can you only use Node to interface with Blynk? Are there any PHP libraries available, by any chance?
Anyone else have any info regarding using nGrok?
Thanks,
-- Yvan
-
I tried to install the blink library by running this at the command line ...
opkg install blynk-library
.. but I'm getting the following error message:
**Unknown package 'blynk-library'.
Collected errors:- opkg_install_cmd: Cannot install package blynk-library.**
Has the package name changed or something?
- Yvan
-
As it turns out, I think I may have discovered an even bigger problem which relates to this. Here is a link to my other post:
-- Yvan
-
So, as it turns out .. it appears that this "blynk-library" package no longer exists. So I guess these articles must be completely wrong or outdated then? Does anyone here know what happened herre?
https://onion.io/2bt-blynk-omega/
https://www.instructables.com/id/Blynk-and-Omega2-Love/
It was my understanding that this is the only way to hook the Onion into the cloud nowadays. Is this no longer the case, and is there now no cloud connectivity offering at all whatsoever?
-- Yvan
-
@Yvan-Gagnon
I'm assuming you are on a fairly recent firmware?
In that case, the packages are not available in the repo.At some point between firmwares (I can't say exactly when, I haven't been tracking this) Onion have changed the domain of their opkg source repo. So if you are on an old firmware, the package will be available:
root@Omega-F967:~# oupgrade -v > Device Firmware Version: 0.1.10 b160 root@Omega-F967:~# opkg list | grep -i blynk blynk-library - 0.4.5-1 - Blynk library package built for mips.Updated:No Node Dependencies root@Omega-F967:~#
I would suspect that it's just an oversight that has taken place while Onion are moving between the legacy LEDE and newer OpenWrt environments.
So what can you do.
Well it seems there are a few options.- You can regress to an old firmware that is current (date wise) with the blog article and then following those instructions ought to work as expected, or;
- You can try and add the legacy repo configuration data to your
/etc/opkg/distfeeds.conf
file in your current newer firmware and try installing it, but I have no idea what will happen then. May work, may not, do this at your own risk.
If you're not feeling too adventurous and have time to spare, my suggestion would be that you ping @Lazar-Demin and ask him to include the build of the blynk libraries and everything associated with them and the blog article in the next firmware build. In that way, the packages ought to be available in the new repo going forward.
-
Thanks for your reply Cas. This might sound like a dumb question, but how would I go about contacting @Lazar-Demin as you've suggested? I followed the link you provided, but I see no obvious way to contact him privately.
-- Yvan
-
@Yvan-Gagnon
I'm not sure if you can contact him directly, but try creating a ticket on the Onion help desk and ask them to pass along a request to him to have a look at this thread?
-
Thanks .. I just submitted a ticket through the help desk.
-- Yvan
-
@Yvan-Gagnon
Well it turns out that you don't need the Onion blynk-library, you can just use the standard one. So you don't need to wait for @Lazar-Demin.Just follow the blynk 2 bullet Tuesday example with some minor modifications.
In the section "Let’s switch over to the Omega", substitute what is there with the following (assuming that you are running a b2xx firmware):
opkg update opkg install node-npm
NOTE - This requires a fair amount of space.[1]
Test that node and npm are working:
root@Omega-BFC9:~# node --version v8.10.0 root@Omega-BFC9:~# npm version { npm: '5.6.0', ares: '1.10.1-DEV', http_parser: '2.7.0', modules: '57', nghttp2: '1.25.0', node: '8.10.0', openssl: '1.0.2p', uv: '1.19.1', v8: '6.2.414.50', zlib: '1.2.11' }
NOTE -
npm
takes a bit of time to get going, so be patient.Then install the blynk-library using npm:
root@Omega-BFC9:~# npm install -g blynk-library /usr/bin/blynk-client -> /usr/lib/node_modules/blynk-library/bin/blynk-client.js /usr/bin/blynk-ctrl -> /usr/lib/node_modules/blynk-library/bin/blynk-ctrl.js + blynk-library@0.5.4 added 1 package in 22.028s
Create the
test.js
file as described, except you must change the source of the blynk-library in the first line of the file:var BlynkLib = require('/usr/lib/node_modules/blynk-library'); var blynk = new BlynkLib.Blynk('YOUR AUTH TOKEN HERE'); // !!! var v1 = new blynk.VirtualPin(1); v1.on('write', function(param) { console.log('Hi! Pin V1 is: ', param); });
Remember to use your own blynk auth token as described in the 2 bullet Tuesday article.
Then run and test:
root@Omega-BFC9:~# node test.js ___ __ __ / _ )/ /_ _____ / /__ / _ / / // / _ \/ '_/ /____/_/\_, /_//_/_/\_\ /___/ Give Blynk a Github star! => https://github.com/vshymanskyy/blynk-library-js Connecting to: blynk-cloud.com 443 SSL authorization... Connected Authorized Hi! Pin V1 is: [ '1' ] Hi! Pin V1 is: [ '0' ] Hi! Pin V1 is: [ '1' ] Hi! Pin V1 is: [ '0' ] ^C root@Omega-BFC9:~#
[1] - Here is a before and after snapshot of my free space when installing
node-npm
andnode
:root@Omega-BFC9:~# df -h Filesystem Size Used Available Use% Mounted on /dev/root 8.0M 8.0M 0 100% /rom tmpfs 61.0M 220.0K 60.8M 0% /tmp tmpfs 61.0M 112.0K 60.9M 0% /tmp/root tmpfs 512.0K 0 512.0K 0% /dev /dev/mtdblock6 22.3M 692.0K 21.6M 3% /overlay overlayfs:/overlay 22.3M 692.0K 21.6M 3% / root@Omega-BFC9:~# opkg install node-npm Installing node-npm (v8.10.0-3) to root... Downloading http://repo.onioniot.com/omega2/packages/packages/node-npm_v8.10.0-3_mipsel_24kc.ipk Installing node (v8.10.0-3) to root... Downloading http://repo.onioniot.com/omega2/packages/packages/node_v8.10.0-3_mipsel_24kc.ipk Configuring node. Configuring node-npm. root@Omega-BFC9:~# df -h Filesystem Size Used Available Use% Mounted on /dev/root 8.0M 8.0M 0 100% /rom tmpfs 61.0M 220.0K 60.8M 0% /tmp tmpfs 61.0M 112.0K 60.9M 0% /tmp/root tmpfs 512.0K 0 512.0K 0% /dev /dev/mtdblock6 22.3M 14.0M 8.3M 63% /overlay overlayfs:/overlay 22.3M 14.0M 8.3M 63% / root@Omega-BFC9:~#
If you do like I did the first time I tried this and install on an O2+ with insufficient space, you will run out of space during the installation. Thereafter it can be a bit of a PITA to regain space because
opkg
won't allow you to remove the packages that it didn't successfully install.In this case, there is a very handy utility here: opkg-cleanup.sh (Albeit, FOR OpenWRT 18.06 ONLY) that will get you out of trouble and manually remove the packages. You'll probably have to delete a file or two in /overlay/upper first so that you can create enough space to create the cleanup tool.
-
High quality advice, @cas
I've updated the Blynk article with these instructions as well.
@Yvan-Gagnon The Omega supports most of the large Cloud platforms, see Connecting to Cloud Platforms in the documentation.