openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
915 stars 423 forks source link

json addon (smarthome/j echo binding) not being reinstalled after openhab update #4111

Open jimtng opened 7 months ago

jimtng commented 7 months ago

I have a Smarthome/j Amazon echo binding installed using Json 3rd Party Add-on Service. Each time I updated my snapshot build (in docker), this binding keeps disappearing from my openhab installation, and I'd have to re-install it manually.

Is this a bug, or by design? Shouldn't it be reinstalled automatically?

rkoshak commented 7 months ago

Add-ons installed from the marketplace should be reinstalled automatically. However there are some potential cases where maybe it shouldn't.

If the "supported versions" (e.g. [4.0.0.0;4.9.9.9] for the forum based marketplace) of the add-on indicates it doesn't support that version of OH I think maybe it shouldn't be installed. But I don't know that there is any sort of warning right now that tells the end user that the add-on is not supported.

Is it better to install a binding that explicitly indicates it doesn't support that version of OH or to silently not reinstall it on an upgrade? Until we have a mechanism to report this version problem I don't know what the least bad idea should be?

I don't know if that's happening with this specific binding but whatever is done to address this issue needs to take this into account I think.

jimtng commented 7 months ago
rkoshak commented 7 months ago

so this is not caused by version constraints

I wasn't trying to suggest it was. I just wanted to make sure that the version constraints are taken into consideration when this problem gets fixed.

jimtng commented 7 months ago

I suspect, the issue might be caused by my mixing addons.cfg for installing openhab-distributed addons, vs using UI for installing the json based addon. Is there a file-based way of installing json-based addons?

rkoshak commented 7 months ago

That could be. If marketplace add-ons get listed on the same line as the bindings then yes that definitely would be the problem. If they have their own line in addons.cfg then that shouldn't be the problem. Each line is handled independently. For example, you could use addons.cfg for bindings but do UIs and transformations through the UI. But if you use bindings in addons.cfg, you have to use addons.cfg for all bindings.

Is there a file-based way of installing json-based addons?

The answer is yes. The answer to the follow up question "how?" is I have no idea. I know I've seen an example somewhere but I can't find it. All I know is it should be possible.

Looking at my addons.config file I don't actually see marketplace bindings listed at all so I don't have an example in my config handy.

jimtng commented 7 months ago

I haven't had a chance to look into this, but I got around the problem by moving the kar file from userdata/marketplace/**/ into the addons folder. Now the addon no longer disappears each time I update my snapshot.