Firmware

static OPNsenseClient.get_firmware_requirements()

Return the Minimum Firmware and Recommended Firmware that aiopnsense supports.

This reads library constants and never contacts a Router. It can be called on the class, such as OPNsenseClient.get_firmware_requirements(), before any client exists, for example from a config flow.

Returns:

Minimum Firmware and Recommended Firmware versions.

Return type:

FirmwareRequirements

async OPNsenseClient.get_host_firmware_version()

Return the cached OPNsense firmware version.

Returns:

Installed firmware version, falling back to the product

series for non-SemVer version strings, or None when the firmware status endpoint is unavailable.

Return type:

None | str

async OPNsenseClient.get_firmware_update_info(*, check_for_updates=True)

Return firmware status and trigger a refresh when cached data is stale.

One client requests at most one acknowledged automatic check per hour, even when the status still needs a refresh. Dispatching a firmware update or upgrade, through install_firmware or the deprecated upgrade_firmware, ends the cooldown so the next call can refresh the installed state.

OPNsense removes the build number from product_latest. When an opnsense-devel update is available, product_latest is replaced with that package’s new version so callers receive the exact build.

Parameters:

check_for_updates (bool) – Allow automatic refresh checks when idle. Disable for strictly read-only firmware status requests.

Returns:

Firmware status payload from OPNsense,

including product version, latest version, check status, and update metadata when available. Returns an empty mapping when the firmware status endpoint is unavailable.

Return type:

MutableMapping[str, Any]

async OPNsenseClient.install_firmware(type='update', *, target_version, timeout=1800, poll_interval=5)

Install firmware and verify completion, including server-managed reboot.

The action is dispatched exactly once. Transport ambiguity never causes a retry. A new action log, terminal state, idle server and installed target version must agree before this method returns. Rebooting updates additionally require an observed outage followed by reconnection. Dispatch ends the automatic check cooldown, whatever the outcome.

Parameters:
  • type (str) – update for a minor update or upgrade for a major one.

  • target_version (str) – Expected firmware version (including hotfix revision). A beta target must include its build number.

  • timeout (float) – Overall deadline in seconds, including waiting for idle.

  • poll_interval (float) – Delay in seconds between status observations.

Raises:
  • OPNsenseInvalidArgument – Invalid action, target or timing argument.

  • OPNsenseError – Concurrent install, rejected dispatch, failed/unconfirmed update, or deadline exceeded. Errors propagate regardless of throw_errors. Cancellation releases local state and never cancels or reboots the server’s firmware process.

Return type:

None

async OPNsenseClient.upgrade_firmware(type='update')

Deprecated

Use install_firmware(target_version=…) to install firmware and verify completion.

Trigger a firmware upgrade without waiting for installation to complete.

Deprecated: use install_firmware(target_version=...) to install firmware and verify completion.

Parameters:

type (str) – Firmware action to trigger. update applies minor updates on the current series, while upgrade starts a major series upgrade.

Returns:

Firmware action response for

supported action types, or None when type is not update or upgrade.

Return type:

MutableMapping[str, Any] | None

Raises:

OPNsenseError – A firmware installation is already active when _throw_errors is enabled.

async OPNsenseClient.upgrade_status()

Return the status of the active firmware upgrade.

Returns:

Upgrade status payload, or an empty

mapping when the upgrade-status endpoint is unavailable.

Return type:

MutableMapping[str, Any]

async OPNsenseClient.firmware_changelog(version)

Return the changelog for the firmware upgrade.

Parameters:

version (str) – Firmware version whose changelog should be fetched.

Returns:

Changelog response for the requested

firmware version.

Return type:

MutableMapping[str, Any]

class OPNsenseClient.FirmwareRequirements(minimum, recommended)

OPNsense firmware releases that aiopnsense supports.

Parameters:
  • minimum (str)

  • recommended (str)

minimum

Minimum Firmware. Routers running an older release are rejected by OPNsenseClient.validate.

Type:

str

recommended

Recommended Firmware. Routers running an older release are accepted, but some features return empty or missing data.

Type:

str