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 only, so it is vendor-neutral; 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.2.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.2.0
File Size Uploaded Provenance Actions
aiosnmpswitch-0.2.0.tar.gz 137.9 kB With provenance Details for aiosnmpswitch-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 167.3 kB

Release files / aiosnmpswitch-0.2.0.tar.gz

Download URL aiosnmpswitch-0.2.0.tar.gz
Size 137.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9aee9c4d0ee6f66df8f27bb841d8752a1a81774a4c2627f9dec88a7b1c015161
BLAKE2b-256 checksum
How to use checksums
07050116be0c7ad6c85dc40243d41421f135cf20c774ebbca058d813c6dfb25b
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.2.0-py3-none-any.whl

Download URL aiosnmpswitch-0.2.0-py3-none-any.whl
Size 29.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb5abbcd729953b6db861a017d7dcaee875f81003d0f2445d13d383bbf6c5094
BLAKE2b-256 checksum
How to use checksums
0332419731b3fc6b14281e4b2dbd9d9ddc623f68b6c91c1842a2de0a998fde0e
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.2.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.2.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