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

[moonraker] Initial contribution #10330

Closed
wants to merge 1 commit into from

Conversation

arjanmels
Copy link
Contributor

@arjanmels arjanmels commented Mar 14, 2021

New Binding for Klipper/Moonraker controlled 3D Printers

This is the initial contribution for a new binding for 3D printers controlled by Klipper via the Moonraker Web API.

A compiled version can be found at: https://github.com/arjanmels/openhab2-addons/releases/tag/v1.0.0

Forum discussion: https://community.openhab.org/t/klipper-moonraker-binding-for-3d-printer/118958

For more information on Klipper: klipper | Klipper is a 3d-printer firmware (klipper3d.org)
For more information on the Moonraker Web API: Arksine/moonraker: Web API Server for Klipper (github.com)

@arjanmels arjanmels force-pushed the am-feature-moonraker branch from 05e8e64 to fa2db70 Compare March 14, 2021 14:27
@arjanmels arjanmels marked this pull request as ready for review March 14, 2021 14:45
@arjanmels arjanmels requested a review from a team as a code owner March 14, 2021 14:45
@arjanmels arjanmels force-pushed the am-feature-moonraker branch from 3cb6529 to f9655d7 Compare March 14, 2021 15:19
@fwolter fwolter added the new binding If someone has started to work on a binding. For a new binding PR. label Mar 14, 2021
@bobadair
Copy link
Member

Hi. Just FYI - it looks like your PR includes several duplicate files with names that differ only in case (e.g. MoonrakerConfiguration.java and moonrakerConfiguration.java).

@arjanmels
Copy link
Contributor Author

Hmm. I did a rename at some point. Need to see how I can fix this.

@arjanmels arjanmels force-pushed the am-feature-moonraker branch 2 times, most recently from 914f5de to 7b9bc4e Compare March 19, 2021 12:53
@arjanmels
Copy link
Contributor Author

@bobadair Fixed the duplicate file names with different casing by starting applying patch file to current master. (Looses history, but that was not that significant yet anyway.)

Also removed teh dependencies on org.apache.commons.

@Skinah
Copy link
Contributor

Skinah commented Mar 28, 2021

FYI the channels need to be lowerCamelCase, see here:
https://www.openhab.org/docs/developer/guidelines.html#java-coding-style

@arjanmels
Copy link
Contributor Author

@Skinah The channels directly match names as received from the xml. I could built in a translation function (e.g. replace _ with next letter capital). Also I use a double __ in some names to create a virtual level of hierarchy. (To automatically cluster some of the recieved info into one channel group.)

I wonder if adhering to the lowerCamelCase guideline is worth the extra code/complications. Would like your view.

@Skinah
Copy link
Contributor

Skinah commented Apr 2, 2021

I am not doing a review I just wanted to give you something to work on whilst you wait as it can be a while due to a back log. I suspect the answer will be yes to implement a java Map. You can always ask in the forum in the developer section if there are reasons to ignore the rule. I do not know.

@lsiepel
Copy link
Contributor

lsiepel commented Apr 3, 2021

@Skinah The channels directly match names as received from the xml. I could built in a translation function (e.g. replace _ with next letter capital). Also I use a double __ in some names to create a virtual level of hierarchy. (To automatically cluster some of the recieved info into one channel group.)

I wonder if adhering to the lowerCamelCase guideline is worth the extra code/complications. Would like your view.

I haven't looked into your code, but this is a common scenario. Depending on your implementation this might be really simple to fix:
@XStreamAlias("Name_Of_XML_element") private String nameOfProperty;

@fwolter
Copy link
Member

fwolter commented Jul 10, 2021

@arjanmels It's been a long time you submitted your binding. Are you still interested in a review?

The channel names should be preferably camelCase, but there are many bindings, which use underscores. Double underscores should be avoided, though.

@arjanmels
Copy link
Contributor Author

@fwolter I have limited time available at the moment and I see interest for this binding is not very large. So I am hesitant to put the time in or just publish it on the market place (with the disadvantage that a lot of the auto maintenance is not happening).

