{"id":23535128,"url":"https://github.com/luckman212/unifi-stp-prio","last_synced_at":"2025-05-14T20:35:11.556Z","repository":{"id":269598869,"uuid":"907946227","full_name":"luckman212/unifi-stp-prio","owner":"luckman212","description":"CLI program to show STP detail of Unifi switches using the UNA API","archived":false,"fork":false,"pushed_at":"2024-12-25T01:25:09.000Z","size":263,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-14T04:37:09.897Z","etag":null,"topics":["api","controller","rstp","spanning-tree","switch","unifi","wrapper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luckman212.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-24T17:08:49.000Z","updated_at":"2024-12-25T01:25:12.000Z","dependencies_parsed_at":"2024-12-24T18:38:48.030Z","dependency_job_id":null,"html_url":"https://github.com/luckman212/unifi-stp-prio","commit_stats":null,"previous_names":["luckman212/unifi-stp-prio"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckman212%2Funifi-stp-prio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckman212%2Funifi-stp-prio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckman212%2Funifi-stp-prio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckman212%2Funifi-stp-prio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luckman212","download_url":"https://codeload.github.com/luckman212/unifi-stp-prio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254222051,"owners_count":22034810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","controller","rstp","spanning-tree","switch","unifi","wrapper"],"created_at":"2024-12-26T01:15:01.139Z","updated_at":"2025-05-14T20:35:11.520Z","avatar_url":"https://github.com/luckman212.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=stp_icon.png width=160\u003e\n\n## stp_prio\n\nPython wrapper around the Unifi API to retrieve STP/RSTP priority (and other info such as MAC, model, IP, firmware version) of the USW switches at a site.\n\n### Setup and Usage\n\nRequires a semi-recent Python with the `requests` module installed.\n\nEdit the script to adjust the variables at the top such as site id, Unifi controller hostname, and API login credentials.\n\nRun with `-h` or `--help` for help on the commandline arguments.\n\n### Sample Output\n\n```\ndevice name    prio   type  model    MAC                IP             fw version\n─────────────────────────────────────────────────────────────────────────────────────\nsw01 - closet  4096   rstp  USPM16P  0c:ea:14:31:af:a2  192.168.20.11  7.1.26.15869\nsw02 - desk    8192   rstp  USM25G5  94:2a:6f:7e:4c:66  192.168.20.12  2.1.4.955\nsw03 - desk    12288  rstp  USL8LPB  f4:e2:c6:53:1e:f6  192.168.20.13  7.1.26.15869\n```\n\n### List of Environment Variables\n\n- `UNIFI_HOST` the hostname and port of your Unifi controller e.g. `unifi.foo.com:8443`\n- `UNIFI_USER` a user to authenticate with for API calls (typically `admin`)\n- `UNIFI_PASS` password (_yes_ I know it's not a good idea to store passwords in the clear! Please fork the script and improve the security by using a password manager, cryptography or whatever other method you see fit!)\n\n### Other Variables (hardcoded)\n\nCan be overridden using argument `--site/-s`.\n\n- `DEFAULT_SITE` = The default site to operate on (you will see this if you navigate to your Unifi controller, it is the part after the `/manage/` in the URL)\n\n### Example Helper Script\n\nHere's a small helper script example for storing credentials and vars in a separate file:\n\n```\n#!/bin/sh\n\nexport UNIFI_HOST=unifi.mycorp.net:8443\nexport UNIFI_USER=admin\nexport UNIFI_PASS=supersecret123\n\n/usr/local/bin/stp_prio.py \\\n  --site ioj7qtxy \\\n  \"$@\"\n```\n\n### Can this program do _xyz_ ?\n\nI wrote this to scratch my own itch. I've tested it fairly extensively on my own setup, but YMMV. I am running UNA version 9.0.106 as of this writing. Bugreports or PRs to add features welcome!\n\n### See Also\n\n- [luckman212/unifi-usp-control](https://github.com/luckman212/unifi-usp-control) - Control or retrieve status of a USP-Plug device\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckman212%2Funifi-stp-prio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluckman212%2Funifi-stp-prio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckman212%2Funifi-stp-prio/lists"}