Skip to main content

aiosnmpswitch

PyPI Python Release Date Downloads
PyPI Python versions GitHub release date PyPI downloads
CI License Typed Issues Discussions
CI License Checked with mypy GitHub issues GitHub discussions
aiosnmpswitch

A Python library that reads what your managed network switches know over SNMP: ports with link, speed and traffic, PoE, the MAC address table, LLDP neighbours, trunks and spanning tree. Across several switches it works out which device is connected to which port. It only reads and never changes a setting.

It uses standard MIBs, so it is vendor-neutral; a vendor table is read only where the standard one is missing and the table was measured on that model (temperatures of the HPE Instant On 1930). HPE OfficeConnect 1920S and HPE Instant On 1930 are the tested references. It is built as a foundation for Home Assistant, but works in any asyncio program.

Documentation: aiosnmpswitch.eize.dev

Which switches work?

✅ Tested HPE OfficeConnect 1920S (JL383A, PD.02.22), HPE Instant On 1930 (JL680A, 3.4.0.0)
🟡 Expected to work Managed switches with SNMP and the standard MIBs (IF-MIB, Q-BRIDGE-MIB, LLDP-MIB)
❔ Partly Switches without LLDP or Q-BRIDGE-MIB: fewer details, no uplink detection; PoE watts per port are not in the standard MIB
❌ Not in scope Unmanaged and "smart" switches without SNMP, changing settings

Each getter returns an empty result when the switch lacks its MIB. How to report your model: Compatibility.

Quick start

You need Python 3.12 or newer and SNMP read access to the switch: SNMPv3 (recommended) or a v2c community. To locate devices across several switches, LLDP must be on on each of them.

pip install aiosnmpswitch
import asyncio

from aiosnmpswitch import AuthProtocol, PrivProtocol, SnmpSwitch, UsmAuth
from aiosnmpswitch.helpers import SwitchData, locate_macs


async def main() -> None:
    auth = UsmAuth("monitor", "auth-key", "priv-key", AuthProtocol.SHA, PrivProtocol.AES128)
    async with await SnmpSwitch.connect("192.0.2.10", auth) as switch:
        system = await switch.get_system()
        print(system.name, system.descr)
        interfaces = await switch.get_interfaces()
        for port in interfaces.values():
            print(port.name, port.oper_status, port.high_speed, port.alias)

        data = SwitchData(
            interfaces=interfaces,
            bridge_ports=await switch.get_bridge_ports(),
            fdb=await switch.get_fdb(),
            lldp=await switch.get_lldp(),
            lag_ports=await switch.get_lag_ports(),
        )
        for mac, where in locate_macs({"core": data}).items():
            print(mac, "on port", where.port_name)


asyncio.run(main())

Documentation

Roadmap

Planned work is grouped in milestones.

Contributing

Reports with your switch model and firmware help most. See CONTRIBUTING.md; for security issues SECURITY.md.

License

MIT. Provided "as is", without warranty of any kind. The icon and header images are CC BY 4.0; their source is in eizedev/brand.

Metadata

Release files for aiosnmpswitch 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiosnmpswitch 0.3.0
File Size Uploaded Provenance Actions
aiosnmpswitch-0.3.0.tar.gz 141.5 kB With provenance Details for aiosnmpswitch-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiosnmpswitch 0.3.0
File Interpreter ABI Platform Actions
aiosnmpswitch-0.3.0-py3-none-any.whl Python 3 none any Details for aiosnmpswitch-0.3.0-py3-none-any.whl

Total release size: 173.0 kB

Release files / aiosnmpswitch-0.3.0.tar.gz

Download URL aiosnmpswitch-0.3.0.tar.gz
Size 141.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7987f94f575ff0b059f9254766ac0e14e58d5ff4f6af5075a1391cad827aae03
BLAKE2b-256 checksum
How to use checksums
56087b16b6954cba02bac99a375864ff38ae86e083094e5f7e0e3d8f0faa5650
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / aiosnmpswitch-0.3.0-py3-none-any.whl

Download URL aiosnmpswitch-0.3.0-py3-none-any.whl
Size 31.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ca699a5f40939e1150c2d05020810561979c5d389c89612a15c838b7b94da8a
BLAKE2b-256 checksum
How to use checksums
11339cc4019095cd6bf8ea3943695d2c0ba04a08ed38166053f5638438be91e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for aiosnmpswitch 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aiosnmpswitch-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page