I most recently migrated form 3.4.3 to 5.1.3; all good; however, HABpanel would no longer run on targets that have not changed… thus, I created a clone of the HABpanel with the MainUI… my first ever.
I have a bunch of question I am seeking answers to, ideally from people who have experience with this interface design/code, to help me arrive at good practice.
While there is an integrated editor, and me documenting nicely, when I first saved the code, it removed all my comments. No comments is not my style of working. Is there an alternative, using e.g., VScode (the issue is live testing, and then copy into jsondb to share with the device)?
Following up on 1. is there development under way to improve this experience? In particular to retain comments? Maybe someone knows something. As I am probably using v5 like v1 when I started out yet visit the forum spaces beyond basic use rarely (UI so far never [other than the most recent HABpanel posts]).
How do people version-control their work, in particular what seems to live in the jsondb?
I used the cards, but these lack control. Is there an alternative way; f7, css?! … as in not using the cards, to achieve the outcome? E.g., background icons… Yes, I have no clue; hence, my questions. I learn what I need to.
While this is more a matter of taste; what display size is preferred (or rather most practical) these days? The rPi display (800x480) is nice and crisp, but a bit smallish for widgets.
Anything else I should have asked; let know know, as foresight helps in prevent mistakes.
I usually strongly recommend not moving away from the integrated editor for widgets because nothing else will be able to give you the live preview of your widget. It might be possible (though I’m not sure) that a VSC plugin could be developed that gives you the same or similar autocomplete, trying to create even a moderately complex widget without the live preview would be, for me a total non-starter.
The comments issue relates to the fact that the YAML is converted to JSON for storage and then read back into yaml for editing. JSON does not support comments and so, the YAML comments are lost during the conversion.
The simple work around here is instead of using YAML comments, just add a comment key to any config where you need a comment:
- component: f7-card
config:
comment: DateTime Item and Title properties required for this card
...rest of config
You can even take advantage of multi-line YAML strings for long comments if that’s your preferred comment style.
In the very early days of MainUI jsondb file creation was not deterministic and version control of those files was therefore not useful. That’s not been the case for 4 or 5 years now and all the JSON in those db files is consistently ordered to git version control of the jsondb folder is a very common solution (somewhere, though I can’t find it any more @rlkoshak posted a recommend .gitignore config to make versioning the jsondb folder even saner).
I personally actually don’t even do that any more. My OH is on a VM with regular differential backups so I don’t really feel the need for additional versioning. This has not (yet) come back to haunt me. On the other hand, my UI is pretty stable and I haven’t done massive short-term development on it in a while.
Short answer: you need the oh- widgets to interact with OH concepts (send item commands run rules etc.). Beyond that you have nearly the full flexibility of HTML and CSS as your disposal.
For me there isn’t an answer to this question. The power of the MainUI system is to build responsive interfaces that work well for many different sizes. Yes, there are particular fixed layout options that emulate the old HABPanel fixed size dashboard, but in the long run, I fond that those are just more work because then you are building and maintaining multiple configurations instead of a single responsive one.