Addon.cfg load market binding?

Tried it just now with a new update to 2.2.0~20171010154447. Definitely doesn’t work. OpenHAB still searches for <key>-<value> (where key is binding, action, persistence, … and value is zwave, map, …) and probably doesn’t look into the market at all.

That’s nothing new and my last expected behavior. I was just hoping that something had changed in the meantime :smiley:. Nothing to do here.

You figure this out?

No, I assume it’s just not possible, yet.

Installing market bindings automagically doesn’t work (yet) with addons.cfg, so I created the following rule to install them manually after each server start (which I just assume is always preceded by an openhab update):

rule "Systemstart"
	System started

Contents of /etc/openhab2/

curl -X POST -H "Content-Type: text/plain" --data "id=market:binding-3670618"
curl -X POST -H "Content-Type: text/plain" --data "id=market:binding-3499123"

Here I add the eBUS 2.0 Binding and the Openhab Xiaomi Mi IO Binding, but this works with any binding.
Not very beautiful, but working!

Don’t forget to put the binding id in both the link and the submitted data & put in your own server’s IP.

EDIT: previously I posted a solution with installing the bindings directly via executeCommandLine and curl, but according to this would require loads of @@, which don’t look good and are quite confusing,
Another solution would be to use sendHttpPostRequest. The idea stays the same.


This is actually a nice idea. We could change your script to read the addons.cfg and iterate over the market bindings. This way we still have a single location to install bindings.

1 Like

An even nicer idea! Took me a while, since regex in bash is highly non-intuitive (no global capture, no non-greedy matches, no line break matches), but finally got it working using a few hacks:

content=`cat /etc/openhab2/services/addons.cfg`
regex="(market:[^, $]*)"
ip="YOUR IP"
port="YOUR PORT"
install_extensions() { 
    local s=$1 regex=$2 
    while [[ $s =~ $regex ]]; do 
	read extension < <(echo "${BASH_REMATCH[1]}" | grep "market:")		
	read blen < <(echo "$extension" | wc -c)		
	if [ $blen -gt 8 ];
	    curl -X POST -H "Content-Type: text/plain" --data "id=$extension" http://$ip:$port/rest/extensions/$extension/install
install_extensions "$content" "$regex" 

This scans addons.cfg for any extensions beginning with “market:” and installs them. The string length check is not really necessary, this just prevents empty entries like “market:,” from being installed.



That is very good indeed. And what format are you using in the addons.cfg itself, please?

Just add the string as seen in Paper UI next to any other bindings etc.

binding1, binding2, market:binding-1234567, binding3
1 Like

“market:123456” works for me.
“binding-1234567” does not.

This does not work for me, could you explain in detail?

I have the market add-on installed.

binding = binding-123456 does not work unfortunately.

Just use my script, for me it never worked without it.

@_tom I am using your script, but it seems that I need to add the binding as: market:binding-xxxxxxxx

You have to add the bindings exactly as they are shown in PaperUI.

For the Xiaomi Mi IO Binding this is e.g.


@vzorglub can u please share an example what should be exactly written in the cfg file to have auto installation of market binding (not from paperUI)?

I want to install: market:binding-3499123


binding= ???


I should withdraw that post.
I worked once. I don’t know how and has never worked since.

I hope they will support it as now I have to run script for that :frowning:

The script runs well, I use that now

Might be wrong topic - I dont use addon.cfg only PaperUI - would there be a similar approach to install via paperUI binding installs? (even if its not reading a file)

You should install the Eclipse IoT Market addon (Paper UI > Addons > Misc). See here.

I have but i thought bindings still “disappear” on upgrade