Coerce list-valued printer-firmware-string-version to a string#726
Open
arcivanov wants to merge 1 commit into
Open
Coerce list-valued printer-firmware-string-version to a string#726arcivanov wants to merge 1 commit into
arcivanov wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Some printers (e.g. Lexmark MC2425adw, Brother MFC-L2710DN) report
printer-firmware-string-versionas multiple values (IPP1setOf), which the parser returns as a list.Info.versionis annotatedstr | None, so consumers receive an unexpectedlistat runtime.This surfaces in Home Assistant as a deprecation warning (soon an error in HA 2026.12) because the value is passed as
sw_versionto the device registry, which requires a string:Info.versionis typed asstr | Nonebut returns alistat runtime #725Change
Join list values into a single comma-separated string in
Info.from_dict, soInfo.versionalways matches itsstr | Noneannotation. 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.