Hi, I'm trying to query openwrt router for some stuff like devices, wifi, wan/lan interfaces, etc,etc.
Is there an openwrt api that luci uses to get this data?
I'm working on a side project and would like to fetch stuff like dhcp leases and few other things.
OpenWrt uses ubus for communication between different parts of itself, facilitated by a daemon called ubusd. The LuCI web server is uhttpd, which provides an HTTP interface to ubus and is used by LuCI in your browser.
There's also a command line utility, also called ubus, that you can invoke via SSH. Here are some examples using OpenSSH to retrieve DHCP leases from an OpenWrt device:
If I wanted to use ubus via CLI, is there a wiki on all the commands / examples of stuff like setting device static IP, updating lan address space, etc etc?
Thank you for all the input so far.
You don't need to use ubus on the CLI to make those changes, just call the uci command directly. If you want to know the exact uci commands you need, LuCI can tell you this.
Make the desired changes in LuCI and use "Save", not "Save & Apply".
Click on the "Unsaved Changes" label on the upper-right corner of the page to see the uci commands that will be applied when you click "Save & Apply". Click on "Revert" to abandon those changes.
After making the changes you want via uci, you need to then call this to apply the changes:
I would like to make the changes remotely as in on the same network but from a different device.
Here's my goal:
I've been creating a personal webapp for my own use and family. It's still in the early alpha stage, I might rip it apart and start over though. Right now I'm fetching data via the www folder, where my app scrapes it. Kind of lame.
I would like to do things such as a reboot, set static IPs for devices, maybe a static route. Enable / disable VPN client. The problem with Luci is it's not very polished or user-friendly for a normal person such as my wife/kids. Luci is great for me but not for the family.
I'm using a Firewalla Gold Plus right now but it was $600.