# Need docs for luci.model.network

**URL:** <https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949>\
**Category:** Talk about Documentation\
**Created:** [December 6, 2023, 8:06pm UTC](https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949 "2023-12-06T20:06:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amonov](https://forum.openwrt.org/user_avatar/forum.openwrt.org/amonov/32/86252_2.png) [@Amonov](https://forum.openwrt.org/u/Amonov)\
**Post date:** [December 6, 2023, 8:06pm UTC](https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949/1 "2023-12-06T20:06:54Z")

</div>

Could someone please fill a gap in documentation. Have some projects that heavily rely on it. I get bugs occasionally there so it'd be really nice to have docs. Thx in advance.

---

<div class="post-metadata">

**Author:** ![DBAA](https://forum.openwrt.org/letter_avatar/dbaa/32/5_5575768a8748004e209b776fc1b2916d.png) [@DBAA](https://forum.openwrt.org/u/DBAA)\
**Post date:** [December 6, 2023, 8:29pm UTC](https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949/2 "2023-12-06T20:29:10Z")

</div>

That is the old lua based API which is deprecated as LuCI has moved to using more JavaScript client side and ucode server side.

See: [luci.model.network not documented · Issue #837 · openwrt/luci · GitHub](https://github.com/openwrt/luci/issues/837)

The LuCI client side JavaScript APIs are documented from comments extracted from the source here: [LuCI client side API documentation (openwrt.github.io)](http://openwrt.github.io/luci/jsapi/index.html)

---

<div class="post-metadata">

**Author:** ![Amonov](https://forum.openwrt.org/user_avatar/forum.openwrt.org/amonov/32/86252_2.png) [@Amonov](https://forum.openwrt.org/u/Amonov)\
**Post date:** [December 6, 2023, 8:38pm UTC](https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949/3 "2023-12-06T20:38:43Z")

</div>

I have lots of Lua code that uses this module, what should i do now? Is there a better module for Lua to work with wireless: get txpower, ssid, up/down and all?

---

<div class="post-metadata">

**Author:** ![DBAA](https://forum.openwrt.org/letter_avatar/dbaa/32/5_5575768a8748004e209b776fc1b2916d.png) [@DBAA](https://forum.openwrt.org/u/DBAA)\
**Post date:** [December 6, 2023, 9:07pm UTC](https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949/4 "2023-12-06T21:07:57Z")

</div>

Yes. The LuCI client side JavaScript APIs as mentioned in the last paragraph of my post. For example [Class: WifiNetwork getTXPower() (openwrt.github.io)](http://openwrt.github.io/luci/jsapi/LuCI.network.WifiNetwork.html#getTXPower),

---

<div class="post-metadata">

**Author:** ![Amonov](https://forum.openwrt.org/user_avatar/forum.openwrt.org/amonov/32/86252_2.png) [@Amonov](https://forum.openwrt.org/u/Amonov)\
**Post date:** [December 6, 2023, 9:14pm UTC](https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949/5 "2023-12-06T21:14:14Z")

</div>

Can't get how to use it from Lua code. Could you please send me a snippet?

---

<div class="post-metadata">

**Author:** ![DBAA](https://forum.openwrt.org/letter_avatar/dbaa/32/5_5575768a8748004e209b776fc1b2916d.png) [@DBAA](https://forum.openwrt.org/u/DBAA)\
**Post date:** [December 6, 2023, 9:31pm UTC](https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949/6 "2023-12-06T21:31:43Z")

</div>

For LuCI ucode has supplanted Lua server side. During the change to ucode the APIs were reworked so more is being done client side using JavaScript instead of in server side scripts.

Not sure how many ways I can state the same thing.

---

<div class="post-metadata">

**Author:** ![Amonov](https://forum.openwrt.org/user_avatar/forum.openwrt.org/amonov/32/86252_2.png) [@Amonov](https://forum.openwrt.org/u/Amonov)\
**Post date:** [December 6, 2023, 9:35pm UTC](https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949/7 "2023-12-06T21:35:12Z")

</div>

Sorry i forgot to mention: I use luci.model.network in scripts not part of cilent-server apps.

```plaintext
local nwm = require "luci.model.network".init()

for _, radio in ipairs(nwm:get_wifidevs()) do
    if radio:is_up() then
        print("radio", radio:ssid(), " is up")
    end
end

```

Is there any difference then?

---

<div class="post-metadata">

**Author:** ![DBAA](https://forum.openwrt.org/letter_avatar/dbaa/32/5_5575768a8748004e209b776fc1b2916d.png) [@DBAA](https://forum.openwrt.org/u/DBAA)\
**Post date:** [December 6, 2023, 11:11pm UTC](https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949/8 "2023-12-06T23:11:01Z")

</div>

The APIs for LuCI that are a layer over `ubus` and `uci` were moved client side.

So, for example the network API used by LuCI is now contained in client side JavaScript that makes calls back to `ubus` server side.

---

<div class="post-metadata">

**Author:** ![Amonov](https://forum.openwrt.org/user_avatar/forum.openwrt.org/amonov/32/86252_2.png) [@Amonov](https://forum.openwrt.org/u/Amonov)\
**Post date:** [December 7, 2023, 9:20am UTC](https://forum.openwrt.org/t/need-docs-for-luci-model-network/179949/9 "2023-12-07T09:20:02Z")

</div>

Thanks for explanations, dude. Tho I'm upset to hear that that module is deprecated : (
