Skip to main content

aiosynologysrm

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
aiosynologysrm

A Python library that reads what your Synology router knows: its own state, the devices on your network, and over time DHCP, Wi-Fi, firewall and more. It talks to the router's Web API (Synology Router Manager, SRM) and never changes a setting.

It is built as a foundation for integrations such as Home Assistant, but works in any asyncio program.

Unofficial. Not affiliated with, endorsed by or supported by Synology Inc. "Synology" and "SRM" are trademarks of Synology Inc.

Table of contents

Why this library?

synology-srm by aerialls pioneered Python access to SRM and is what Home Assistant's built-in integration uses. It is synchronous and has not changed since 2023. This library starts fresh for today's needs:

aiosynologysrm
Async built on aiohttp; shares your application's session, ready for Home Assistant
Read-only guarantee only allowlisted read calls can be sent; nothing can change your router
Credentials sent in the POST body, never in a URL or an error message
Firmware differences checks what each router offers: supports() tells you up front, and a call the router lacks raises SrmUnsupportedError instead of guessing
Mesh and standalone access points both are in scope, including telling which device a client is on
Typed and tested strict typing, tests against anonymized answers of real routers

Which devices work?

✅ Tested RT2600ac and MR2200ac with SRM 1.3.2
🟡 Expected to work RT6600ax, WRX560, RT1900ac with SRM 1.3 (not confirmed yet)
❔ Unknown SRM 1.2 and older
❌ Not in scope Synology NAS (DSM), other vendors' routers, changing settings

Router, mesh point and standalone access point are all supported modes. If the router lacks a feature, the library says so instead of guessing. Details and how to report your model: docs/compatibility.md.

Quick start

You need Python 3.12 or newer and an SRM administrator account (SRM's Web API only answers administrators; a dedicated account for your integration is a good idea).

pip install aiosynologysrm
import asyncio

import aiohttp

from aiosynologysrm import SrmClient


async def main() -> None:
    async with aiohttp.ClientSession() as session:
        async with SrmClient(
            "192.0.2.1",
            "admin-user",
            "secret",
            session=session,
            ssl=False,  # SRM ships a self-signed certificate; better: pin it, see below
        ) as client:
            info = await client.get_system_info()
            print(info.model, info.firmware_version)

            devices = await client.get_network_devices()
            for device in devices.devices:
                if device.online:
                    print(device.mac, device.hostname, device.connection)


asyncio.run(main())

Certificate and two-factor authentication

SRM ships a self-signed certificate, so the default ssl=True rejects it. Instead of switching verification off, pin the certificate: fetch its fingerprint once, let the user confirm it, store it and pass it on every connection.

from aiosynologysrm import get_certificate_fingerprint

fingerprint = await get_certificate_fingerprint("192.0.2.1")  # SHA-256, lowercase hex
client = SrmClient(..., ssl=aiohttp.Fingerprint(bytes.fromhex(fingerprint)))

A renewed certificate then raises SrmCertificateError until the new fingerprint is confirmed. ssl also takes False or an ssl.SSLContext.

Two-factor authentication works for interactive use only: otp_code is sent with the first login and never again. When the session ends, the next login raises SrmTwoFactorRequiredError and needs a fresh code. For unattended use (Home Assistant, scripts), create a dedicated administrator account without two-factor authentication.

What it can read

Method Returns
get_system_info() model, firmware, CPU, RAM, uptime
get_utilization() CPU and memory load, traffic per interface
get_network_devices() every known client: online state, IP addresses, Wi-Fi band and signal
get_operating_mode() router or standalone access point
get_wan_status() internet connection state for IPv4 and IPv6
get_external_addresses() public IPv4 and IPv6 address
get_ipv6_prefixes() delegated IPv6 prefixes and which local network uses them
get_dhcp_servers() DHCP ranges, gateway, DNS and lease time per local network
get_dhcp_leases() handed-out addresses (IPv4 and IPv6) with remaining lease time
get_dhcp_reservations() fixed address assignments
get_firewall_rules() default policies and every rule with its hit counter
get_forward_rules() firewall openings SRM created for port forwards, DMZ and UPnP
get_port_forwards() port forwards, including those devices opened through UPnP
get_port_triggers() port triggering rules
get_security_settings() SRM access from the internet, automatic openings, auto block
get_wifi_radios() each Wi-Fi radio: channel in use, automatic or fixed, width, power, BSSID
get_wifi_clients() signal, link rate, connection time and traffic of each Wi-Fi client
get_ethernet_ports() link state and speed of every Ethernet port
get_mesh_nodes() the router and its mesh points with status and client count
get_usb_volumes() USB storage: file system, size, free space

FirewallRules and SecuritySettings have a fingerprint property: a hash without hit counters, so you can detect configuration changes without comparing field by field. For any other list, aiosynologysrm.fingerprint(item.raw for item in items) gives the same kind of hash.

See the changelog for what each release adds.

Errors

Every error derives from SrmError. The ones you will meet most:

Error Meaning
SrmAuthenticationError wrong user or password, or the account is disabled
SrmTwoFactorRequiredError the account uses two-factor authentication; pass a fresh otp_code
SrmBlockedError the router blocks logins from this IP address after failed attempts
SrmCertificateError the certificate is not trusted or does not match the pinned fingerprint
SrmUnsupportedError this router or firmware does not offer the requested data
SrmConnectionError / SrmTimeoutError the router could not be reached

Error messages never contain passwords or session data, so they are safe to log.

Documentation

  • Compatibility: devices, firmware, modes, how support is decided
  • Design: how the library stays read-only, sessions, versions, privacy

Contributing

Reports with your router model and SRM version 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 aiosynologysrm 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 aiosynologysrm 0.3.0
File Size Uploaded Provenance
aiosynologysrm-0.3.0.tar.gz 61.1 kB With provenance Details

Built distribution (wheel)

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

Total release size: 91.3 kB

Release files / aiosynologysrm-0.3.0.tar.gz

Download URL aiosynologysrm-0.3.0.tar.gz
Size 61.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8ab454cc87c6dc92f6f2ea321a418927d10c72de6e110b809965b9e333c3a02b
BLAKE2b-256 checksum
How to use checksums
7f3ce77bc3d40e3e004846cfff99099f046d7969d785d4ccd5b701ee8691f576
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 24, 2026.

Transparency log

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

Download URL aiosynologysrm-0.3.0-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc9c87766046bc9ff51b3b06f18708ef95cbdf534900415bc3d6ffc116f03b1a
BLAKE2b-256 checksum
How to use checksums
98436b1e06d560b3304a5d7d8ba303a8956e265ce9eaf03bd40924d412c104c9
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 24, 2026.

Transparency log

Security for aiosynologysrm 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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aiosynologysrm-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 24, 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