Addon.cfg load market binding?

Anyone know if/how to auto load a market binding in the addons.cfg file?

Ex: market:binding-3338717 - 1.0

binding = ??

I’m not sure it can be. But if it can, it will be some version of the ID you see in PaperUI for the binding.


ok ill try that and report back

None of these are working:

market = binding-3328323
market = 3472338
market:binding = 3472338

openHAB 2.2.0~20171008013406-1 (Build #1058)

misc-market is installed and working, of course. I couldn’t find any official word that this is working, except in questions and answers of @p0lar. So does it work or am I just being hoaxed? :smiley:

I would expect it to be listed as any other binding on the binding line of addons.cfg, if it works at all. I don’t know if it does work or not. So it would be something like

binding: <all your other bindings>, 3472338

Not that one you use addon.cfg for one binding, you have to use it for all bindings and add-ons.

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.