Great Weekend Project: Blynk app for your OpenWrt router

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

It is not proper syntax for Lua. The working one is below (example):

blynk:setProperty(42, "urls", "http://")
1 Like

Thanks Mavin7 I will give it a try!


I am especially interested in WiFi on/off as a means of Parental control. that’s why i also look for options to create a Switch in the App that can kill the internet for my sons devices only (by MAC adress i.e.).

Also, i would like a button that extends his allowance of internet time with 30 minutes, meaning that i have to be able to restrict it by a timer first. I can offcourse set time limits in Luci and bind those rules to a groups where all MC adresses are part of.


I am planning to modify some scripts that i found for OpenHAB.


Anyone cares to comment is this could work?


I figured out some options (as a newby!). Which of these could actually work (with some adaption) ?

Option 1:

blynk:on(“V21”, function(param)
if param[1] == “1” then

Option 2:

blynk:on(“V23”, function(param)
if param[1] == “1” then
os.execute(“sendCommand Internet_One,“ON””)
os.execute(“sendCommand Internet_One,”OFF””)

So this maybe a very optimistic idea, but if you could store connected MAC addresses (arp | grep br-lan | grep 0x2) and then run a timer to check new mac addresses if not found it send push notification of new device connection.

This has been a great start and I hope to release my whole project soon. As someone who got into coding through dabbling in bioinformatics\matlab i love the challenge, but some things are still past me!!

1 Like

I thought of creating two shell scripts that switch on or off the internet access for a group of devices.

Blynk interacts with a lua script that resides on my openwrt router.

How do i initiate these scripts?

In which folder on my router must these scripts be placed?

I have an alternative idea.

I use another Application (by k-szuster) on my router, where I can define Firewall rules. This is done by using a GUI on the router.

Each Firewall rule has a identifier. In my case: cfg0f92bd. This can be derived from the GUI, after one submits a so called ‘ticket’ to extend internet access in the firewall.

In the client.lua script, I am will try to create a command using that identifier.

This seems to work:’
blynk:on(“V30”, function(param) – 30 minutes extra for cfg0f92bd in the Access control Applicatie

local set_time = os.time()
t = 30 * 60
set_time = set_time + t

print(“uci set firewall.cfg0f92bd.ac_suspend=set_time”)
print(“uci commit firewall”)
print("/etc/init.d/firewall restart")

print(“30 minutes extra until:”"%H:%M", set_time))


The script is accepted, but the firewall is not giving (temp.) access to a mobile wifi connected client.

I’m working on a similar project. I simply used functions within the main Blynk lua script for my scripts. They directly interact with uci, scraping names iteratively using “uci show firewall.@rule[n].name” and then setting or unsetting the enable property. Not difficult. I’ll share my project when it’s complete.

What would it take to incorproate the “blynk_app_connected()” into this library? Or, to use it if it’s already usable?

This is the one piece I’m missing from my project.

I’ve got the following error. Can you please advice?

root@GL-AR750S:~/blynk-library-lua-0.1.4# ./examples/client.lua uYfwWuQaEtOU-lndO7SbjMIq0ytWA-3M

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ for Lua v0.1.4

Connecting Blynk (secure)...
Connecting Blynk (secure)...
Unexpected command: 41
Connecting Blynk (secure)...
^C^Xlua: ./examples/client.lua:54: interrupted!
stack traceback:
        [C]: in function 'sleep'
        ./examples/client.lua:54: in function 'fun'
        ./blynk.lua:54: in function 'emit'
        ./blynk.lua:107: in function 'disconnect'
        ./blynk/socket.lua:31: in function 'run'
        ./examples/client.lua:76: in main chunk
        [C]: ?

You have to use the older Blynk app.Which is named “Blynk 0.1 (lagacy)” in the App Store.
This package isn’t implented for the new Blynk app.


1 Like

how can this work with the new app?

The QR code won’t work, so you’ll need to aet-up the datastreams and manually add the widgets.

I’ve not tried this in either Legacy or Blynk IoT, but the important thing is that the library has been updated to support Blynk IoT so it should be re-creatable in IoT



do we need to update something?

I’d assume that your sketch needs to look something like this…

With the server specified as as it is in line 22 of the example above.