System
- async OPNsenseClient.toggle_interface(if_name, toggle_on_off=None)
Toggle an interface’s enabled state and apply the resulting configuration.
Requires firmware >= 26.7.6 and sends only the enable flag. Refuses pending or unreadable interface work; coordinate concurrent changes. Failure or cancellation can leave pending work: resolve it in the OPNsense UI before retrying. Applying changes can reset queued interfaces’ advanced/file-based DHCP settings or disconnect this client.
- Parameters:
- Returns:
- True when already matching, or when the Router
acknowledged the save (
saved) and confirmed the apply; False when refused, the save was not acknowledged (no apply is sent) or the apply was not confirmed. A suppressed exception returns None. Withthrow_errorsenabled, invalid arguments raiseOPNsenseInvalidArgumentand transport failures raiseOPNsenseErrorsubclasses.
- Return type:
bool | None
- async OPNsenseClient.get_device_unique_id(expected_id=None)
Return the stable device identifier derived from physical MAC addresses.
- Parameters:
expected_id (str | None, optional) – Previously known identifier to prefer when it is still present among physical interface MAC addresses.
- Returns:
- MAC-address-based identifier with colons replaced by
underscores. Returns
expected_idwhen it still matches a physical interface, otherwise the first sorted physical MAC identifier. ReturnsNonewhen no physical MAC addresses are available andthrow_errorsis disabled.
- Return type:
str | None
- async OPNsenseClient.get_system_info()
Return basic OPNsense system identity information.
- async OPNsenseClient.get_carp()
Fetch one CARP snapshot and return both interfaces and aggregate summary.
- Returns:
- Snapshot payload containing
interfacesand status_summaryderived from one backend fetch, reporting its access level throughresult_access(). The VIP inventory comes from the VIP status endpoint at both levels. A forbidden (403) VIP settings endpoint, including a cached 403, reports Status Access and omits the settings enrichment of each VIP (fields such asdescrandsubnet_bitsthat the status rows lack). Settings data, a known missing (404) settings endpoint or a transient settings failure reports Configuration Access, the last two with status-only VIP data. ReturnsNonein either error mode when the VIP statusrowsare missing or malformed, because the VIP inventory is then unknown. With the defaultthrow_errors=False, also returnsNonewhen the VIP status endpoint is unavailable. Whenself._throw_errorsisTrue, a failed status or settings request raisesOPNsenseErrorinstead, status first, specificallyOPNsensePrivilegeMissingfor a forbidden (403) endpoint; a known missing (404) settings endpoint still reports Configuration Access.
- Snapshot payload containing
- Return type:
- async OPNsenseClient.system_reboot()
Reboot OPNsense.
- Returns:
True when the operation succeeds; otherwise, False.
- Return type:
- async OPNsenseClient.system_halt()
Shutdown OPNsense.
- Return type:
None
- async OPNsenseClient.toggle_carp_maintenance_mode()
Toggle persistent CARP maintenance mode.
- Returns:
True when the operation succeeds; otherwise, False.
- Return type:
- async OPNsenseClient.send_wol(interface, mac)
Send a wake on lan packet to the specified MAC address.
- async OPNsenseClient.get_notices()
Return active OPNsense dashboard notices.
- async OPNsenseClient.close_notice(id)
Close selected notices.
- async OPNsenseClient.reload_interface(if_name)
Reload the specified interface.