Trying/Debugging addons while developing

Hi there,
as some of you might know from my other thread, I am developing an addon at the moment. However, I wonder how I can test it. If I launch OpenHAB from the IDE as described here, OpenHAB will only be populated with example gibberish addons. How can I actually run my addon in order to debug it?

The very last paragraph on the link you gave is what you need to do. You need to tick your binding in a list so it is started with the runtime. Otherwise the runtime starts and your binding is not able to be found. It is as easy as ticking the right box.

Right click on openHAB_Runtime.launch > Run as > Run configurations … Go to the Plug-ins tab. Notice that under “Target Platform” org.eclipse.smarthome.binding.yahooweather is checked. But, under Workspace the same org.eclipse.smarthome.binding.yahooweather is not checked. Do so now. Try the debug session again. You should now see the modified code show up in the debugger.

There is also a video that kai made on YouTube that shows it as well. The video moves quick so pause and rewind is helpful.

Thank you and sorry for not being able to read the docs properly :blush:

I am probably just being incredibly stupid again but now I activated my persistence add-on, and I can choose it as the default persistence under configuration/system in the paper UI, however, the store method of my addon never gets called. I guess that is due to the fact that I didn’t configure any persistence strategies, however, I cannot find out how to do so. Where is the $OPENHAB_CONF folder they are talking about here? I found locations for it here, but those only seem applicable when you install openhab. Where can I put the configuration for my service when running it from inside eclipse?

Thank you for being patient with me :slight_smile:

I think it should be in the folder /distribution/smarthome/conf

Thank you! It seems I was looking in the wrong repository. The config folder you named is in the smarthome repo, I did not look there :blush:

Would this also be the correct folder to configure the service? I tried it for the mqtt addon, created a folder services inside the conf directory and put a file called mqtt-persistence.cfg (like mentioned here) in which I defined a broker (with just some dummy string), however, when the activate method is called, it doesn’t seem to find any info on the broker. Is there some other place where I need to configure the services?

Hmm I created the .persist files as described in the documentation of the mqtt plugin. I created a strategy to persist all items on every change, but the store method is still never called, even though I can see ItemStateChanged events in the console.