I am happily cruising with HABApp on my quest for a fully scriptable house automation setup
One of the items missing on my plan of a fully hands-off and static docker image for the house are Sitemaps and “Pages” in OpenHAB. Currently, I create most of my things, items and (DSL) rules from python scripts which are then baked into the docker image. I am thinking to move this part to HABApp as it is able to create, on the fly, things and items.
Can I do the same for Sitemaps and especially pages (which seem to have not textual representation in OH 4.x) ?
Seems way overly complicated but, what ever floats your boat. I’ve always been very suspicious of code that creates code.
Anyway, I guess it largely depends on what you mean by “create from Python scripts”. Are you generating .things, .items, and .rules files? Then you can create .sitemap files the same way.
If you are creating these as managed entities through the REST API, then you can use the REST API to create the Sitemaps and MainUI Pages/Widgets.
The REST API or manually manipulating the JSONDB file (OH cannot be running when you do this) is the only way to do MainUI configs like that.
Note, use of the Semantic Model will populate the Overview Page automatically. And you can customize who each Item appears there (or whether it appears there) through Item metadata. So you do have control over at least that part of MainUI through your Items’ configs.
Yep, I remember fondly our discussions about textual config vs. PaperUI vs. jsondb manipulation way back when
My previous setup ran into an orchestration problem, I did not want to have a second application running after the OH container started. But this issue seems to be solved now with HABApp being able to detect OH having started and then do REST calls.
Now all I would love to have would be a nice programmatic interface to Page configuration instead of POSTing a json document fragment but this might be a enhancement idea…