Control PoE status on select Ubiquiti switches
Project description
Control PoE status on a Ubiquiti TS-8-Pro Switch
Development work for a system to remotely and automatically control the PoE status of individual ports on multiple Ubiquiti TS-8-Pro Switch, using predefined profiles.
This has currently only been tested on the TS-8-PRO ToughSwitch routers, though others will be added soon.
IMPORTANT: This library DOES NOT (and CAN NOT) ensure that any device attached to a port is compatible with the voltage selected. BE VERY CAREFUL that you choose the correct voltage for your devices or you can DAMAGE THEM. No responsibility is taken for equipment damaged using this library.
Status
This project is in no way ready to be used, and documentation is non-existent. See the Development Plans below. Until I have a stable useful interface, check the source code if you are interested 😃
Use Cases
- Control a set of PoE-powered IP cameras, switches and access points to allow disabling when not needed or quick enabling if required.
Configuration
The program is configured using a poectrl.json
file either in the current
working directory (first priority) or the user's home directory. This is a
simple file that describes all devices and profiles. There is an example in
poectrl-example.json :
{
"devices": {
"192.168.0.187": {"user": "ubnt", "password": "ubnt"},
"192.168.0.190": {"user": "ubnt", "password": "ubnt"}
},
"profiles": {
"cctv_on": {
"192.168.0.187": {"4": 24,"5": 24,"8": 48},
"192.168.0.190": {"5": 24,"6": 24,"7": 48}
},
"cctv_off": {
"192.168.0.187": {"4": 0,"5": 0,"8": 0},
"192.168.0.190": {"5": 0,"6": 0,"7": 0}
}
}
}
Usage
Apply a predefined profile, setting the PoE port voltages.
$ ./poectrl apply cctv_off
Using configuration from /home/seapagan/data/work/own/ts-8-pro-control/poectrl.json
Conncting to 192.168.0.187:
Setting port 4 to 0V
Setting port 5 to 0V
Setting port 8 to 0V
Conncting to 192.168.0.190:
Setting port 5 to 0V
Setting port 6 to 0V
Setting port 7 to 0V
List all defined profiles:
$ ./poectrl list
Using configuration from /home/seapagan/data/work/own/ts-8-pro-control/poectrl.json
Valid profiles are :
- cctv_on
- cctv_off
Show settings for a profile :
$ ./poectrl show cctv_off
Using configuration from /home/seapagan/data/work/own/ts-8-pro-control/poectrl.json
{
"192.168.0.187": {
"4": 0,
"5": 0,
"8": 0
},
"192.168.0.190": {
"5": 0,
"6": 0,
"7": 0
}
}
Development Plans
Current proposed project plan.
- Write proof-of-concept code to control ports.
- Refactor and tidy the above code into a Library Class.
- Create a basic CLI using this Library
- Continue the CLI to use a config file, show current values, list profiles etc.
- Publish on PyPi as a standalone package.
- Develop this into a full API (using FastAPI).
- Modify the command line app to interface with the above API.
- Create a Web App to interface with the above API.
Contributing
At this time, the project is barely in it's planning stage but I do have a firm idea where it's going and how to structure it. As such, other contributions are not looked for at this time. Hopefully, within a few days this project will be at a much more advanced stage and that will change 😃.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file poectrl-0.1.1.tar.gz
.
File metadata
- Download URL: poectrl-0.1.1.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.7 Linux/5.15.0-56-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eee4ff17157c4a1672d9f7181ce58a78b26a7a02149a38b8ab3223b022d46661 |
|
MD5 | d866d77feed8fe0f54e7f304ca7e9ca6 |
|
BLAKE2b-256 | 6855e7f39ea10cebaa98ffdb000c10803609450e29ac13e3267b0b1492372705 |
Provenance
File details
Details for the file poectrl-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: poectrl-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.7 Linux/5.15.0-56-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cafb3bd8e1306b52239d66fd12a4851127392054f10720279e2c9a6ddae60829 |
|
MD5 | a6f2a07459423ccded18728af094e066 |
|
BLAKE2b-256 | 89c1e1deed1a06adb7f3de228d931536c9d4563bf190cd6085a7d3b6cef6e41e |