Deploy a modified binding

I modified a binding from the repository for my own use, tested it in the Eclipse IDE but am now stuck as to how I can get it to show up in my openhab2 2.3.0-SNAPSHOT environment. I exported the binding to a jar file and added it to the /addons directory. After running Karaf and paperui, I don’t see my binding. What steps am I missing? Thanks.

What do you mean when you say exported? Did you build the .jar with maven and copy it from org.openhab.binding.xxxxx/target folder to addons?

From Eclipse I exported to a java/jar file and put that into the addons directory.

I’m not sure if eclipse supports this kind of building. I suggest you to install maven and do ‘mvn clean install’ from command line. Aside from building the .jar it has multiple automated tools to verify the binding.

Did you get this to work?

It did. I was able to do it in eclipse but I uninstalled and reinstalled eclipse before I got it to work. I must have messed something up with the IDE on my first install. I put the jar file in the addons folder and it worked.

1 Like

hello were you able to figure out how/where to edit bindings? I need to modify the mqtt binding to suit my needs but i cant find the source files

I did but my method is likely the inefficient method since I am not familiar with Eclipse and using repositories. If you install Eclipse and the openhab library, you should have all the source code on your computer from the add-ons. I used the bat file to create a new blank binding and copy and pasted the necessary code and modified it for my own use. I’m sure there is an easier method to copy a binding and renaming it before modifying.

ahhh gotcha…but it would also be possible to use rules/transformation right? I was thinking about modifying the binding to convert some encrypted info to plain text so i thought I would add the decrypting function in the binding code…but rules/transformation seems like a better idea right?

That’s hard to know since each situation is different. If you have some programming experience and there’s a decent number of changes, I tend to prefer modifying the binding since you always have it if you want to make changes in the future. It’s not as difficult as it might sound since they provide the batch file to create the shell and it’s just copying code over, modifying it for your own use, and then export the jar file.

If you really just need a tweak or two than can be done with rules/transformations then that’s much less of a headache. It’s could be the difference between 10-15 mins of work vs. 2 hours.