Configuration of openHAB

I am not talking about external reference but rather custom classes which do load and merge the other files.
This is fundamental and why this concept works.
!!load_from_file items.yaml is not an external referance but a class that gets constructed with the external filename. It is then used to merge the manually created configuration with the automatically created one.
The class gets serialized to !!load_from_file items.yaml with a custom resolver but actually does contain the file contents because these get loaded in the constructor.

I am fully aware that the files on the disk are always just a serialized copy of in-memory state.
But this is no problem.

Letā€™s play a load and a dump through.

Assumptions

  • openhab does serialize to/from openhab.yml and it contains a gui-configured thing ā€œGuiThingā€
  • a custom thing ā€œManualThingā€ is defined in mything.yml
  • in openhab.yml there is a class registered to load mything.yml
  • there is a file-watcher in place for openhab.yml
  • if there was a dump to openhab.yml the consequent file events will be ignored

Load
Openhab.yml is loaded. Custom class with external files is constructed and loads configuration for ManualThing. Configuration is then merged in memory and contains configuration for ā€œGuiThingā€ and ā€œManualThingā€.

Dump
Since all things/items/etc. have unique names dumping is easy, too.
First, check if changed thing is in the custom class. If yes, donā€™t serialize these changes and show warning message. This step is optional.
Serialize data to openhab.yml.
The external, manual files get serialized to !!load_from_file mything.yml so there is no need to know about file boundaries.

Conclusion
It is possible to create configuration through the GUI, but a manual configuration will always have more priority then a configuration through the GUI. There is only one source of truth. Automatic loading and dumping still works.

1 Like

You suggest to change half of the core. Please go for it, you know where the source code is.

Good - so we agree that this approach is valid and possible.

Tbh I only think this would affect configuration and serialization.
But this is the development section and weā€™re here to discuss concepts. And when introducing new concepts I expect that there are changes to be made.

While these changes may not be ā€œlow hanging fruitsā€ they solve the problem of two truths while providing the possibility to configure through GUI and textual files. And this is the consens how everyone here wants to configure openhab.

1 Like

openHAB is prepared to use different storage providers. That is the easy part to switch to yaml.
But everything after that means a lot of work. Things would need to remember their storage association etc. Because the storage service doesnā€™t know any meta data about the objects its going to serialize.

But as I said, have a look at the code. Personally Iā€™m happy with the internal state database as it is so will not do anything in this regard. Iā€™m more interested in a fast start-up and a good UI. And currently .thing/.items files are parsed via XTend/XText which pulls in a gigantic 3prd party library that is slow and evolves slow (we canā€™t update to newer java versions at the moment because of that) and I just want to get rid of that mess and instability that it inflicts.

I was under the impression we are talking about configuration not about storage of items/things.
It is perfectly fine to have only one way of doing so ( and this is the status quo as you keep mentioning that everything gets loaded from jsondb).

Nobody wants the keep .thing/.items files nor the XTend libraries. The only dependency here is the yaml-parser and configuration would be done using the yaml syntax.

1 Like

And I was under the impression that you want to replace jsondb with yamldb. Because that is the only way to archive a single source of truth.

No - I want a consistent, logical and flexible way to configure things and I provided a concept how it can be done.
If that means to get rid of jsondb itā€™s fine with me.

1 Like

hereā€™s a actual good UI nobody will ever ask for textual files again. Pretty sure.

You keep saying that, yet many times people have said that itā€™s not true.

I chose OpenHab because of textual configuration.
yes, I do believe there are powerusers who prefer GUI configuration, just as there are beginners who prefer text.

In the poll on this page most people selected both interfaces.

Iā€™m not against a great GUI, I am pro also text configuration.

1 Like

I think Davidā€™s point is you cannot have static read only text configs and automatic discovery of Things.

The discussion on how the handle the automatic discovery is happening, so Iā€™m ignoring that part here.

