[developpement] how to try modified bindings on real hardware ? (not within eclipse)

Tags: #<Tag:0x00007f6170437168> #<Tag:0x00007f6170437028> #<Tag:0x00007f6170436f60>

Hi,

I have tried to add functionalities to a binding (caldav), and from my point of view it works, I have tested it under the eclipse IDE.

however, I would like to try my modifications in the real world, that is to say on my raspberry pi running my openhab 2 (because after all, I would like to use this functionnalities) .

BUT. I could not manage to have my modifications to work for now on my OH2 setup :

  • I have replaced the JARs under the folderS “userdata\tmp\mvn\org\openhab\io\org.openhab.io.caldav\1.9.0.b4” and “userdata\tmp\mvn\org\openhab\binding\org.openhab.binding.caldav-*\1.9.0.b4”

  • generated the sha1 files

  • restarted OH2

but it is as I had done nothing. it works as before.

could someone tell me how to test my jars the right way please (or use them until my change is eventually pulled ) ?

It must have something to do with openhab’s cache I suppose … this is frustrating ! (And it seems that mvn install does not generate a zip or tar.gz, so I realy dont know how to generate a build :frowning: )

First uninstall your binding (feature) through Paper UI or console, then stop OH then put your jar into addons directory and finally restart OH.

thanks I’ll try that. via karaf shell since I did modify openhab-io-caldav that does not appear under paper-ui bindings. I’ll report on my success or failure :wink:

well,

it was half a failure because :

  • what caused me some trouble is that the features (caldav command and personal) were still in addons.cfg => they were reinstalled at restart, which caused my modifications to stop working (duplicate functionality with jars in plugins directory, I suppose)

  • it turns out that 2.0.0b4 was an online version, and it did break all by itself because of habpanel was somehow moved in the online repositories, so nothing was working anymore, even features uninstall => I had to fully reinstall (doooo ! 2.0.0.b4 broken !)

  • and finally, I did some modifications to caldav-io, which is not a binding so it was (I think) always reinstalling (from the net) and not using my version in the plugins folder nor in the mvn cache (that I had replaced).

SO. What I did is :

  • install an OFFLINE distro
  • not start it at first
  • remove caldav-command and caldav-personal from addons.cfg
  • replace the caldav jars in the following directories :
  • /opt/openhab2/runtime/system/org/openhab/io/org.openhab.io.caldav
  • (just in case ) /opt/openhab2/runtime/system/org/openhab/binding/org.openhab.binding.caldav-personal
  • (just in case) /opt/openhab2/runtime/system/org/openhab/binding/org.openhab.binding.caldav-command
  • place caldav-command and caldav-personal jars in pluggins directory
  • start

however, I don’t know if caldav-io gets “cached”, so I don’t know if a do a new modification, if simply replacing the jar in the above directory will work or not. If not, I suppose that a “feature:uninstall openhab-io-caldav” followed by a “feature install” would do the trick (?)

I think that’s correct, you can also update the bundle by pointing it to the file specifically:

bundle:update [ID] file://[path of Jar] 
1 Like

Hi thanks ben, you are right, this did the trick for the required package caldav.io :

bundle:update 215 file:///opt/openhab2/org.openhab.io.caldav-1.9.0-SNAPSHOT.jar

By the way, if anyone is interested, I put it here 'cause I struggled to find how to set a log to debug / trace or whatever when running openhab under eclipse (so for me see what log.trace was outputting) :

simply modify the file ./git/openhab-distro/launch/home/logback_debug.xml (eclipse tree : infrastructure/launch/…etc) ; and add some log directives. For me :

<logger name="org.openhab.io.caldav.internal.job.EventReloaderJob" level="TRACE" />
<logger name="org.openhab.io.caldav.internal.CalDavLoaderImpl" level="TRACE" />
1 Like