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
❌ 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.

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.1.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.1.0
File Size Uploaded Provenance Actions
aiosnmpswitch-0.1.0.tar.gz 135.9 kB With provenance Details for aiosnmpswitch-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 164.6 kB

Release files / aiosnmpswitch-0.1.0.tar.gz

Download URL aiosnmpswitch-0.1.0.tar.gz
Size 135.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8940e3f0a20bcc32a563e86b8d8c770e69c0db5a5e834950ce80df5b702f6bc1
BLAKE2b-256 checksum
How to use checksums
8529f7c64f64b46312dfd67246b7d93abcdb8b3c508782a430a10a79f806d5b9
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.1.0-py3-none-any.whl

Download URL aiosnmpswitch-0.1.0-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11927ed4902f05bc6a869123763f93c4b9975f29d54b478257533e1027808da5
BLAKE2b-256 checksum
How to use checksums
57672d9584978d354150f10e799caf70fc9732fd93eef27d47bb5cd82b1c461c
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.1.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.1.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