Skip to main content

aiopnsense

GitHub Release GitHub Release Date GitHub Activity Coverage Documentation License

PyPI

aiopnsense is an async Python client library for OPNsense.

What this library does

aiopnsense wraps supported OPNsense REST endpoints behind a single async client, OPNsenseClient. It is designed for applications that need to query router state or trigger supported OPNsense actions without manually building HTTP requests.

The client currently includes helpers for:

  • system information, notices, certificates, CARP, Wake-on-LAN, reboot, and interface reloads
  • firmware version checks, update status, and upgrade actions
  • interface, gateway, CPU, memory, filesystem, and temperature telemetry
  • diagnostics traffic snapshots and live interface traffic stream samples
  • DHCP lease, IPv4 ARP table, IPv6 NDP table, and timestamped host-observation access
  • firewall rules, NAT rules, alias toggling, and state killing
  • service status lookup and service start/stop/restart operations
  • SMART device listing and per-device SMART detail queries
  • Unbound blocklist management, DNS query statistics, and query log search
  • OpenVPN and WireGuard status plus VPN instance toggling
  • IPsec phase 1 (IKE) connection status plus connection toggling, and phase 2 (child SA) status
  • vnStat metrics, captive portal vouchers, and speed test data

Requirements

  • Requires OPNsense Firmware >= 25.1

    • For firmware < 26.1.1, the Firewall and NAT methods will return empty data.

Documentation

Live test scripts

The scripts/ directory includes live diagnostic helpers for maintainers:

  • aiopnsense_dump.py runs supported aiopnsense client endpoints and prints the raw data returned by the library.
  • opnsense_api_call.py calls an arbitrary OPNsense API endpoint with a specified method and optional POST payload.

Both scripts read credentials from scripts/aiopnsense.env by default. Copy scripts/aiopnsense.env.example to create your local env file; it is ignored by git. Full CLI reference is in the Read the Docs script documentation.

Origin and Purpose

aiopnsense was extracted from the hass-opnsense integration. It is primarily used as an external dependency by hass-opnsense and Home Assistant for its OPNsense Integration.

Changelog

1.6.1 (2026-11-27)

