Python · asyncio · SNMP · read only
aiosnmpswitch¶
Reads what your managed network switches know: ports, PoE, the MAC address table, LLDP neighbours, trunks and spanning tree, and works out which device is connected to which port. Over SNMP, without changing a setting.
pip install aiosnmpswitch
- Getting started
Install, SNMPv3 or v2c, first read. - What it can read
Every getter, one per MIB group, and the helpers. - Locating devices
Which device is on which port, across switches. - Errors
Timeouts, rejected credentials, missing MIBs. - Diagnostics
A report for an issue, without personal data. - Compatibility
Tested switches and vendor quirks. - Design
Standard MIBs, read only, privacy.
Why this library?¶
Home Assistant's built-in SNMP integration reads one OID per entity from YAML. This library starts from the standard MIBs every managed switch implements:
| aiosnmpswitch | |
|---|---|
| Async | pysnmp 7 (also used by Home Assistant's SNMP integration); pysnmp is loaded, its MIB files read and its engine created in a worker thread, not in the event loop |
| Read only | only GET, GETNEXT and GETBULK; there is no code path that sets a value |
| Vendor-neutral | IF-MIB, BRIDGE-MIB, Q-BRIDGE-MIB, LLDP-MIB, IEEE8023-LAG-MIB, POWER-ETHERNET-MIB, IP-MIB; vendor quirks handled where they were measured |
| Device locations | combines the address tables and LLDP of all your switches: a device is on the port that is not an uplink |
| Targeted reads | walks only the tables it needs; a full walk of some switches takes minutes |
| Typed and tested | strict typing, 100 % test coverage against anonymized recordings of real switches |
Not affiliated with any switch vendor. Product names are trademarks of their owners.