Configure OH3 binding from .cfg file?

Most OH2/OH3 bindings don’t have their own configuration, but a few still do. IIRC, one could configure the binding with a text file, like services/shelly.cfg could contain the default user name and password. This doesn’t seem to be working for me in my OH 3.2 instance, so my question is, in OH 3.2 or 3.3, can one install a binding from the services/addons.cfg file but not configure it from a text file as well as was previously possible? I can find no documentation that answers the question. My interest is that textual configuration is easier for me to track and maintain.

Instead of

you mean something like

things/shelly.things

?

Afaik services/<binding>.cfg files were exclusive to openHAB1 bindings under openHAB2. I’m not aware of any openHAB2 binding which used a config-file, as those were configured via Things.

Yes.

I wouldn’t think so.
Binding configuration via *.cfg was a v1 feature that you were able to use in v2 using compatibility layer, but that layer was removed in v3 so now you cannot any more.
The only exception AFAIK is persistence and overall settings.
addons.cfg has some of those: it just defines which bindings to deploy,
so the answer to your question is ‘yes’.
But this is not how each of those bindings will be configured.
That you’ll have to do on things level, either through UI or through .things files.

Setting the binding properties should still be possible via the cfg files. There was a change since 3.2 with this binding (pr 11022, but it looks like that just removed something that is the same as the default). Did your configuration work with 3.1? or an older version?

No; this attempt is new, to use services/shelly.cfg with the contents

defaultUserId=someid
defaultPassword=somepassword

Perhaps I’ve done something wrong and the binding is actually picking up my file contents. I will have to figure out other ways to look.

Since there might be confusion about whether services/<yourbinding>.cfg files can be used for those few bindings that have their own configuration (not Thing configuration), which documentation should be reviewed and possibly updated with the real answer?

@mstormi I could have worded my question more precisely to avoid any misunderstandings. Let me try again, “for those bindings in openHAB 3.2 that have their own binding configuration (not referring to Thing configuration but binding configuration), has the ability to provide binding configuration in a .cfg file, as was once possible in earlier openHAB versions, since been removed, so that one could specify the installation of a binding in the services/addons.cfg file, and yet not be able to also configure the binding from a .cfg text file?” The reply from @hilbrand thankfully says it’s still possible, so I remain in hope that I’ve merely done something wrong in detecting that it worked.

Thanks for all your replies.

John

I did some additional testing. It seems the filename needs to be: binding.shelly.cfg This isn’t clear from any documentation and also missing for other bindings.

1 Like

Thank you so much for looking into that mystery. The file rename worked for me. It would be wonderful to see this added to the documentation for other text-based-configuration users. Very much appreciated, @hilbrand.

Apparently looking a bit further the more common configuration seems to be that any name can be used for the file. So shelly.cfg can be used as long as the parameters are correctly prefixed. In this case that would be:

binding.shelly:defaultUserId=someid
binding.shelly:defaultPassword=somepassword
2 Likes

You’re never done learning. I’ve always been suspecting that since some comment of Kai that you can actually use any filename in $OH_DATA/etc/ but I wasn’t sure how the filename/module hierarchy (here: binding.shelly) would then need to look like inside the file and never went the extra mile to systematically test it out. Thanks a lot Hilbrand!

Would you do us a final favor and add that to the official docs ?
(not sure exactly where, maybe @Confectrician has a suggestion).

Sorry for the delay. I was on vacation.

So we have Services | openHAB which has no content at all yet.
Tough i am not sure if services fits it 100%, but from the inital post the config files are located in the services folder.

Mabe we could introduce some doc at all over there and place some explanations with a link in the configuration overview.

We have also something in place for the installation of addons via .cfg file, which we then also could cross-link over there.