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?
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 . Nothing to do here.
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"
when
System started
then
[...]
Thread::sleep(30000)
executeCommandLine("/etc/openhab2/marketbindings.sh")
end
Contents of /etc/openhab2/marketbindings.sh:
curl -X POST -H "Content-Type: text/plain" --data "id=market:binding-3670618" http://192.168.1.253:8080/rest/extensions/market:binding-3670618/install
curl -X POST -H "Content-Type: text/plain" --data "id=market:binding-3499123" http://192.168.1.253:8080/rest/extensions/market:binding-3499123/install
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.
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.
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:
#!/bin/bash
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 ];
then
curl -X POST -H "Content-Type: text/plain" --data "id=$extension" http://$ip:$port/rest/extensions/$extension/install
fi
s=${s#*"${BASH_REMATCH[1]}"}
done
}
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.
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)