Handle IPP sw_version returned as list from printer#172543
Conversation
|
Hey there @ctalkington, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
This PR fixes IPP device registration when printers return firmware versions as a list instead of a string, preventing sw_version from receiving an unsupported type.
Changes:
- Normalizes list-valued IPP firmware versions into a comma-separated string before building
DeviceInfo. - Leaves existing scalar firmware version behavior unchanged.
| version = self.coordinator.data.info.version | ||
| if isinstance(version, list): | ||
| version = ", ".join(str(v) for v in version) | ||
|
|
There was a problem hiding this comment.
info.version is typed as str | None in the lib, so I think it's an issue of the lib, that it returns a list here?
There was a problem hiding this comment.
You're right, the lib types version as str | None but returns a list at runtime. That's a library bug. Want me to close this and file upstream on pyipp instead?
There was a problem hiding this comment.
Although that would be a breaking change for the library. That said, I don't know about the data formats of the library and what they represent. In the end, we use the library output in our ways.
There was a problem hiding this comment.
I'll file an issue report to the lib and let's see what is the outcome there.
There was a problem hiding this comment.
joostlek
left a comment
There was a problem hiding this comment.
mypy is failing, can you take a look?
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Proposed change
Some printers return
printer-firmware-string-versionas a list of strings via IPP. The integration passes this directly assw_versionto the device registry, which expects a string.Convert list values to a comma-separated string before passing to the device registry.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: