Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make IPP protocol version configurable #128997

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

LorbusChris
Copy link

@LorbusChris LorbusChris commented Oct 22, 2024

Proposed change

ipp: Make IPP protocol version configurable
Adds a checkbox to optionally configure a printer with legacy IPP v1.1 instead of the default v2.0.

Fixes: #93211

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @ctalkington, mind taking a look at this pull request as it has been labeled with an integration (ipp) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of ipp can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign ipp Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@LorbusChris
Copy link
Author

This is a simple rebase of the closed and locked #115661
I'll fix up remaining linting issues as they are reported here.

@emontnemery requested to change the checkbox to a drop-down menu over in #115661 (comment). However, I disagree with that as this is a simple binary choice and I'd like to keep this change simple. This does obviously not preclude anyone from introducing such a change later.

@LorbusChris
Copy link
Author

LorbusChris commented Oct 22, 2024

The linter config seems broken:

$ ruff format homeassistant tests
ruff failed
  Cause: Failed to parse /var/home/lorbus/code/hass-core/pyproject.toml
  Cause: TOML parse error at line 693, column 1
    |
693 | [tool.ruff.lint]
    | ^^^^^^^^^^^^^^^^
Unknown rule selector: `ASYNC220`

Edit: nevermind, looks like I had an outdated version of ruff installed

@LorbusChris LorbusChris force-pushed the ipp_legacy branch 3 times, most recently from 6fe8880 to bce57ac Compare October 29, 2024 17:19
@LorbusChris
Copy link
Author

This is ready for review. Could someone please start the CI pipeline?

@ctalkington could you approve this?

@LorbusChris

This comment was marked as off-topic.

@emontnemery
Copy link
Contributor

emontnemery commented Nov 27, 2024

@LorbusChris Please change to a select selector which allows picking version 1.1 or 2.0 instead of a checkbox as requested in #115661

Here's an example of how to do that:

data_schema=vol.Schema(
{
vol.Required(CONF_ID): SelectSelector(
SelectSelectorConfig(
options=[
SelectOptionDict(value=k, label=v)
for k, v in options.items()
],
mode=SelectSelectorMode.DROPDOWN,
)
),
}
),

Note that the selections can be translated too, but I guess that's not needed in this case

"selector": {
"type": {
"options": {
"last": "Most recently updated",
"max": "Maximum",
"mean": "Arithmetic mean",
"median": "Median",
"min": "Minimum",
"product": "Product",
"range": "Statistical range",
"stdev": "Standard deviation",
"sum": "Sum"
}
}
},

@emontnemery emontnemery marked this pull request as draft November 27, 2024 14:24
@emontnemery
Copy link
Contributor

@LorbusChris Please click the "Ready for review" button when you've updated

@LorbusChris
Copy link
Author

LorbusChris commented Nov 27, 2024

@emontnemery see #128997 (comment)

Again, this is a binary choice and a dropdown menu for it complicates things unnecessarily.
I do not intend to make that change. If this change is unacceptable as-is, feel free to close this PR.

@LorbusChris LorbusChris marked this pull request as ready for review November 27, 2024 21:21
Adds a checkbox to optionally configure a printer with legacy IPP v1.1
instead of the default v2.0.

Fixes: home-assistant#93211
@ctalkington
Copy link
Contributor

I'm aware of this PR and know there's been a bit of back and forth. I will do my best to review/approve before the end of the year.

@joostlek
Copy link
Member

Is it possible to autodetect by connecting with v2, and if that fails go back to v1?

@ctalkington
Copy link
Contributor

Is it possible to autodetect by connecting with v2, and if that fails go back to v1?

thats an idea for manual additions (zeroconf should mean it supports IPP 2.0 per spec) and possibly set a flag on the client for that "session". I might be able to do that upstream with a new parameters that catches first version exception and tries 1.0

Copy link

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes.
Thank you for your contribution!

@github-actions github-actions bot added the stale label Feb 20, 2025
@MartinHjelmare MartinHjelmare changed the title ipp: Make IPP protocol version configurable Make IPP protocol version configurable Feb 22, 2025
@github-actions github-actions bot removed the stale label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IPP version incompatibility
5 participants