Skip to content

Manage PoE ports on an LGS3XXP switch without having to use the Web UI

License

Notifications You must be signed in to change notification settings

frestr/lgs3xxp-poectrl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LGS3XXP PoE Control

Manage the state of Power-over-Ethernet (PoE) ports on a Linksys LGS3XXP smart switch (LGS308P, LGS318P, LGS326P) -- without having to use the Web UI!

Note

Only the LGS308P (8-port) model has been tested. Feel free to make a new issue on GitHub if you have the LGS318P or LGS326P models and they don't seem to work with poectrl.

Setup

Clone the git repository:

git clone https://github.com/frestr/lgs3xxp-poectrl.git
cd lgs3xxp-poectrl

Set up a Python virtual environment:

virtualenv venv
source venv/bin/activate

Install the package:

pip install .

Create a configuration file at ~/.config/poectrl/config.yaml and fill in the hostname of your switch, together with the switch's username and password (labels are optional):

hostname: 192.168.0.1
username: admin
password: admin
#labels:
#  1: foo
#  2: bar
#  3: baz

Tip

If you run poectrl without creating a configuration file first, a sample configuration will be created for you that you can then populate with your data.

Finally, test that everything works:

poectrl --status

Important

Your switch must have the HTTPS service enabled (In the Web UI: Configuration > Security > Management Security > User Access & Accounts > HTTPS Service). HTTP (without TLS) and Telnet is not supported.

Usage

$ poectrl --help
usage: poectrl [-h] [-v] [-s] [-p PORT_NUM | -l PORT_LABEL] [-e | -d | -c]

Manage the state of PoE ports on a LGS3XXP switch

options:
  -h, --help            show this help message and exit
  -v, --verbose         Verbose output
  -s, --status          Print current status of PoE ports. If provided together with -e|-d|-c, will
                        print status after update.
  -p PORT_NUM, --port PORT_NUM
                        Port number to operate on.
  -l PORT_LABEL, --label PORT_LABEL
                        Port label to operate on
  -e, --enable          Enable power on the specified port
  -d, --disable         Disable power on the specified port
  -c, --cycle           Power cycle the specified port

Examples

Note

Communicating with the switch can be quite slow. Wait times of 5-15 seconds per command is to be expected.

List port statuses:

$ poectrl --status
Port Num          PoE Status        Power Output      Operation         Label
--------          ----------        ------------      ---------         -----
1                 Enabled           0                 Searching         foo
2                 Enabled           0                 Searching         bar
3                 Enabled           3000              Delivering Power  baz
4                 Enabled           0                 Searching
5                 Enabled           0                 Searching
6                 Enabled           4400              Delivering Power
7                 Enabled           0                 Searching
8                 Enabled           0                 Searching

Disable a port by port number, followed up by a status listing:

$ poectrl --port 3 --disable --status
Port Num          PoE Status        Power Output      Operation         Label
--------          ----------        ------------      ---------         -----
1                 Enabled           0                 Searching         foo
2                 Enabled           0                 Searching         bar
3                 Disabled          0                 Disabled          baz
4                 Enabled           0                 Searching
5                 Enabled           0                 Searching
6                 Enabled           4200              Delivering Power
7                 Enabled           0                 Searching
8                 Enabled           0                 Searching

Enable a port by specifying its label:

$ poectrl --label baz --enable --status
Port Num          PoE Status        Power Output      Operation         Label
--------          ----------        ------------      ---------         -----
1                 Enabled           0                 Searching         foo
2                 Enabled           0                 Searching         bar
3                 Enabled           0                 Powering Up       baz
4                 Enabled           0                 Searching
5                 Enabled           0                 Searching
6                 Enabled           3700              Delivering Power
7                 Enabled           0                 Searching
8                 Enabled           0                 Searching

Power cycle a port:

$ poectrl --port 6 --cycle

Uninstalling

Uninstall the package:

pip uninstall poectrl

Remove the auxilliary files created during runtime:

rm -r ~/.config/poectrl ~/.cache/poectrl

About

Manage PoE ports on an LGS3XXP switch without having to use the Web UI

Resources

License

Stars

Watchers

Forks

Languages