WTH why can't I permanently delete jinja2 tutorial in the template editor

Big annoyance. Every time I open up the template editor in developer tools I am greeted with a wall of text. The temperature is always 25 °C. Anne Therese and Paulus are always at unknown and will be forever. The “You are both home, you silly” will never trigger because the device trackers are only present on Paulus’ system. So as a working example for a tutorial it doesn’t really work on most people’s systems. (Perhaps updating it to use sensors present on all installations like sun.sun would make it more relevant.)

I always have to go CTRL-A then hit delete every time I use the editor. Can’t we have an option to make it go away forever like if advanced mode is enabled?

Yes please! Sometimes I even want to test a template idea on my phone away from my computer… but I can’t because I cannot select text in that box to clear it.

you can’t even ctrl + A on a mobile device. You have to select all then hit delete (and nothing happens because of a mobile bug). So you just deal with this wall of text and cry yourself to sleep.

4 Likes

Yes please!

There’s another topic on this paper-cut, over here:

1 Like

Oh yeah that would be awesome. Profile setting perhaps?

1 Like

Yeah, it’s slightly annoying having to clear these all the time. The “for loop” example causes an enormous wall of text on my system because I have a lot of entities.

I think it should work like the Services tab where there’s a button underneath to “Fill Example Data.”

5 Likes

It’s quite interesting that a duplicate of the WTH gets more votes than the “original” idea. Maybe we should sum those points from both topics? :smiley:

IMO, much more annoying behavior is that it’s not refreshing template value by itself once you put what you wanted into this text area.

Anyways, I personally don’t think that removing this tutorial completely would be a good solution. At a still-learning stage it still could be helpful to take a peek on this example when needed.
Apart from that, there wouldn’t be much benefit after all. You would still need to focus on the text area and then hit CMD/CTRL + V to paste your template. So that would only eliminate CMD/CTRL + A step. Still not efficient enough. “Paste from clipboard” button would be much more useful and flexible.

1 Like

One could just add a checkbox to hide it, saved in the users preferences.

Yeah. But like I said, that still wouldn’t much improve pasting your own templates there. Still need to focus and hit ctrl+v.
So that would be (1) harder to code, (2) one more preference to preserve, (3) less useful and flexible solution.
I will definitely argue that solution proposed by me is far more user friendly and efficient.

I guess 90% of the times, I write the templates from scratch, so there is hardly no “ctrl-v” pasting anyway.
Maybe I paste some sensor-names or something, but I usually use the editor to build templates, not to paste them…

Here, the for loop in the example is creating a wall of text that is 45 000 characters long… That is completely unnecessary and might even cause some extra load on the system, parsing out every single sensor. I know how to create for loops, and would rather just have a blank sheet to start from.
With a checkbox, I can chose that myself, and you can do as much ctrl-a-ctrl-v you like, just don’t tick the checkbox.
It is one single “if”-sentence, to check if a user option is set before filling out the template editor with the default code. Hardly very difficult to code.
I also dont see any conflict between preserving this as a user setting, and creating a “paste” button, even if I personally see far less use for that. I don’t need an extra button to paste the clipboard into a textarea as I am able to use ctrl-v whenever I need to actually paste something. But if it gets added, I am able to deal with that, and just not use it…

Still, a button with “clear & focus” functionality would be equally useful for you then. Still just one click.
But maybe you’re right and I was wrong, there’s no conflict between those two approaches.

IMO this should as well be controlled by the advanced toggle, if you consider yourself an advanced user you do not need that default information in there.

6 Likes

Not a bad Idea. There’s another thread with a ‘clear’ button. I also like that Idea.

1 Like

I found the template boilerplate here:
/usr/local/lib/python3.8/site-packages/hass_frontend/frontend_latest/chunk.794c8bdef23184d0fd92.js

It’s hard-coded inside a boatload of javascript. Would be nice if the boilerplate were in a separate file located, perhaps, in /config where the user can optionally delete its contents.

Aspirational goal: have the ability to save the Template Editor’s contents to that file (in order to survive a restart).

1 Like
7 Likes