Before filing a request on Github, I wanted to discus the idea here in the forum.
The use case:
Fully automated setup and configuration of OpenHAB and supporting systems (a Kubernetes cluster using Ansible and encrypted variables in a Github repo in my case) with configuration files instead of UI.
I am finally moving from Sitemap to mainUI and noticed that it is very much Web UI oriented and not so much config files oriented. The struggle I have with the current jsondb
setup is that all entries of a specific category end up in one big file.
Looking at userdata/jsondb/*.json
files I came up with the idea that an include folder mechanism, much like a common method used in Linux, would be a great addition to simplify handling changes in configurations as well as automation of config deployments/updates. It would be an addition to the current mechanism without impacting the existing UX.
Letās take the UI widgets as an example. I installed 3 widgets from with the UI and added a dummy custom widget. The resulting uicomponents_ui_widget.json
looks like this (most details collapsed):
"garbage_list_v1": {
"class": "org.openhab.core.ui.components.RootUIComponent",
"value": {
"uid": "garbage_list_v1",
"tags": [
"marketplace:114871"
],
"props": {
},
"timestamp": "Feb 3, 2021, 7:17:40 PM",
"component": "f7-card",
"config": {
"title": "\u003dprops.title"
},
"slots": {
}
}
},
"rlk_battery_status": {
"class": "org.openhab.core.ui.components.RootUIComponent",
"value": {
"uid": "rlk_battery_status",
"tags": [
"marketplace:128043"
],
"props": {
},
"timestamp": "Nov 28, 2022, 8:17:12 AM",
"component": "oh-list-card",
"config": {
}
}
},
"washing_machine_v4": {
"class": "org.openhab.core.ui.components.RootUIComponent",
"value": {
"uid": "washing_machine_v4",
"tags": [
"marketplace:116621"
],
"props": {
},
"timestamp": "Oct 2, 2021, 9:24:59 PM",
"component": "f7-card",
"config": {
"title": "\u003d(props.title)"
},
"slots": {
}
},
"widget_53505866a9": {
"class": "org.openhab.core.ui.components.RootUIComponent",
"value": {
"uid": "widget_53505866a9",
"tags": [],
"props": {
},
"timestamp": "Dec 31, 2023, 8:31:08 AM",
"component": "f7-card",
"config": {
}
}
}
}
This can grow to a large collection when adding many widgets with everything in the same file, both your own custom widgets and installed marketplace widgets. This makes it harder to use a file-based configuration management, like (many?) OH users still do and prefer. And it also makes it harder to do more structural/larger changes to an existing setup because a simple backup/restore of the json
file will not be enough, and you might vey well end up manually editing the file and copy/paste your custom stuff.
Similar situations could arise with the other jsonsb
files but I havenāt looked into it yetā¦
My proposal is to implement an include folder mechanism. The UI widget example would result in a folder called userdata/jsondb/uicomponents_ui_widget.d/
where individual widget definition files are stored. They will be loaded after the base file uicomponents_ui_widget.json
to make it behave predictably. This way, it is easy to maintain your own widget collection and have them updated, applied or removed as needed.
Thoughts anyone (besides telling me that file based configurations are a thing of the past⦠)?