Great Weekend Project: Blynk app for your OpenWrt router

I decided to create a small project, that explains how to use my Blynk for Lua library in real life. Enjoy! :zap:

Functionality:

  • Turn WiFi ON/OFF
  • Number of clients (interesting for WiFi)
  • Internet traffic charts
  • Charts for CPU, RAM, NAS (HDD) usage
  • Offline notification

Screenshot:

Let me know if have any other interesting ideas. What do you think about all this?

7 Likes

@blezek @raphik @blavery check this out!

@scargill, What do you think about this?

1 Like

good project. as soon as I’m installing the Openwrt on my mikrotik metarouter and testing. and a request: can you write an arduino sketch to monitoring SNMP protocol ?

thanks.

For any reason the command

wget -qO- https://github.com/vshymanskyy/blynk-library-lua/archive/v0.1.3.tar.gz | tar xvz

doesn’t work under OpenWrt (what is probably related to some Busybox incompatibility issue, because it does work under regular Linux as Ubuntu is).

Instead, a command that does the work under OpenWrt is
wget -qO- --no-check-certificate https://github.com/vshymanskyy/blynk-library-lua/archive/v0.1.3.tar.gz | tar -xvzf - -C ~

Has the same happened to someone else?

Please provide more details. Like, how does it fail?

root@LEDE:~# wget -qO- https://github.com/vshymanskyy/blynk-library-lua/archive/v0.1.3.tar.gz | tar xvz
tar: invalid magic
tar: short read

root@LEDE:~# wget -qO- --no-check-certificate https://github.com/vshymanskyy/blynk-library-lua/archive/v0.1.3.tar.gz | tar -xvzf - -C ~
blynk-library-lua-0.1.3/
blynk-library-lua-0.1.3/.gitignore
blynk-library-lua-0.1.3/LICENSE
blynk-library-lua-0.1.3/README.md
blynk-library-lua-0.1.3/blynk.lua
blynk-library-lua-0.1.3/blynk/
blynk-library-lua-0.1.3/blynk/nodemcu.lua
blynk-library-lua-0.1.3/blynk/pipe.lua
blynk-library-lua-0.1.3/blynk/socket.lua
blynk-library-lua-0.1.3/examples/
blynk-library-lua-0.1.3/examples/client.lua
blynk-library-lua-0.1.3/examples/nodemcu.lua
blynk-library-lua-0.1.3/timer.lua

what does wget -qO- --no-check-certificate https://github.com/vshymanskyy/blynk-library-lua/archive/v0.1.3.tar.gz itself output?

root@LEDE:~# wget -qO- --no-check-certificate https://github.com/vshymanskyy/blynk-library-lua/archive/v0.1.3.tar.gz

                                                   �80y�� ��G����{���C6�m�bSh*��00u,��_m�>��_����܌Җ��/��m���;Slyp3����l73����B�c�M� ��¿����S����ƃ�Y�vM�}�]�[```

oops… i meant without --no-check-certificate. obviously that one works

Without -qO- :

root@LEDE:~# wget --no-check-certificate https://github.com/vshymanskyy/blynk-library-lua/archive/v0.1.3.tar.gz
Downloading ‘https://github.com/vshymanskyy/blynk-library-lua/archive/v0.1.3.tar.gz
Connecting to 192.30.253.113:443
Redirected to /vshymanskyy/blynk-library-lua/tar.gz/v0.1.3 on codeload.github.com
Writing to ‘v0.1.3’
v0.1.3 6004 --:–:-- ETA
Download completed (6004 bytes)

root@LEDE:~# wget https://github.com/vshymanskyy/blynk-library-lua/archive/v0.1.3.tar.gz
Downloading ‘https://github.com/vshymanskyy/blynk-library-lua/archive/v0.1.3.tar.gz
Connecting to 192.30.253.112:443
Connection error: Invalid SSL certificate

hmm. looks like your OpenWRT misses some packages with certificates. I’d probably just change the default readme instructions. Thx!

You are welcome!

any way to check dsl line status like snr, bandwidth, attenuation,…?

Works perfectly on OpenWRT dsl modem (DM200). In my application it returns a lot of diagnostic data to diagnose and monitor DSL line. Currently very simple, but returning almost 30 different parameters it MIGHT eventually help to diagnose some weakness better than LAZY technician, who then tried to charge me for undone service :angry: Thanks!

By the way: if a space on target device is a concern (as in my case) there is another way for downloading and putting “Blynk for LUA” on remote device. I simply downloaded the release package from github and put it on OpenWRT device with SCP, so the whole stuff with “wget” can be omitted. This specifically addresses some @raphik’s issues.

1 Like

Wondering if anyone can help?
Do you know if the video stream Blynk.setProperty(V1, “url”, “http…”); works?

my code is:

    local wanwan = getWanIP()
    str = wanwan:gsub('[\r\n]','')
       blynk:virtualWrite(12, wanwan)
    local string camera1 = "https://"..str..":8080/video.url"
    print(camera1)
    local string camera2 = "https://"..str..":8080/video.url"
    print(camera2)

    Blynk.setProperty(V15, "url", camera1);
    Blynk.setProperty(V16, "url", camera2);

And it returns with

    https://80.189.158.233:8080/video.url
    https://80.189.158.233:8080/video.url
    lua: ./blynk.lua:61: attempt to index local 'self' (a nil value)
    stack traceback:
            ./blynk.lua:61: in function 'setProperty'
            blynkmon.lua:141: in function 'func'
            ./timer.lua:22: in function 'run'
            blynkmon.lua:152: in main chunk
            [C]: ?

Fantastic project @vshymanskyy any advise would be greatly appreciated
P.S. Don’t know why my code wrap isn’t formatting it properly

Because you didn’t use triple backticks. I’ve fixed it for you.

Pete.