Bug Fixes

  • keep WireGuard Server instances separate under Status Access (#272) (edb55ea)

1.6.0 (2026-11-26)

Features

Bug Fixes

  • distinguish failed Speedtest reads from a missing plugin (#261) (52e65cb)
  • distinguish unavailable speedtest reads from missing plugin (52e65cb)
  • keep observing firmware install through an empty lock state (#267) (bf7cf6f)
  • make shared-key WireGuard status order-independent (#247) (5e6597c)
  • preserve NUT inventory when status reads fail (#260) (299709d)
  • preserve readable DHCP lease inventory (#270) (bfa524e)
  • preserve Unbound switches when inventory reads fail (#255) (d1a59a1)
  • preserve unknown gateway inventory on read failure (#257) (3764a05)
  • preserve unknown interface inventories on read failure (#254) (8d2a152)
  • preserve unknown service inventories (#256) (4dab499)
  • preserve unknown SMART results on read failure (#259) (cea1406)
  • preserve unknown vnStat inventories on read failure (#263) (d38a6ce)
  • preserve unreadable telemetry inventories (#258) (af11106)
  • preserve VPN status after configuration denial (#246) (b3d1565)
  • report an unreadable firewall rule group as unknown (#251) (d67dc1a)
  • report malformed service inventories as unknown (#268) (9c4be29)

Documentation

  • agents: allow read-only network lookups without asking (#266) (ec33a4c)
  • align documentation with ADR 0004 (#265) (5f2d1b3)
  • align glossary terms with hass-opnsense (#250) (d991331)
  • define Status Access and Configuration Access (#244) (2ec54ed)
  • extend ADR 0004 to unknown inventories (#262) (97f8b72)

Code Refactoring

  • centralize WireGuard link assembly (#269) (75e0a22)
  • share inventory read policy for Services and SMART (#271) (5cdf37b)

Continuous Integration

  • expose the checkout tested by pytest (#264) (496c603)

1.5.0 (2026-11-24)

Features

  • expose firmware requirements via get_firmware_requirements (#188) (f9fb9a6)

Bug Fixes

  • block forbidden firmware requests at the HTTP boundary (#212) (3205b7a)
  • close the client when validation fails in aenter (#190) (ecdc6f3)
  • compare beta firmware builds and test real version shapes (#209) (334434c)
  • give firmware gating one policy for unknown firmware (#195) (91769ad)
  • guard legacy Unbound writes against incomplete settings (#199) (0925dbd)
  • keep validation’s error mode local (#240) (ebfb771)
  • limit automatic firmware checks to one per hour (#205) (e5f92d5)
  • name public methods in request failure logs and give dispatch one home (#227) (9eac267)
  • raise Unbound blocklist errors when throw_errors is on (#194) (1cb9b51)
  • read the system time endpoint of the firmware's Endpoint Style (#238) (360e01a)
  • report every HTTP request failure through one shared classification (#196) (c26612f)
  • reset endpoint state after verified firmware install (#242) (a1c46de)
  • run every Toggle through one Toggle module and stop reporting unsaved changes as success (#197) (a4226f3)
  • skip queued POSTs cancelled before dispatch (#200) (36cb432)
  • support explicit VPN toggle target states (#185) (e52757c)
  • treat empty WireGuard inventory lists as empty (#229) (85bdb4c)
  • treat trailing zero version components as equal in firmware_is_at_least (#189) (13e7244)

Dependencies

  • bump astral-sh/setup-uv from 10.3.2 to 10.3.3 in the github-actions group (#177) (2f33a4e)
  • bump py-cov-action/python-coverage-comment-action from 4.5 to 4.6 in the github-actions group (#183) (ceb59d0)
  • bump the python-dependencies group with 10 updates (#178) (048cab5)
  • bump the python-dependencies group with 10 updates (#181) (ac34f6c)
  • bump the python-dependencies group with 6 updates (#184) (dd33af2)
  • update prek hooks (#179) (f091275)
  • update prek hooks (#182) (f39ff84)
  • update prek hooks (#226) (64a6b40)

Documentation

  • document worktree imports and test conventions for agents (#192) (6d8cb6c)
  • note that pydoclint runs through prek (#211) (ab7c9dc)
  • record read-only tests and endpoint tracing (#223) (3a35a3b)
  • require tracing Router failure paths before trusting responses (#207) (d61bb11)
  • say how to find the main checkout venv (#230) (919b4d5)
  • show how to run live Router scripts from worktrees (#206) (0a6aec1)
  • specify public behavior in refactor specs (#203) (badd29b)

Miscellaneous Chores

  • add domain glossary, coding standards, Toggle ADR, and rename recommended firmware constant (#187) (fe1fba2)
  • document API placement and add a manual docs build hook (#191) (4b88e41)
  • set up mattpocock agent skills config (#186) (4a261f2)

Code Refactoring

  • add endpoint outcome reads beside the probe path (#213) (14df796)
  • decode server-sent events in one pure module (#235) (c2d2892)
  • give the endpoint availability cache one home (#234) (e9b2b9a)
  • give the transport one request body (#236) (adb02c8)
  • match each WireGuard link once (#239) (6bb6565)
  • read DHCP and SMART endpoints in one request (#215) (0fd5dc0)
  • read firewall, unbound, vouchers, vnstat, traffic and speedtest in one request (#217) (abd84d0)
  • read firmware status in one request (#218) (18f30d6)
  • read telemetry and system endpoints in one request (#216) (b3ed5b9)
  • read VPN inventories in one request (#214) (e4209b1)
  • remove the legacy endpoint probe path (#219) (aa82631)
  • resolve Endpoint Style inside the fetch (#237) (6491bd2)
  • share DHCP Lease normalization across backends (#193) (933c40b)

Tests

  • count only validation error logs (#241) (7df252f)
  • cover queued failures from the PR #194 retrospective (#201) (9ec3ae3)
  • enforce private names in private modules (#202) (a385763)
  • enforce the firmware endpoint rule from ADR 0002 (#208) (5bec4d4)
  • fail fast on unanswered queued requests (#222) (8ca65c2)
  • guard request logs against URL credential leaks (#204) (0837c63)
  • make the aiohttp session the one test seam (#228) (bd8a460)
  • pin endpoint paths as literals in every test module (#233) (e9b8f38)
  • pin firmware endpoint paths as literals (#232) (cfe686f)

Continuous Integration

1.4.1 (2026-11-06)

Bug Fixes

  • POST to unbound/service/dnsbl so blocklist toggles apply on OPNsense >= 26.1.6 (#176) (b6d98ef)
  • POST to unbound/service/dnsbl so extended blocklist toggles apply (b6d98ef)

Dependencies

1.4.0 (2026-11-01)

Features

  • return normalized ARP and NDP table entries (#172) (3538339)

Dependencies

  • bump astral-sh/setup-uv from 10.3.0 to 10.3.2 in the github-actions group (#170) (8484c75)
  • bump the python-dependencies group with 6 updates (#171) (3dc27f8)

1.3.3 (2026-10-30)

Bug Fixes

  • deps: update certifi to remove compromised CA trust (#165) (6b37b1d)
  • migrate pydoclint configuration for updated hooks (#167) (8c909a9)
  • verify firmware installation lifecycle (#169) (cd9884d)

Dependencies

1.3.2 (2026-10-18)

Bug Fixes

  • reject incomplete IPsec, OpenVPN, and WireGuard inventories (#160) (5b7bb1d)

1.3.1 (2026-10-17)

Features

  • add IPsec child (phase 2) status to get_ipsec (#153) (f1df285)
  • add IPsec connection enabled state and toggling (#151) (bba8894)

Bug Fixes

  • distinguish unavailable VPN status from empty sessions (#159) (87beec3)
  • suppress repeated request outage logs until recovery (#152) (a16d90f)

Dependencies

  • bump astral-sh/setup-uv from 10.2.0 to 10.3.0 in the github-actions group (#157) (bd59948)
  • bump the python-dependencies group with 5 updates (#158) (bb2de9d)

Miscellaneous Chores

Tests

  • avoid timezone overflow in voucher fixtures (#154) (dd602e8)

1.3.0 (2026-10-16)

Features

  • add IPsec phase 1 connection status via get_ipsec (#149) (97902cd)
  • expose timestamped MAC host observations (#148) (0480523)

1.2.1 (2026-10-12)

Bug Fixes

  • correct firmware hotfix version ordering (#146) (82fd517)

1.2.0 (2026-10-09)

Features

Bug Fixes

  • group Dependabot GitHub Actions updates (#140) (b28f2b6)

Dependencies

  • bump astral-sh/setup-uv from 10.0.1 to 10.1.0 (#134) (19a184b)
  • bump astral-sh/setup-uv from 10.1.0 to 10.2.0 (#138) (0f5ce2c)
  • bump py-cov-action/python-coverage-comment-action from 4.3 to 4.5 (#137) (0092a0f)
  • bump the python-dependencies group with 4 updates (#135) (310fbe9)
  • bump the python-dependencies group with 4 updates (#136) (853b217)
  • bump the python-dependencies group with 4 updates (#139) (c4ce98b)
  • bump the python-dependencies group with 4 updates (#142) (ec4e056)

Miscellaneous Chores

  • deps: patch vulnerable multidict and urllib3 (#145) (0195d41)

1.1.11 (2026-09-13)

Bug Fixes

  • accept release commit SHA as publish target (#131) (869f88f)
  • distinguish failed ARP lookups from empty tables (#133) (8c1b5c1)

1.1.10 (2026-09-13)

Bug Fixes

  • include all Release Please changelog types (#128) (3317a8b)
  • instance service control paths (#111) (daa6feb)
  • recognize releasable dependency updates (#126) (a5e4a22)

Dependencies

  • bump actions/download-artifact from 7 to 8 (fc2e871)
  • bump the python-dependencies group with 3 updates (#130) (b86a46c)

Miscellaneous Chores

Continuous Integration

v1.1.9 (2026-09-04)

Full Changelog

Bug Fixes

  • Fix empty Dnsmasq lease interface discovery #108 (Snuffy2)

Code Quality

  • Add OpenVPN toggle response logging #113 (Snuffy2)
  • Modernize CI and release automation with uv #106 (Snuffy2)

Maintenance

  • Fix protected release promotion statuses #114 (Snuffy2)
  • Migrate release workflow to published releases #112 (Snuffy2)
  • Fix GitHub release repository detection #110 (Snuffy2)
  • Update pytest coverage workflows for action v4 #109 (Snuffy2)
  • Skip coverage comments for prek autoupdate bot #104 (Snuffy2)
  • Add prek-autoupdate bot auto-merge workflow #102 (Snuffy2)

Other Changes

  • test: optimize and de-brittle test suite #100 (Snuffy2)

v1.1.8 (2026-08-30)

Full Changelog

v1.1.7 (2026-08-08)

Full Changelog

Documentation

  • Add pydoclint documentation checks #95 (Snuffy2)

Code Quality

  • Reuse parsed vnStat period labels #99 (Snuffy2)
  • Optimize and harden DHCP lease collection #98 (Snuffy2)
  • Defer caught-error log rendering #97 (Snuffy2)
  • Avoid expensive caller stack inspection #96 (Snuffy2)

v1.1.6 (2026-08-01)

Full Changelog

Bug Fixes

  • Cache endpoint permission failures #91 (Snuffy2)

Maintenance

v1.1.5 (2026-07-21)

Full Changelog

Bug Fixes

v1.1.4 (2026-07-20)

Full Changelog

Enhancements

  • Support alternate Speedtest plugins #80 (Snuffy2)

Bug Fixes

  • Parse raw NUT UPS status responses #79 (Snuffy2)

v1.1.3 (2026-07-16)

Full Changelog

Bug Fixes

  • Switch firewall rule retrieval to CSV downloads #77 (Snuffy2)

v1.1.2 (2026-07-15)

Full Changelog

Enhancements

  • Raise public OPNsense exceptions consistently #76 (Snuffy2)

v1.1.1 (2026-07-12)

Full Changelog

Enhancements

  • Allow validation without device identity #75 (Snuffy2)

Documentation

Code Quality

Maintenance

v1.1.0 (2026-07-03)

Full Changelog

New Features

Enhancements

  • Handle OPNsense 26.1.11 API changes #69 (Snuffy2)
  • Normalize OPNsense NAT and DHCP payloads #68 (Snuffy2)

Code Quality

Maintenance

v1.0.15 (2026-06-28)

Full Changelog

Bug Fixes

v1.0.14 (2026-06-21)

Full Changelog

Enhancements

  • Raise missing device unique ID during validation #56 (Snuffy2)

Bug Fixes

  • Preserve deprecated set_use_snake_case compatibility #55 (Snuffy2)

v1.0.13 (2026-06-21)

Full Changelog

Bug Fixes

v1.0.12 (2026-06-20)

Full Changelog

Bug Fixes

Code Quality

  • Move OPNsense endpoints to module constants #53 (Snuffy2)

v1.0.11 (2026-06-20)

Full Changelog

New Features

Documentation

  • Add Documentation link to pyproject #44 (Snuffy2)

Code Quality

  • Refactor method-aware endpoint availability #48 (Snuffy2)

Maintenance

v1.0.10 (2026-05-29)

Full Changelog

Enhancements

Documentation

v1.0.9 (2026-05-29)

Full Changelog

Bug Fixes

Code Quality

v1.0.8 (2026-04-06)

Full Changelog

Maintenance

  • Merge changelog and release actions #35 (Snuffy2)

v1.0.7 (2026-04-05)

Full Changelog

Bug Fixes

Documentation

v1.0.6 (2026-04-05)

Full Changelog

Enhancements

  • Add back legacy unbound blocklist support #26 (Snuffy2)
  • Add back legacy camelCase support #25 (Snuffy2)
  • Add validate method #23 (Snuffy2)
  • Add endpoint checks to prevent errors #22 (Snuffy2)
  • Firewall endpoints to GET and don't fail if unavailable #21 (Snuffy2)

Bug Fixes

  • Fix showing docstrings in documentation #29 (Snuffy2)

Documentation

  • Clarify opts documentation #30 (Snuffy2)
  • Introduce GitHub Actions changelog workflow and reorganize docs #28 (Snuffy2)
  • Add documentation #27 (Snuffy2)

Code Quality

v1.0.5 (2026-04-03)

Full Changelog

Enhancements

  • In OPNsenseClient, change from initial to throw_errors #19 (Snuffy2)

v1.0.4 (2026-03-29)

Full Changelog

Enhancements

  • Add CARP status summary and improve VIP interface matching #16 (Snuffy2)

Bug Fixes

Maintenance

v1.0.3 (2026-03-26)

Full Changelog

Bug Fixes

  • Handle 26.1.5+ changes in dnsmasq leases API #14 (Snuffy2)

Code Quality

v1.0.2 (2026-03-23)

Full Changelog

Enhancements

Code Quality

v1.0.1 (2026-03-23)

Full Changelog

Documentation

v1.0.0 (2026-03-22)

Full Changelog

v0.0.3 (2026-03-22)

Full Changelog

Enhancements

  • Improve pytest coverage and Refactor test infrastructure with reusable HTTP response mocking #8 (Snuffy2)

Bug Fixes

  • Fix some endpoints from POST to GET #6 (Snuffy2)
  • Fix GitHub release Workflow #4 (Snuffy2)

Documentation

  • Standardize docstring formatting across codebase #7 (Snuffy2)

Other Changes

v0.0.2 (2026-03-22)

Full Changelog

Other Changes

  • Update version in const.py on release #3 (Snuffy2)

v0.0.1 (2026-03-22)

Full Changelog

Other Changes

* This Changelog was automatically generated by github_changelog_generator

Metadata

Release files for aiopnsense 1.6.1

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

Source distribution (sdist)

Source distribution for aiopnsense 1.6.1
File Size Uploaded Provenance Actions
aiopnsense-1.6.1.tar.gz 340.5 kB With provenance Details for aiopnsense-1.6.1.tar.gz

Built distribution (wheel)

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

Total release size: 488.0 kB

Release files / aiopnsense-1.6.1.tar.gz

Download URL aiopnsense-1.6.1.tar.gz
Size 340.5 kB
Tags Source
SHA-256 checksum
How to use checksums
065d489f3f8a60657f34e9b64dedf53af7a202c5b28a59f9135449db75693a14
BLAKE2b-256 checksum
How to use checksums
1112f667887bbe05aecfa89fbb4230f129db8f989d85a2fceeafe4afbc8a6436
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 Nov 27, 2026.

Transparency log

Release files / aiopnsense-1.6.1-py3-none-any.whl

Download URL aiopnsense-1.6.1-py3-none-any.whl
Size 147.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f5c68f3433b2fa2bb1fb4b15ec3055b3c885cd45ab281b6bd7bef1180dbe6b9
BLAKE2b-256 checksum
How to use checksums
4d6e9b6fae141f18e07de32ad996bea69139db3ceb1d2399c44118ba08442d61
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 Nov 27, 2026.

Transparency log

Security for aiopnsense 1.6.1

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 aiopnsense-1.6.1.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 Nov 27, 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.

Release history Release notifications | RSS feed

This release

1.6.1 This release

2 release files Full provenance

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