@fwolter
Copy link
Member

fwolter commented Jul 17, 2021

The fact that nobody responded to your community post doesn't mean there is no interest. The link click counters in your post show a quite contrary picture. You can keep this open and raise your hand as soon as you have more time available to implement any review feedback. I will do a complete review, then. WDYT?

@Skinah
Copy link
Contributor

Skinah commented Jul 18, 2021

I am going to change my Marlin printer over to Klipper as I see it as better, so I am interested in this binding and hope you continue to go through with it since you have already done the bulk of the work.

What advantages or extra features does this way have over using the Octoprint API?

Any lack of questions on the forum probably stem from:

Most people don't have a 3d printer.
Most people that do, use Marlin based firmware on the printers and not Klipper.
Most people that do use Klipper probably already have it working in openHAB via the Octoprint API or by using a MQTT plugin.

@arjanmels
Copy link
Contributor Author

@fwolter Good proposal. Once I have more time I'll look into the double underscores: will require some rewrite as I use it for automatic parsing of properties. Do you have another suggestion for an acceptable symbol to separate parts of a name (which can contain a single underscore themselves)?

Otherwise I might need to revert to tables (which I don't like as any change to the api will require a change to this bniding. On the other hand there are so many exception being handled via switch statements anyway, that forward compatibility is questionable anyway.

@Skinah The more direct access allows more details and also to features like the on/off switch commands.

@fwolter
Copy link
Member

fwolter commented Jul 25, 2021

I won't insist on changing the channel names to camelCase, but please reconsider if you really need an additional separation in channel names for a hierachy. Maybe there's a third solution beside this and using tables?

@Skinah
Copy link
Contributor

Skinah commented Oct 12, 2021

@arjanmels Is this ready to be merged? If you can reply to the last post by fwolter that would let us know if it is ready or if it still needs to wait for changes. Thanks for the contribution.

@arjanmels
Copy link
Contributor Author

@Skinah, @fwolter Let me try to find some time to revisit this and see if I can find a better solution. Also some users report and issue with dependency (https://community.openhab.org/t/klipper-moonraker-binding-for-3d-printer/118958/6).
Will aim to address this weekend.

@jlaur jlaur added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Feb 5, 2022
@arjanmels arjanmels force-pushed the am-feature-moonraker branch from 7b9bc4e to f157337 Compare May 1, 2022 17:32
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating review state since it seems some issues needs to be tackled.

@arjanmels
Copy link
Contributor Author

@jlaur Correct, I am busy with overhaul to address the review feedback. Will let you know once a new review is needed.

@wborn wborn added the awaiting feedback Awaiting feedback from the pull request author label Nov 5, 2022
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

See #11833

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>3.1.0-SNAPSHOT</version>
Copy link
Member

@wborn wborn Dec 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<version>3.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be adapted to the new addon.xml, the PR to adapt the developer docs is not merged yet, so if you need more details, the corresponding issue is here: openhab/openhab-core#2058
But you can also update your branch and look at another binding's addon.xml and adapt it to this initial contribution.

@lsiepel
Copy link
Contributor

lsiepel commented Dec 24, 2023

, I am busy with overhaul to address the review feedback. Will let you know once a new review is needed.

Hi @arjanmels are you planning to proceed with this PR? it has been around here for quite some time now and i'm happy to review or help you out, but if you can't proceed, it might be better to just close this.

@lsiepel lsiepel added the stale As soon as a PR is marked stale, it can be removed 6 months later. label Apr 29, 2024
@lsiepel
Copy link
Contributor

lsiepel commented May 28, 2024

Unfortunately it looks like we cannot bring this PR to the finish line. After two years of inactivity i close this PR. If there is a need to restart, feel free to re-open or start a new PR.

@lsiepel lsiepel closed this May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Awaiting feedback from the pull request author new binding If someone has started to work on a binding. For a new binding PR. stale As soon as a PR is marked stale, it can be removed 6 months later.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants