2023.4: Custom template macros, and many more new entity dialogs!

That comes across very ignorant… Let’s put it this way, you add a card to the dashboard with a slider and toggle for a light or what not. You then use the tap/hold action to show a more-info dialog only to be shown the exact same controls and nothing else without extra clicks.

But I guess I’ve been doing my floorplan wrong all these years

Come to think about it, how else were you selecting your colour or effects without a more-info dialog?

8 Likes

Just upgraded.
Got a few Dropping index[...]Please be patient! messages in my logs.

I’m very patient by nature :wink: but I just wondered if there would be a message in the logs when it is finished?

1 Like

That was a very hasty conclusion. Hope you will understand by yourself.

3 Likes

Well said. I think this is the crux of the issue here. I have a switch in the UI which I can click/tap to turn a light on or off. I click or long-press to get “more info” and I’m presented with another switch which does the exact same thing. In what universe is this considered good design?

I don’t think anyone is questioning the aesthetics. Go ahead. Make it all pretty and trendy. Just consider how people actually use it.

12 Likes

Thanks for the reply, actually found it hiding in a random custom weather package I had installed. Removed and all good now :slight_smile:

1 Like

Great thanks, would be useful to have it on dev tools page though with the rest

it is…

I meant here…

2 Likes

Surely reloading macros must be a separate entry in the “yaml reloading” page since these macros may be used everywhere - in config (like template sensors), blueprints & lovelace.

Yes, but that page is reloading yaml… does it really make sense to reload non yaml on that page?

E.g. reloading UI integrations isn’t there either.

custom templates ARE yaml.

No, they are Jinja. The file does not accept YAML. It even makes this clear with the filename being xxx.jinja.

Jinja is the templating language. Yaml is a formatting language. They are not the same. Yaml accepts strings. Home assistant abuses this by allowing the JINJA to be added in Yaml as a string.

Does it make a huge difference?
The main thing that macros are managed - like yaml - not via UI.
What is a reason of disagreement?
Reloading macros - from the user’s PoV - same as reloading yaml.

Just rename “YAML reloading” view to “YAML & jinja reloading” (or whatever).

Because the page is listed as YAML… it’s not rocket science here. Not to mention, that page is auto generated based on the integrations that add a reload service. Which is not done by templates because there is no “Jinja” integration. Jinja is built into home assistant, it’s one of the few things that’s not an integration and built directly into core.

1 Like

I hope that technically you are 100% right.
But this is about usability.
It is more convenient for users to “reload macros”, then reload whatever he wants - from ONE page.

1 Like

Macros… am I doing something wrong or is there a bug?
I don’t seem to be able to get one to return a list.

{% macro return_list() %}
  {% set item1 = 'foo' %}
  {% set item2 = 'bar' %}
  {{ [item1, item2] }}
{% endmacro %}

My money is on user error (i.e. me) but I can’t see where…

Yes sure, it’s a #feature-requests and the backbone does not exist to add it and it would need to be designed both in the frontend and backend. So please, make a #feature-requests but it’s not a simple “Oh just add it” kind of thing like you’re making it out to be.

1 Like

Macro’s return strings. You have to use from_json / to_json to convert to complex types like lists and dictionaries. boolean, floats, ints, just need to use the appropriate | filter

{% macro return_list() %}
  {% set item1 = 'foo' %}
  {% set item2 = 'bar' %}
  {{ [item1, item2] | to_json }}
{% endmacro %}
{% from 'test_macros.jinja' import return_list }}
{% set mylist = return_list() | from_json %}
{{ mylist[0] }}
3 Likes

Let devs decide, no problem at all.
Once again, I am interested in usability only here.

Registered in Discussions.
Everyone is welcome to participate:

3 Likes

given the fact these new macro’s are (at least part of our set of) templates (they’re even saved in custom _templates), it would indeed be very logical (and expected tbh) to have them reload using the quickbar key C- templates. And yes, also via the Yaml button. During 2023.4 beta, several people already mentioned that.

whether these templates are Jinja, or written in yaml, or not is not really relevant, and should ideally be a black box for the user really.

The fact the button has a Label YAML on it should be no reason to not think about adding the custom_templates to the templates…

moreover, Quickbar C also offers:

Scherm­afbeelding 2023-04-11 om 16.51.48

the latter 2 are also services. not Yaml. Adding the new reload custom_templates seems not to impossible because of that…

4 Likes