For me I donā€™t use automatic discovery from things.(especially because i use the same configuration on two openhabs instances that swap between production and test)

so having static read only without automatic discovery would work for me.
yes this means i need a way to set the all that config info also in the static files.
yet when I can do that, Iā€™m ok with not being able to access the rest of the current state.

and yes Iā€™m personally OK when that means that Iā€™m limited to a reboot of openhab to do this.
My use of a source control system is more important then to have the current state of whatever openhab needs besides the configuration in files.

just out of curiosity, what bindings do you use?

Itā€™s not clear who you are replying to. I always try to tag the user or quote from their post just to make it clear.

I doubt it was me but just in case:

Actively use:

  • Bindings: zwave, astro, expire1, network, http1, mqtt1, mqtt, networkupstools1, nest, openweathermap,
  • UIs: paper, basic, habmin,
  • Persistence: mapdb, influxdb
  • Transformations: map, jsonpath, regex, javascript
  • Misc: openhabcloud, restdocs, market

Installed but not actively used, mainly legacy left overs or stuff Iā€™m learning:

  • Bindings: zigbee
  • UI: habpanal, habot
  • Actions: mail
  • Transformations: xslt

Sorry Rich, I was asking Yves
thanks anyhowā€¦ I believe youā€™ve told me your personal setup before

binding = astro,exec,hue,mqtt1,netatmo,ntp,samsungtv,fronius,anel1,neato
hue and ntp not activly used at this moment.
anel1 is the biggest part.

ui = basic
persistence = influxdb
action = mail

all the bindings that need things are configured using .things

Why are you asking?

Sorryā€¦ as statedā€¦ just curious
Iā€™m new to OpenHAB, still learning. This is an amazing discussion. Iā€™m watching the development of this platform and am in awe of the work you guys are doing. Your opinion on the configuration is important to this discussion and I wondered how you used the platform

An example of why .thing files are just super confusing for people:

And another one:

Doesnā€™t seem to be so hand-edit friendly the current .thing file syntax, is it? :wink:

1 Like

But thatā€™s not because it is text as it seems you want to indicate. It is because of lack of documentation.
As .things were not part of OH1, unlike the well-known and well-working .items format, almost noone ever documented the .things syntax, at least not in a central place and generic form.

3 Likes

Unmanaged zwave Things are also very troublesome, because you canā€™t configure them, although this applies to more than zwave. Hopefully, one day we can get this in place. But personally, I donā€™t mind managed Thingsā€¦ Items are a different story.

1 Like

worked my way through this thread - still sane i think :slight_smile:

And I still believe there is a way to make every one happy.

The new tablet guy, who wants todo everything with his UI. No idea what a backup is but wants his ā€šundoā€˜ button.

The full control text only guy with partly distributed config over several systems - all productive versions surely resting inside a git

Hopefully respecting the work already done in the OH2 core :thinking:

Import/ Export ( aka Backup Restore) be available
through GUI and through commandline.

Now the new part.

There should be an option to configure a custom command after an backup. And a configuration when a backup should happen (on regular base/ on change ofā€¦).
This way you could always have an up to date text based backup file. To distribute edit an import on all systems you like even automatic.

The storage provider (jsondb as i understood)
should keep track of changes to the configuration. So when the serialization happen, the old db will be moved to a (rolling?) history. Or if git is fast enough it will do through git. Every serialazation a new commit? A diff Function could show changes between those ā€šsnapshotsā€˜ in the ui.

It still is a lot of work but should much less then replacing current runtime storage concept.

What do you think?

1 Like

The planned backup service will allow to run commands after an export and will on its own be able to backup to a git repository. But thatā€™s not enough for the hardcore textual fraction. I donā€™t see a solution.

My idea is to make .thing/.item file support an installable service instead of being part of the core. Whoever want to stick to those files can do so. Everybody else can use the backup service.

Objection Honorable Moderator. Thereā€™s no proof that text users are only a fraction! :wink: