-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
Add prusalink legacy api support (MK3s+) #102014
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Hey there @balloob, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
@rastislavpapp the PR is still marked as draft, is there any work remaining? can I help somehow? |
sorry, I did not realize it was in draft state :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the big problem in this PR should be solved in the library itself. We usually only do wrappers when its a library we have a hard time updating or that needs just a bit extra. In this case, the pyprusalink lib is located in a organisation which holds some libraries used by HA and there seem to be some open PRs that look like they are adding v1 support. (https://github.com/home-assistant-libs/pyprusalink/pulls).
I would prefer that we keep the device specific connections in the library and then if there are any API changes, update the lib and changes in HA.
async def get_large_thumbnail(self, path: str) -> bytes: | ||
if self.is_legacy: | ||
"""Get a large thumbnail.""" | ||
async with self.api.request("GET", f"api/thumbnails{path}.orig.png") as response: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs in the 3rd party library.
Closing this PR since it's not the correct approach per above comments. |
Proposed change
I've tried setting up Prusalink integration with the most popular MK3S+ printer, and was suprised it only works with Prusa Mini or MK4. I have no knowledge of python, but I've tried to fix this anyway, as it was bothering me.
I've looked at the API calls which the integration makes, and tried the same calls against my 0.7.0 prusalink, and everything except thumbnails (which I've fixed) seemed to work as-is. So I basically just deleted the condition that your prusalink should be of version 2.0.0+.
I've tried to run the tests, but I was not able to get some of them to work (even without my changes), neither on Windows, nor WSL2 (Ubuntu). The ones that worked before my changes still work after them :-)
Type of change
Additional information
Checklist
black --fast 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
..coveragerc
.To help with the load of incoming pull requests: