Skip to content

prusalink: populate serial number and firmware version in device info#169309

Merged
edenhaus merged 1 commit into
home-assistant:devfrom
heikkih:feat/prusalink-device-info
Apr 29, 2026
Merged

prusalink: populate serial number and firmware version in device info#169309
edenhaus merged 1 commit into
home-assistant:devfrom
heikkih:feat/prusalink-device-info

Conversation

@heikkih
Copy link
Copy Markdown
Contributor

@heikkih heikkih commented Apr 27, 2026

Proposed change

Exposes two additional fields in the PrusaLink device registry entry:

  • serial_number — sourced from /api/v1/info (serial field), already fetched by InfoUpdateCoordinator
  • sw_version — sourced from /api/version (firmware field), fetched by a new lightweight VersionUpdateCoordinator

Both API endpoints are available in the currently published pyprusalink==2.1.1 and require no library update. This is part of a series of incremental improvements to the prusalink integration.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (non-breaking change which fixes an issue)
  • Code quality improvements to existing code or addition of tests

Additional information

  • The VersionUpdateCoordinator polls on the same 30-second interval as existing coordinators. Firmware version rarely changes but polling is consistent with the existing pattern.
  • No entities depend on VersionUpdateCoordinator for state — it is used solely for device_info.
  • The mock_version_api test fixture was updated to include the firmware field which was previously absent.

Checklist

  • The code change is tested and works locally
  • Local tests pass with python -m pytest tests/components/prusalink/
  • There is no commented out code in this PR

Expose `serial_number` (from /api/v1/info) and `sw_version` (from
/api/version firmware field) in device_info so HA can populate the
device registry with those fields. Adds a VersionUpdateCoordinator
to fetch version data on the same 30-second cycle as other coordinators.

Both endpoints are already available in the currently published
pyprusalink 2.1.1. This is part of a series of improvements to both
pyprusalink and the prusalink HA integration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the Home Assistant prusalink integration’s device registry entry by populating the printer’s serial number and firmware version, improving device identification in the registry/UI.

Changes:

  • Add a new VersionUpdateCoordinator to fetch /api/version and expose firmware version as sw_version.
  • Extend PrusaLinkEntity.device_info to include serial_number (from /api/v1/info) and sw_version (from /api/version).
  • Add/adjust tests to verify the device registry entry includes these fields and extend the mocked version API response.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
homeassistant/components/prusalink/__init__.py Registers and first-refreshes the new version coordinator during config entry setup.
homeassistant/components/prusalink/coordinator.py Adds VersionUpdateCoordinator and updates coordinator typing to include VersionInfo.
homeassistant/components/prusalink/entity.py Populates DeviceInfo.serial_number and DeviceInfo.sw_version from coordinator data.
tests/components/prusalink/conftest.py Updates the mocked /api/version response to include firmware.
tests/components/prusalink/test_init.py Adds a test asserting serial number and firmware version are stored in the device registry.

Comment thread homeassistant/components/prusalink/coordinator.py
Comment thread homeassistant/components/prusalink/__init__.py
Copy link
Copy Markdown
Member

@edenhaus edenhaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @heikkih 👍

@edenhaus edenhaus merged commit d8b1bfb into home-assistant:dev Apr 29, 2026
36 of 37 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 30, 2026
@heikkih heikkih deleted the feat/prusalink-device-info branch May 13, 2026 10:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants