Hello. I want to add my own menu entry to LuCi web interface and follow this tutorial [OpenWrt Wiki] Adding new elements to LuCI but with no success. I double checked all paths, copy-pasted necessary code in necessary files but I see no menu entry when I login to LuCi web-interface. I reboot OpenWRT but I see no menu entry. I believe I am doing something wrong? May be tutorial is outdated? I just need to add menu entry which will interact with bash script.
Yes, lua has more or less been replaced with ucode and menus in json. Although you should still be able to use lua if you install luci-lua-runtime.
An easy starting point could be to install luci-app-example and edit its files. I have been meaning to do that (see Electricity price based control of IoT devices in LuCI), but so far I did not figure out how to best implement an interactive, graph based user interface, with minimal amount of new code. https://ucode.mein.io/ is a very nice introduction to the ucode language, a bit like "server-side Javascript".
OMG. Many thanks for that info. I wonder how many time I’d wasted trying to figure out how to use outdated tech. No, I do not want lua stuff at all, I will gladly use modern stack with json.
looks good. I wonder, by the way, why not build as interface modern stack like nginx and SQLite for interface and config storage accordingly? May be there are some interesting projects? I mean web-interface is like frontend - backend stuff and we already have best solutions in this field. Why not use it in OpenWRT?
insufficient flash space, and frequent writes like the ones DBs like to do, cause flash wear.
perhaps luci is not suitable for this, you may want to check out my mongoose lua bindings or the libmongoose if you prefer C.
Super easy to use, full featured, and the lua bindings provide access to all the usual openwrt goodies ..ubus .. uci ... etc.
you can make some pretty nice front ends using preact, react or vanila js or what ever you so desire to serve.
here's a few of the demos
device-dashboard
wifi-router-dashboard
mqtt dashboard
These are all from the mongoose tutorials written in c, i just translated each to lua using the bindings i wrote.
take a look at it, it offers websockets, mqtt, ssl, http, https(builtin or openssl or mbedTLS), RPC-over-websocket, timers, iobufs, queues, json parsing, json to lua, lua to json ...etc
its event driven and can run multiple servers, clients , websockets ..etc, simultaneously from one file if it suites you.
mongoose documentation --> mongoose docs
my repos
mongoose_lua (mg_lua)
libmongoose (dynamic C library)
mongoose-lua examples
if you're interested or would like to try the examples pm me and I'll send you the ow makefiles to pull the packages and help you get going.
I plan on publishing both packages to openwrt in the next few weeks, just running some final stress tests, so far the performance is very C like, as most lua libs are ![]()
cheers
This is just superamazing! Many thanks!
I do not plan anything special. I just want web-interface for telegram bot which send some notifications. I try to implement it using manuals from wiki but they outdated or do nothing and I just stuck.
I am not sure that I fully inderstand part about frequent writes. What can cause it? For example if I store data in SQL table and want to retrieve it only to write in config if config changes, any SQL db will frequently do some disk write procedures? Some kind of maintanance or technical info?
mongoose has a webui wizard for building ui's, i have not yet created lua bindings for it but its on the list ![]()
you can design the frontend and backend at the same time. There are some pretty good YT vids of how to implement it at use it.
its a pretty nifty tool, i 've used it for creating ui's for various iot devices.
https://mongoose.ws/wizard/#/code






