I’m constantly impressed with how slick HA is, but when it comes to the visual/yaml editor I become very confused. I do understand the simple rule “if you have a template in your (eg;) automation, then you must use the YAML editor”. What I don’t understand is WHY?
We see the template in the YAML editor, in text form. We can enter plain ascii, in text form, into the visual editor and all remains fine. We can enter the template into the visual editor, in text form. and then POOF! no more smart Visual Editor. What’s going on? I mean, the visual editor is not being asked to parse or compile or execute the template, it’s just being asked to hold the template in text form. Perhaps it could just use a red-coloured font or somesuch visual clue as to “this may or may not work”.
What is it about the dreaded text template, (the template is only ever entered in text form), that makes the Visual Editor have such a hissing fit? Apologies if this newbie is making waves for no reason, perhaps it really is too difficult a problem to solve, and because I’m new I don’t understand the difficulties.
If anyone can explain (using short words please) why this is not possible, I’d be grateful.
It’s mainly because there are UI elements that would support templates but can’t accept template characters. Like a slider and it’s numerical box. A slider’s numerical box only accepts numbers as an input, not a template. So if you had a template in that field and when to UI mode, it would jumble things up. This is only one example, but there are many other UI elements that would have similar (but different) problems.
He’s referring to the service data, if you start typing {{ or {% into a field, it immediately kicks you into yaml mode. Template specific conditions and triggers accept templates without a problem.
Home Assistant is an open-source project; it’s the product of contributions by a team of paid (Nabu Casa) and a large group of volunteer software developers. Until someone invests their time and effort to implement service data completely visually, you’ll have to learn to live with the way it works now.
Ok, fair enough, I understand there are certain cases where it would prove problematic. And probably also for the uninitiated (me) it seems like it would be a simple workaround. Text string ← Template
I get it though, it’s not always as simple as we’d like.
Thanks for your patient explanation @petro, I appreciate it.
FWIW, my impression, and I may be wrong, is that there are far fewer developers contributing to Home Assistant’s UI than to its other functionality. Plus it can be a thankless task because every change seems to rub someone the wrong way. Instead of suggesting how to improve it, they just rant about how they hate it. That’s hardly an incentive for someone to contribute to the UI …
That’s starting to change, but typically been the case. UI’s aren’t fun for everyone to dev. And the hard problems are usually thread related so they can be a PITA to figure out.
Yup, a recent example is the UI widget for a schedule entity. There are several nasty usability bugs logged (showstoppers like disappearing time periods, time periods defaulting to half-hour boundaries, all time periods disappear when viewed on a Sunday, etc) but haven’t yet been addressed in the last 5 patch releases. (To be clear, I am not complaining just giving an example of staffing/resource limitations.)