This is my first time contributing to an open-source project, and I’m a bit confused about how to get started. I would greatly appreciate any tips or advice from the community.
I’m not sure whether I should create a fork and work on that or if there’s another approach. I thought I could open a Pull Request (PR) and work on it, but I’m not entirely certain if that’s the correct way to go about it.
My goal is to create a new binding for OpenHAB. I’ve already done some coding, but it’s still a work in progress (WIP). I’m eager to learn the best practices and contribute effectively to the project.
Thank you in advance for any guidance you can provide. I’m looking forward to becoming an active contributor to the OpenHAB community!
Yes create your fork (you already did this) and start from the main branch by creating a branch for you binding (the new binding documentation I linked above to, describes this).
When you’re completed your binding then you can create a pull request and it will be reviewed for inclusion. You could also add your binding under the marketplace topic to allow others to install your binding.
Some specific comments. Currently openHAB 4.0 is in development. Because there are some breaking changes 4.0 build bindings won’t run on 3.4. But there are ways to build a 4.0 binding to be compatible with 3.4. See Migrating addons to v4.0 - list of necessary changes available? - #6 by hilbrand
You could start from the 3.4 branch if you want to develop specific for 3.4. However if you want your binding to be included in openHAB you need to develop for 4.0. Therefor it’s recommend to start your development from the main (i.e. 4.0) branch.
This is all very brief information. The best way to start is read the documentation, look at other bindings (for example look at merged pull request. There is a lot of knowledge on how things work) or search/ask on the forum here.
I’m roughly in the same position as you with openhab (new to the code, I’m playing with amending denonmarantz binding), but I have “some” experience contributing to other open source projects. First get the dictionary: pull requests are made when you made your code, tested it, discussed, uploaded to your repository and the last step is a pull request. The PR is essentially a message to the openhab developers saying: “i did something that might be useful, please review and include in the master code”.
clone the code you want to work on (openhab, openhab-addons)
learn to compile, deploy and test it. No changes in the code at this step. It’s called “vanilla” code sometimes
Make your modifications to the code, compile, deploy locally, test
Review your modifications, get familiar with project guidelines for coding, splitting commits, etc
Push your code to a new branch in your repository. It needs to be a location that openhab developers accept for pull requests. Most likely it will be a fork of the original openhab/openhab-addons repository
Send the pull request. Be ready to improve your code in line with comments received form the developers.
There are other forms of contributing code (via emailed patches), but I’m not sure if openhab allows it.
Thank you @PrzemoF and @hilbrand, for your helpful and detailed responses. I appreciate the time and effort you put into explaining the process and providing guidance for getting started with contributing to OpenHAB. Your advice has given me a clearer understanding of what I need to do, and I’m excited to begin my journey as an OpenHAB contributor.