HowTo: Add a new Luci checkbox and edit /etc/config/system

I am compiling V19.07.4 just fine.

The Ubiquiti NS-5AC ( has a secondary PoE port that is controlled by this section in /etc/config/system

config gpio_switch 'poe_passthrough'
        option name 'PoE Passthrough'
        option gpio_pin '3'
        option value '0'

But the current Luci does not allow editing of this section.

So my objective is to add a checkbox to the System/System page for that purpose.

I am a pretty good programmer ... but a bit lost working out:

  1. which file to edit to add my checkbox
  2. which file(s) to edit to cause the config file to be edited when clicking [Save & Apply] or [Save]

Any advice to get me started on the right track appreciated.


1 Like

Documenting here to help others with same question.

In file:


  if(uci.get('system','poe_passthrough')) {
                        o = s.taboption('general', form.Flag, 'value', _('Enable POE Passthrough<br>(24V from Main to Secondary)'));
                        o.ucisection = 'poe_passthrough';

This code not only displayed the new checkbox in System / System, but also updated /etc/config/system on [Save & Apply]. And yes: the PoE passthrough was controlled as expected.