Skip to content

Coerce list-valued printer-firmware-string-version to a string#726

Open
arcivanov wants to merge 1 commit into
ctalkington:masterfrom
arcivanov:fix-version-list
Open

Coerce list-valued printer-firmware-string-version to a string#726
arcivanov wants to merge 1 commit into
ctalkington:masterfrom
arcivanov:fix-version-list

Conversation

@arcivanov

Copy link
Copy Markdown

Problem

Some printers (e.g. Lexmark MC2425adw, Brother MFC-L2710DN) report printer-firmware-string-version as multiple values (IPP 1setOf), which the parser returns as a list. Info.version is annotated str | None, so consumers receive an unexpected list at runtime.

This surfaces in Home Assistant as a deprecation warning (soon an error in HA 2026.12) because the value is passed as sw_version to the device registry, which requires a string:

Change

Join list values into a single comma-separated string in Info.from_dict, so Info.version always matches its str | None annotation. A single Lexmark printer reports e.g. ["2.0", "1.02", "1.7", "1.5", "CXNZJ.250.038"], which now becomes "2.0, 1.02, 1.7, 1.5, CXNZJ.250.038" instead of dropping information.

Includes a regression test.

Some printers (e.g. Lexmark MC2425adw, Brother MFC-L2710DN) report
printer-firmware-string-version as multiple values, which the parser
returns as a list. Info.version is typed str | None, so consumers such
as Home Assistant received an unexpected list. Join list values into a
single comma-separated string.

Fixes ctalkington#725
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Class attribute Info.version is typed as str | None but returns a list at runtime

1 participant